summaryrefslogtreecommitdiffstats
path: root/src/output/SDR.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2018-01-14 08:46:37 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2018-01-14 08:46:37 +0100
commitbcf39bd3ff478deae0dcc51f1021ceb8700c22cc (patch)
treebe97bd84040ec6549d1cb278ed6a1d0826f17eaf /src/output/SDR.cpp
parentb3d71cdcdad02fb17f7d6e484a3e043def426782 (diff)
downloaddabmod-bcf39bd3ff478deae0dcc51f1021ceb8700c22cc.tar.gz
dabmod-bcf39bd3ff478deae0dcc51f1021ceb8700c22cc.tar.bz2
dabmod-bcf39bd3ff478deae0dcc51f1021ceb8700c22cc.zip
Fix timestamp handling
Diffstat (limited to 'src/output/SDR.cpp')
-rw-r--r--src/output/SDR.cpp38
1 files changed, 17 insertions, 21 deletions
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);
}