summaryrefslogtreecommitdiffstats
path: root/src/DabMod.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2016-01-31 22:35:17 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2016-01-31 22:35:17 +0100
commit5ac4621df043666836107e0e0aaa3df709fb866e (patch)
treeb11ea1bff6c671597adcc46ed8dfe2593fee38a9 /src/DabMod.cpp
parentf607e5406666dbd1646b427af9b46c956829a773 (diff)
downloaddabmod-5ac4621df043666836107e0e0aaa3df709fb866e.tar.gz
dabmod-5ac4621df043666836107e0e0aaa3df709fb866e.tar.bz2
dabmod-5ac4621df043666836107e0e0aaa3df709fb866e.zip
Restart when FrameMultiplexer sees a different configuration
Diffstat (limited to 'src/DabMod.cpp')
-rw-r--r--src/DabMod.cpp42
1 files changed, 27 insertions, 15 deletions
diff --git a/src/DabMod.cpp b/src/DabMod.cpp
index f250850..57ff79b 100644
--- a/src/DabMod.cpp
+++ b/src/DabMod.cpp
@@ -105,13 +105,14 @@ struct modulator_data
RemoteControllers* rcs;
};
-enum run_modulator_state {
- MOD_FAILURE,
- MOD_NORMAL_END,
- MOD_AGAIN
+enum class run_modulator_state_t {
+ failure, // Corresponds to all failures
+ normal_end, // Number of frames to modulate was reached
+ again, // FCT discontinuity or ZeroMQ overrun
+ reconfigure // Some sort of change of configuration we cannot handle happened
};
-run_modulator_state run_modulator(modulator_data& m);
+run_modulator_state_t run_modulator(modulator_data& m);
int launch_modulator(int argc, char* argv[])
{
@@ -786,15 +787,15 @@ int launch_modulator(int argc, char* argv[])
m.inputReader->PrintInfo();
- run_modulator_state st = run_modulator(m);
+ run_modulator_state_t st = run_modulator(m);
switch (st) {
- case MOD_FAILURE:
+ case run_modulator_state_t::failure:
etiLog.level(error) << "Modulator failure.";
run_again = false;
ret = 1;
break;
- case MOD_AGAIN:
+ case run_modulator_state_t::again:
etiLog.level(warn) << "Restart modulator.";
run_again = false;
if (inputTransport == "file") {
@@ -816,7 +817,12 @@ int launch_modulator(int argc, char* argv[])
#endif
}
break;
- case MOD_NORMAL_END:
+ case run_modulator_state_t::reconfigure:
+ etiLog.level(warn) << "Detected change in ensemble configuration.";
+ /* We can keep the input in this care */
+ run_again = true;
+ break;
+ case run_modulator_state_t::normal_end:
default:
etiLog.level(info) << "modulator stopped.";
ret = 0;
@@ -839,9 +845,9 @@ int launch_modulator(int argc, char* argv[])
return ret;
}
-run_modulator_state run_modulator(modulator_data& m)
+run_modulator_state_t run_modulator(modulator_data& m)
{
- run_modulator_state ret = MOD_FAILURE;
+ auto ret = run_modulator_state_t::failure;
try {
while (running) {
@@ -879,21 +885,27 @@ run_modulator_state run_modulator(modulator_data& m)
etiLog.level(error) << "Input read error.";
}
running = 0;
- ret = MOD_NORMAL_END;
+ ret = run_modulator_state_t::normal_end;
}
#if defined(HAVE_OUTPUT_UHD)
} catch (fct_discontinuity_error& e) {
// The OutputUHD saw a FCT discontinuity
etiLog.level(warn) << e.what();
- ret = MOD_AGAIN;
+ ret = run_modulator_state_t::again;
#endif
} catch (zmq_input_overflow& e) {
// The ZeroMQ input has overflowed its buffer
etiLog.level(warn) << e.what();
- ret = MOD_AGAIN;
+ ret = run_modulator_state_t::again;
+ } catch (std::out_of_range& e) {
+ // One of the DSP blocks has detected an invalid change
+ // or value in some settings. This can be due to a multiplex
+ // reconfiguration.
+ etiLog.level(warn) << e.what();
+ ret = run_modulator_state_t::reconfigure;
} catch (std::exception& e) {
etiLog.level(error) << "Exception caught: " << e.what();
- ret = MOD_FAILURE;
+ ret = run_modulator_state_t::failure;
}
return ret;