summaryrefslogtreecommitdiffstats
path: root/src/DabMod.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2017-01-06 17:08:17 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2017-01-06 17:08:17 +0100
commitf81473031810253f5b78fd02c2df04a5a204099b (patch)
tree720cb055951f1351412ac5a838d8b136bcca09a4 /src/DabMod.cpp
parent2dac8f5fa6d63a71a726ec373af9bf45f22de8b7 (diff)
downloaddabmod-f81473031810253f5b78fd02c2df04a5a204099b.tar.gz
dabmod-f81473031810253f5b78fd02c2df04a5a204099b.tar.bz2
dabmod-f81473031810253f5b78fd02c2df04a5a204099b.zip
Fix ETI-over-TCP and ZeroMQ inputs
Diffstat (limited to 'src/DabMod.cpp')
-rw-r--r--src/DabMod.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/DabMod.cpp b/src/DabMod.cpp
index a5c0de6..987b579 100644
--- a/src/DabMod.cpp
+++ b/src/DabMod.cpp
@@ -88,16 +88,18 @@ void signalHandler(int signalNb)
struct modulator_data
{
modulator_data() :
- inputReader(NULL),
+ inputReader(nullptr),
framecount(0),
- flowgraph(NULL),
- rcs(NULL) {}
+ flowgraph(nullptr),
+ etiReader(nullptr),
+ rcs(nullptr) {}
InputReader* inputReader;
Buffer data;
uint64_t framecount;
Flowgraph* flowgraph;
+ EtiReader* etiReader;
RemoteControllers* rcs;
};
@@ -691,7 +693,6 @@ int launch_modulator(int argc, char* argv[])
}
- EtiReader etiReader(tist_offset_s, tist_delay_stages);
EdiReader ediReader;
EdiDecoder::ETIDecoder ediInput(ediReader);
EdiUdpInput ediUdpInput(ediInput);
@@ -799,7 +800,7 @@ int launch_modulator(int argc, char* argv[])
#endif
size_t framecount = 0;
- bool running = true;
+
while (running) {
while (not ediReader.isFrameReady()) {
bool success = ediUdpInput.rxPacket();
@@ -826,6 +827,9 @@ int launch_modulator(int argc, char* argv[])
m.flowgraph = &flowgraph;
m.data.setLength(6144);
+ EtiReader etiReader(tist_offset_s, tist_delay_stages);
+ m.etiReader = &etiReader;
+
auto input = make_shared<InputMemory>(&m.data);
auto modulator = make_shared<DabModulator>(
etiReader, tiiConfig, outputRate, clockRate,
@@ -911,7 +915,6 @@ int launch_modulator(int argc, char* argv[])
run_modulator_state_t run_modulator(modulator_data& m)
{
-
auto ret = run_modulator_state_t::failure;
try {
while (running) {
@@ -932,6 +935,12 @@ run_modulator_state_t run_modulator(modulator_data& m)
PDEBUG("* Read frame %lu\n", m.framecount);
PDEBUG("*****************************************\n");
+ const int eti_bytes_read = m.etiReader->loadEtiData(m.data);
+ if ((size_t)eti_bytes_read != m.data.getLength()) {
+ etiLog.level(error) << "ETI frame incompletely read";
+ throw std::runtime_error("ETI read error");
+ }
+
m.flowgraph->run();
/* Check every once in a while if the remote control