From bcf39bd3ff478deae0dcc51f1021ceb8700c22cc Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sun, 14 Jan 2018 08:46:37 +0100 Subject: Fix timestamp handling --- src/output/SDR.cpp | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) (limited to 'src/output/SDR.cpp') diff --git a/src/output/SDR.cpp b/src/output/SDR.cpp index ed5da13..a2fb42a 100644 --- a/src/output/SDR.cpp +++ b/src/output/SDR.cpp @@ -260,10 +260,18 @@ void SDR::handle_frame(struct FrameData& frame) } double device_time = m_device->get_real_secs(); - bool timestamp_discontinuity = false; const auto& time_spec = frame.ts; - if (sourceContainsTimestamp) { + if (m_config.enableSync and m_config.muteNoTimestamps and + not time_spec.timestamp_valid) { + sleep_through_frame(); + etiLog.log(info, + "OutputSDR: Muting sample %d : no timestamp\n", + frame.ts.fct); + return; + } + + if (m_config.enableSync and time_spec.timestamp_valid) { // Tx time from MNSC and TIST const uint32_t tx_second = frame.ts.timestamp_sec; const uint32_t tx_pps = frame.ts.timestamp_pps; @@ -305,7 +313,7 @@ void SDR::handle_frame(struct FrameData& frame) tx_second << "+" << (double)tx_pps/16384000.0 << "(" << tx_pps << ")"; - timestamp_discontinuity = true; + frame.ts.timestamp_refresh = true; } } @@ -337,26 +345,14 @@ void SDR::handle_frame(struct FrameData& frame) throw std::runtime_error("Timestamp error. Aborted."); } } - else { // !sourceContainsTimestamp - if (m_config.muting or m_config.muteNoTimestamps) { - /* There was some error decoding the timestamp */ - if (m_config.muting) { - etiLog.log(info, - "OutputSDR: Muting sample %d requested\n", - frame.ts.fct); - } - else { - etiLog.log(info, - "OutputSDR: Muting sample %d : no timestamp\n", - frame.ts.fct); - } - return; - } - } - if (timestamp_discontinuity) { - frame.ts.timestamp_refresh = true; + if (m_config.muting) { + etiLog.log(info, + "OutputSDR: Muting sample %d requested\n", + frame.ts.fct); + return; } + m_device->transmit_frame(frame); } -- cgit v1.2.3