summaryrefslogtreecommitdiffstats
path: root/src/DabMod.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2019-05-06 17:18:25 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2019-05-06 17:18:25 +0200
commit107dca66a069c5e317d040360b8aafd62c8282db (patch)
tree534e9e4860327b8b49170f103b9f7419832c1928 /src/DabMod.cpp
parent473232ab177a4811115ff5713bb25893448dafd7 (diff)
downloaddabmod-107dca66a069c5e317d040360b8aafd62c8282db.tar.gz
dabmod-107dca66a069c5e317d040360b8aafd62c8282db.tar.bz2
dabmod-107dca66a069c5e317d040360b8aafd62c8282db.zip
Implement EDI over TCP
Diffstat (limited to 'src/DabMod.cpp')
-rw-r--r--src/DabMod.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/DabMod.cpp b/src/DabMod.cpp
index 7ebde12..1f435bf 100644
--- a/src/DabMod.cpp
+++ b/src/DabMod.cpp
@@ -306,11 +306,11 @@ int launch_modulator(int argc, char* argv[])
// setMaxDelay wants number of AF packets, which correspond to 24ms ETI frames
ediInput.setMaxDelay(lroundf(mod_settings.edi_max_delay_ms / 24.0f));
}
- EdiUdpInput ediUdpInput(ediInput);
+ EdiTransport ediTransport(ediInput);
- ediUdpInput.Open(mod_settings.inputName);
- if (not ediUdpInput.isEnabled()) {
- throw runtime_error("inputTransport is edi, but ediUdpInput is not enabled");
+ ediTransport.Open(mod_settings.inputName);
+ if (not ediTransport.isEnabled()) {
+ throw runtime_error("inputTransport is edi, but ediTransport is not enabled");
}
Flowgraph flowgraph;
@@ -329,16 +329,27 @@ int launch_modulator(int argc, char* argv[])
bool first_frame = true;
+ auto frame_received_tp = chrono::steady_clock::now();
+
while (running) {
while (running and not ediReader.isFrameReady()) {
try {
- ediUdpInput.rxPacket();
+ bool packet_received = ediTransport.rxPacket();
+ if (packet_received) {
+ frame_received_tp = chrono::steady_clock::now();
+ }
}
catch (const std::runtime_error& e) {
etiLog.level(warn) << "EDI input: " << e.what();
running = 0;
break;
}
+
+ if (frame_received_tp + chrono::seconds(10) < chrono::steady_clock::now()) {
+ etiLog.level(error) << "No EDI data received in 10 seconds.";
+ running = 0;
+ break;
+ }
}
if (not running) {