diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2018-08-06 15:52:21 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2018-08-06 15:52:21 +0200 |
commit | 6db7ccca948f94570b86b82970afeb4ed7be718f (patch) | |
tree | 7213dcc2ec5d48f6c1476861c1ed18d58141f22e /src/zmq2edi/EDISender.cpp | |
parent | b9afad6f157ca35dada1ee48e0239bcb04b6ec4b (diff) | |
download | dabmux-6db7ccca948f94570b86b82970afeb4ed7be718f.tar.gz dabmux-6db7ccca948f94570b86b82970afeb4ed7be718f.tar.bz2 dabmux-6db7ccca948f94570b86b82970afeb4ed7be718f.zip |
zmq2edi: Add option to drop late packets
Diffstat (limited to 'src/zmq2edi/EDISender.cpp')
-rw-r--r-- | src/zmq2edi/EDISender.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/zmq2edi/EDISender.cpp b/src/zmq2edi/EDISender.cpp index 9cd84c7..236222c 100644 --- a/src/zmq2edi/EDISender.cpp +++ b/src/zmq2edi/EDISender.cpp @@ -3,7 +3,7 @@ 2011, 2012 Her Majesty the Queen in Right of Canada (Communications Research Center Canada) - Copyright (C) 2017 + Copyright (C) 2018 Matthias P. Braendli, matthias.braendli@mpb.li http://www.opendigitalradio.org @@ -47,10 +47,12 @@ EDISender::~EDISender() } } -void EDISender::start(const edi_configuration_t& conf, int delay_ms) +void EDISender::start(const edi_configuration_t& conf, + int delay_ms, bool drop_late_packets) { edi_conf = conf; tist_delay_ms = delay_ms; + drop_late = drop_late_packets; if (edi_conf.verbose) { etiLog.log(info, "Setup EDI"); @@ -242,10 +244,14 @@ void EDISender::send_eti_frame(uint8_t* p, metadata_t metadata) */ const auto wait_time = t_release - t_now; + wait_times.push_back(duration_cast<microseconds>(wait_time).count()); + if (t_release > t_now) { std::this_thread::sleep_for(wait_time); } - wait_times.push_back(duration_cast<microseconds>(wait_time).count()); + else if (drop_late) { + return; + } edi_tagDETI.tsta = tist; edi_tagDETI.atstf = 1; |