From 42aaf8384b239f2e632a4ef042f24d4c9b7dac35 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 27 Jan 2017 16:36:49 +0100 Subject: Fix TIST usage for EDI input --- src/OutputUHD.cpp | 12 +++++++----- src/TimestampDecoder.cpp | 2 +- src/TimestampDecoder.h | 3 +++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/OutputUHD.cpp b/src/OutputUHD.cpp index e204b75..d26ce77 100644 --- a/src/OutputUHD.cpp +++ b/src/OutputUHD.cpp @@ -684,7 +684,7 @@ void UHDWorker::handle_frame(const struct UHDWorkerFrameData *frame) uint32_t expected_sec = last_tx_second + increment / 16384000ul; uint32_t expected_pps = last_tx_pps + increment % 16384000ul; - while (expected_pps > 16384000) { + while (expected_pps >= 16384000) { expected_sec++; expected_pps -= 16384000; } @@ -693,10 +693,12 @@ void UHDWorker::handle_frame(const struct UHDWorkerFrameData *frame) expected_pps != tx_pps) { etiLog.level(warn) << "OutputUHD: timestamp irregularity!" << std::fixed << - " Expected " << expected_sec << "+" << - (double)expected_pps/16384000.0 << - " Got " << tx_second << "+" << - (double)tx_pps/16384000.0; + " Expected " << + expected_sec << "+" << (double)expected_pps/16384000.0 << + "(" << expected_pps << ")" << + " Got " << + tx_second << "+" << (double)tx_pps/16384000.0 << + "(" << tx_pps << ")"; timestamp_discontinuity = true; } diff --git a/src/TimestampDecoder.cpp b/src/TimestampDecoder.cpp index eb3a848..e68bb4b 100644 --- a/src/TimestampDecoder.cpp +++ b/src/TimestampDecoder.cpp @@ -202,8 +202,8 @@ void TimestampDecoder::updateTimestampEdi( uint32_t pps, // In units of 1/16384000 s int32_t fct) { - updateTimestampPPS(pps); time_secs = seconds_utc; + time_pps = pps; latestFCT = fct; full_timestamp_received = true; } diff --git a/src/TimestampDecoder.h b/src/TimestampDecoder.h index f2299f2..903346e 100644 --- a/src/TimestampDecoder.h +++ b/src/TimestampDecoder.h @@ -170,6 +170,9 @@ class TimestampDecoder : public RemoteControllable * the timestamp. * * pps is in units of 1/16384000 s + * + * This function also takes care of updating the second when + * the pps rolls over. */ void updateTimestampPPS(uint32_t pps); -- cgit v1.2.3