From 5bea9241b246cfc4b9abef3d265a96d52a377c37 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Tue, 6 Mar 2018 17:52:07 +0100 Subject: Verify ETI FCT continuity before modulator --- src/DabMod.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src/DabMod.cpp') diff --git a/src/DabMod.cpp b/src/DabMod.cpp index 80dc6b4..b32231a 100644 --- a/src/DabMod.cpp +++ b/src/DabMod.cpp @@ -102,7 +102,7 @@ struct modulator_data enum class run_modulator_state_t { failure, // Corresponds to all failures normal_end, // Number of frames to modulate was reached - again, // ZeroMQ overrun + again, // Restart the modulator part reconfigure // Some sort of change of configuration we cannot handle happened }; @@ -317,7 +317,7 @@ int launch_modulator(int argc, char* argv[]) while (not ediReader.isFrameReady()) { bool success = ediUdpInput.rxPacket(); if (not success) { - running = false; + running = 0; break; } } @@ -439,10 +439,8 @@ int launch_modulator(int argc, char* argv[]) } #endif else if (dynamic_pointer_cast(inputReader)) { - // Create a new input reader - auto inputTcpReader = make_shared(); - inputTcpReader->Open(mod_settings.inputName); - inputReader = inputTcpReader; + // Keep the same inputReader, as there is no input buffer overflow + run_again = true; } break; case run_modulator_state_t::reconfigure: @@ -472,6 +470,7 @@ static run_modulator_state_t run_modulator(modulator_data& m) auto ret = run_modulator_state_t::failure; try { bool first_frame = true; + int last_eti_fct = -1; while (running) { int framesize; @@ -507,6 +506,16 @@ static run_modulator_state_t run_modulator(modulator_data& m) } } + // Check for ETI FCT continuity + const unsigned expected_fct = (last_eti_fct + 1) % 250; + const unsigned fct = m.etiReader->getFct(); + if (last_eti_fct != -1 and expected_fct != fct) { + etiLog.level(info) << "ETI FCT discontinuity, expected " << + expected_fct << " received " << m.etiReader->getFct(); + return run_modulator_state_t::again; + } + last_eti_fct = fct; + m.flowgraph->run(); /* Check every once in a while if the remote control -- cgit v1.2.3