From 3990ad27e33f974c0a577e5a5556e113bd60f5bd Mon Sep 17 00:00:00 2001 From: "Bram (morningbird)" Date: Wed, 1 Aug 2012 15:34:29 +0200 Subject: dabmod: pipeline delay corrections --- src/DabMod.cpp | 4 +++- src/TimestampDecoder.cpp | 11 +++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/DabMod.cpp b/src/DabMod.cpp index 6627ed1..dc14d7a 100644 --- a/src/DabMod.cpp +++ b/src/DabMod.cpp @@ -280,7 +280,9 @@ int main(int argc, char* argv[]) // When using the FIRFilter, increase the modulator offset pipelining delay // by the correct amount - modconf.delay_calculation_pipeline_stages += FIRFILTER_PIPELINE_DELAY; + if (filterTapsFilename != NULL) { + modconf.delay_calculation_pipeline_stages += FIRFILTER_PIPELINE_DELAY; + } // Setting ETI input filename 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(); -- cgit v1.2.3