summaryrefslogtreecommitdiffstats
path: root/src/OutputUHD.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2015-06-05 09:15:56 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2015-06-05 09:22:22 +0200
commit71eb84d5f483af8d22402de3d2ec70b08b5802d3 (patch)
tree589fd978bdc357a0c67179d83c5c04bb0d732082 /src/OutputUHD.cpp
parentc9ea7fb88809d935f3eaeee108415ff5abd17ead (diff)
downloaddabmod-71eb84d5f483af8d22402de3d2ec70b08b5802d3.tar.gz
dabmod-71eb84d5f483af8d22402de3d2ec70b08b5802d3.tar.bz2
dabmod-71eb84d5f483af8d22402de3d2ec70b08b5802d3.zip
Fix intermittent underruns after a restart
When using UHD without synchronous=1: After a modulator restart, the input ZMQ buffer is nearly empty, and the modulator actually gets blocked by the ThreadsafeQueue. This is visible by looking at the time deltas printed in the debugging code. This commit adds a minimal form of prebuffering (10 ETI frames) to the ZeroMQ input, and removes the useless minimum required size for the ThreadsafeQueue. In synchronous=1, the issue is not visible because the TIST defines the time to transmit, which will cause the ZMQ buffer to fill.
Diffstat (limited to 'src/OutputUHD.cpp')
-rw-r--r--src/OutputUHD.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/OutputUHD.cpp b/src/OutputUHD.cpp
index ad31be7..acc4271 100644
--- a/src/OutputUHD.cpp
+++ b/src/OutputUHD.cpp
@@ -31,6 +31,7 @@
#include "PcDebug.h"
#include "Log.h"
#include "RemoteControl.h"
+#include "Utils.h"
#include <boost/thread/future.hpp>
@@ -349,8 +350,24 @@ int OutputUHD::process(Buffer* dataIn, Buffer* dataOut)
" to " << dataIn->getLength();
throw std::runtime_error("Non-constant input length!");
}
+
+ struct timespec time_before;
+ int time_before_ret = clock_gettime(CLOCK_MONOTONIC, &time_before);
+
mySyncBarrier.get()->wait();
+ struct timespec time_after;
+ int time_after_ret = clock_gettime(CLOCK_MONOTONIC, &time_after);
+
+ if (time_before_ret == 0 and time_after_ret == 0) {
+ etiLog.level(debug) << "Time delta : " <<
+ timespecdiff_us(time_before, time_after) << " us";
+ }
+ else {
+ etiLog.level(error) << "Time delta failed " <<
+ time_before_ret << " " << time_after_ret;
+ }
+
if (!uwd.running) {
worker.stop();
first_run = true;