From 2dac8f5fa6d63a71a726ec373af9bf45f22de8b7 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 6 Jan 2017 16:22:40 +0100 Subject: EDI: handle pseq resync and SIGINT --- src/DabMod.cpp | 69 +++++++++++++++++++++++++++------------------------------- 1 file changed, 32 insertions(+), 37 deletions(-) (limited to 'src/DabMod.cpp') diff --git a/src/DabMod.cpp b/src/DabMod.cpp index e48e748..a5c0de6 100644 --- a/src/DabMod.cpp +++ b/src/DabMod.cpp @@ -3,7 +3,7 @@ Her Majesty the Queen in Right of Canada (Communications Research Center Canada) - Copyright (C) 2016 + Copyright (C) 2017 Matthias P. Braendli, matthias.braendli@mpb.li http://opendigitalradio.org @@ -777,51 +777,46 @@ int launch_modulator(int argc, char* argv[]) set_thread_name("modulator"); if (ediUdpInput.isEnabled()) { - while (run_again) { - Flowgraph flowgraph; + Flowgraph flowgraph; - etiLog.level(debug) << "Build mod"; - auto modulator = make_shared( - ediReader, tiiConfig, outputRate, clockRate, - dabMode, gainMode, digitalgain, normalise, - filterTapsFilename); - - etiLog.level(debug) << "Connect"; - if (format_converter) { - flowgraph.connect(modulator, format_converter); - flowgraph.connect(format_converter, output); - } - else { - flowgraph.connect(modulator, output); - } + auto modulator = make_shared( + ediReader, tiiConfig, outputRate, clockRate, + dabMode, gainMode, digitalgain, normalise, + filterTapsFilename); - etiLog.level(debug) << "SetETISource"; + if (format_converter) { + flowgraph.connect(modulator, format_converter); + flowgraph.connect(format_converter, output); + } + else { + flowgraph.connect(modulator, output); + } #if defined(HAVE_OUTPUT_UHD) - if (useUHDOutput) { - ((OutputUHD*)output.get())->setETISource(modulator->getEtiSource()); - } + if (useUHDOutput) { + ((OutputUHD*)output.get())->setETISource(modulator->getEtiSource()); + } #endif - etiLog.level(debug) << "Loop"; - size_t framecount = 0; - while (true) { - while (not ediReader.isFrameReady()) { - ediUdpInput.rxPacket(); - } - etiLog.level(debug) << "Frame Ready"; - framecount++; - flowgraph.run(); - etiLog.level(debug) << "now clear"; - ediReader.clearFrame(); - - /* Check every once in a while if the remote control - * is still working */ - if ((framecount % 250) == 0) { - rcs.check_faults(); + size_t framecount = 0; + bool running = true; + while (running) { + while (not ediReader.isFrameReady()) { + bool success = ediUdpInput.rxPacket(); + if (not success) { + running = false; + break; } } + framecount++; + flowgraph.run(); + ediReader.clearFrame(); + /* Check every once in a while if the remote control + * is still working */ + if ((framecount % 250) == 0) { + rcs.check_faults(); + } } } else { -- cgit v1.2.3