diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2018-01-28 07:19:38 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2018-01-28 07:19:38 +0100 |
commit | addfba670d14c837084894f8cc5a64f47f296051 (patch) | |
tree | e25b5bcbeddfb4a50c35c37a2f703560c52828fc | |
parent | e6fb51ebaec9a28dfffe47d0947226d9dd3b1fbf (diff) | |
download | dabmod-addfba670d14c837084894f8cc5a64f47f296051.tar.gz dabmod-addfba670d14c837084894f8cc5a64f47f296051.tar.bz2 dabmod-addfba670d14c837084894f8cc5a64f47f296051.zip |
Guarantee flowgraph starts at FP 0
-rw-r--r-- | src/DabMod.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/DabMod.cpp b/src/DabMod.cpp index 78393bd..bf3de94 100644 --- a/src/DabMod.cpp +++ b/src/DabMod.cpp @@ -306,6 +306,8 @@ int launch_modulator(int argc, char* argv[]) size_t framecount = 0; + bool first_frame = true; + while (running) { while (not ediReader.isFrameReady()) { bool success = ediUdpInput.rxPacket(); @@ -314,6 +316,19 @@ int launch_modulator(int argc, char* argv[]) break; } } + + if (first_frame) { + if (ediReader.getFp() != 0) { + // Do not start the flowgraph before we get to FP 0 + // to ensure all blocks are properly aligned. + ediReader.clearFrame(); + continue; + } + else { + first_frame = false; + } + } + framecount++; flowgraph.run(); ediReader.clearFrame(); @@ -454,6 +469,7 @@ static run_modulator_state_t run_modulator(modulator_data& m) while (running) { int framesize; + bool first_frame = true; PDEBUG("*****************************************\n"); PDEBUG("* Starting main loop\n"); @@ -475,6 +491,17 @@ static run_modulator_state_t run_modulator(modulator_data& m) throw std::runtime_error("ETI read error"); } + if (first_frame) { + if (m.etiReader->getFp() != 0) { + // Do not start the flowgraph before we get to FP 0 + // to ensure all blocks are properly aligned. + continue; + } + else { + first_frame = false; + } + } + m.flowgraph->run(); /* Check every once in a while if the remote control |