summaryrefslogtreecommitdiffstats
path: root/src/DabMod.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2017-01-06 16:22:40 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2017-01-06 16:22:40 +0100
commit2dac8f5fa6d63a71a726ec373af9bf45f22de8b7 (patch)
tree3ba060598ad471018d324dff427490ab681c57df /src/DabMod.cpp
parent3633bcc99aedda5d9ea36c143fa339139c763d3e (diff)
downloaddabmod-2dac8f5fa6d63a71a726ec373af9bf45f22de8b7.tar.gz
dabmod-2dac8f5fa6d63a71a726ec373af9bf45f22de8b7.tar.bz2
dabmod-2dac8f5fa6d63a71a726ec373af9bf45f22de8b7.zip
EDI: handle pseq resync and SIGINT
Diffstat (limited to 'src/DabMod.cpp')
-rw-r--r--src/DabMod.cpp69
1 files changed, 32 insertions, 37 deletions
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<DabModulator>(
- 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<DabModulator>(
+ 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 {