From addfba670d14c837084894f8cc5a64f47f296051 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sun, 28 Jan 2018 07:19:38 +0100 Subject: Guarantee flowgraph starts at FP 0 --- src/DabMod.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src') 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 -- cgit v1.2.3