summaryrefslogtreecommitdiffstats
path: root/src/TimestampDecoder.cpp
diff options
context:
space:
mode:
authorBram (morningbird) <bram@morningbird>2012-08-01 15:34:29 +0200
committerBram (morningbird) <bram@morningbird>2012-08-01 15:34:29 +0200
commit3990ad27e33f974c0a577e5a5556e113bd60f5bd (patch)
tree8785d0773cfeb06537809c76a95900b465bda672 /src/TimestampDecoder.cpp
parent06268c30c784051dfa5d651cb9195298094113b1 (diff)
downloaddabmod-3990ad27e33f974c0a577e5a5556e113bd60f5bd.tar.gz
dabmod-3990ad27e33f974c0a577e5a5556e113bd60f5bd.tar.bz2
dabmod-3990ad27e33f974c0a577e5a5556e113bd60f5bd.zip
dabmod: pipeline delay correctionsr1
Diffstat (limited to 'src/TimestampDecoder.cpp')
-rw-r--r--src/TimestampDecoder.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/TimestampDecoder.cpp b/src/TimestampDecoder.cpp
index d3bf578..eb70a56 100644
--- a/src/TimestampDecoder.cpp
+++ b/src/TimestampDecoder.cpp
@@ -52,14 +52,21 @@ void TimestampDecoder::calculateTimestamp(struct frame_timestamp& ts)
queue_timestamps.push(ts_queued);
- if (queue_timestamps.size() < modconfig.delay_calculation_pipeline_stages) {
- /* Return invalid timestamp */
+ /* Here, the queue size is one more than the pipeline delay, because
+ * we've just added a new element in the queue.
+ *
+ * Therefore, use <= and not < for comparison
+ */
+ if (queue_timestamps.size() <= modconfig.delay_calculation_pipeline_stages) {
+ //fprintf(stderr, "* %zu %u ", queue_timestamps.size(), modconfig.delay_calculation_pipeline_stages);
+ /* Return invalid timestamp until the queue is full */
ts.timestamp_valid = false;
ts.timestamp_sec = 0;
ts.timestamp_pps_offset = 0;
ts.timestamp_refresh = false;
}
else {
+ //fprintf(stderr, ". %zu ", queue_timestamps.size());
/* Return timestamp from queue */
ts_queued = queue_timestamps.front();
queue_timestamps.pop();