From 56a0a84466ca661179b534de52f728af450800a8 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 10 Apr 2015 11:00:48 +0200 Subject: Add check for FCT validity --- src/OutputUHD.cpp | 8 +++++++- src/TimestampDecoder.cpp | 4 ++-- src/TimestampDecoder.h | 11 ++++++----- 3 files changed, 15 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/OutputUHD.cpp b/src/OutputUHD.cpp index a877161..e8950a2 100644 --- a/src/OutputUHD.cpp +++ b/src/OutputUHD.cpp @@ -471,10 +471,16 @@ void UHDWorker::process() /* Verify that the FCT value is correct. If we miss one transmission * frame we must interrupt UHD and resync to the timestamps */ + if (frame->ts.fct == -1) { + uwd->logger->level(info) << + "OutputUHD: dropping one frame with invalid FCT"; + goto loopend; + } if (expected_next_fct != -1) { if (expected_next_fct != (int)frame->ts.fct) { uwd->logger->level(warn) << - "OutputUHD: Incorrect expect fct " << frame->ts.fct; + "OutputUHD: Incorrect expect fct " << frame->ts.fct << + ", expected " << expected_next_fct; fct_discontinuity = true; throw fct_discontinuity_error(); diff --git a/src/TimestampDecoder.cpp b/src/TimestampDecoder.cpp index 96c84c0..6063048 100644 --- a/src/TimestampDecoder.cpp +++ b/src/TimestampDecoder.cpp @@ -69,7 +69,7 @@ void TimestampDecoder::calculateTimestamp(struct frame_timestamp& ts) ts.timestamp_sec = 0; ts.timestamp_pps_offset = 0; ts.timestamp_refresh = false; - ts.fct = 0; + ts.fct = -1; } else { //fprintf(stderr, ". %zu ", queue_timestamps.size()); @@ -191,7 +191,7 @@ void TimestampDecoder::updateTimestampEti( int framephase, uint16_t mnsc, double pps, - uint32_t fct) + int32_t fct) { updateTimestampPPS(pps); pushMNSCData(framephase, mnsc); diff --git a/src/TimestampDecoder.h b/src/TimestampDecoder.h index 0c393e4..8c6b362 100644 --- a/src/TimestampDecoder.h +++ b/src/TimestampDecoder.h @@ -55,7 +55,7 @@ struct modulator_offset_config struct frame_timestamp { // Which frame count does this timestamp apply to - uint32_t fct; + int32_t fct; uint32_t timestamp_sec; double timestamp_pps_offset; @@ -101,9 +101,10 @@ struct frame_timestamp void print(const char* t) { fprintf(stderr, - "%s \n", + "%s \n", t, this->timestamp_valid ? "valid" : "invalid", - this->timestamp_sec, this->timestamp_pps_offset); + this->timestamp_sec, this->timestamp_pps_offset, + this->fct); } }; @@ -140,7 +141,7 @@ class TimestampDecoder int framephase, uint16_t mnsc, double pps, - uint32_t fct); + int32_t fct); /* Update the modulator timestamp offset according to the modconf */ @@ -167,7 +168,7 @@ class TimestampDecoder struct tm temp_time; uint32_t time_secs; - uint32_t latestFCT; + int32_t latestFCT; double time_pps; double timestamp_offset; int inhibit_second_update; -- cgit v1.2.3