diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2022-10-14 22:10:30 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2022-10-14 22:10:30 +0200 |
commit | 56e046c3390a15aab4baddb502a490bb4505942a (patch) | |
tree | aa6b51bb531dc9ea0b5e2f4f6e34c0b52503349f | |
parent | 388d247d6799bc3ba9fda7b208a620d13db8f8ad (diff) | |
download | dabmod-56e046c3390a15aab4baddb502a490bb4505942a.tar.gz dabmod-56e046c3390a15aab4baddb502a490bb4505942a.tar.bz2 dabmod-56e046c3390a15aab4baddb502a490bb4505942a.zip |
Rework timestamp_refresh
Since we have the 'timestamp in the past' warning refresh requests can be lost
-rw-r--r-- | src/TimestampDecoder.cpp | 2 | ||||
-rw-r--r-- | src/TimestampDecoder.h | 4 | ||||
-rw-r--r-- | src/output/SDR.cpp | 8 | ||||
-rw-r--r-- | src/output/SDR.h | 2 | ||||
-rw-r--r-- | src/output/SDRDevice.h | 7 | ||||
-rw-r--r-- | src/output/Soapy.cpp | 2 | ||||
-rw-r--r-- | src/output/UHD.cpp | 2 |
7 files changed, 18 insertions, 9 deletions
diff --git a/src/TimestampDecoder.cpp b/src/TimestampDecoder.cpp index 3cfa0cc..2133125 100644 --- a/src/TimestampDecoder.cpp +++ b/src/TimestampDecoder.cpp @@ -85,7 +85,7 @@ std::shared_ptr<frame_timestamp> TimestampDecoder::getTimestamp() ts->fct = latestFCT; ts->fp = latestFP; - ts->timestamp_refresh = offset_changed; + ts->offset_changed = offset_changed; offset_changed = false; *ts += timestamp_offset; diff --git a/src/TimestampDecoder.h b/src/TimestampDecoder.h index d083061..dda8644 100644 --- a/src/TimestampDecoder.h +++ b/src/TimestampDecoder.h @@ -2,7 +2,7 @@ Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Her Majesty the Queen in Right of Canada (Communications Research Center Canada) - Copyright (C) 2018 + Copyright (C) 2022 Matthias P. Braendli, matthias.braendli@mpb.li http://opendigitalradio.org @@ -42,7 +42,7 @@ struct frame_timestamp uint32_t timestamp_sec; uint32_t timestamp_pps; // In units of 1/16384000 s bool timestamp_valid = false; - bool timestamp_refresh; + bool offset_changed = false; frame_timestamp& operator+=(const double& diff); diff --git a/src/output/SDR.cpp b/src/output/SDR.cpp index 6078fc7..b0c09b6 100644 --- a/src/output/SDR.cpp +++ b/src/output/SDR.cpp @@ -2,7 +2,7 @@ Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Her Majesty the Queen in Right of Canada (Communications Research Center Canada) - Copyright (C) 2018 + Copyright (C) 2022 Matthias P. Braendli, matthias.braendli@mpb.li http://opendigitalradio.org @@ -297,6 +297,10 @@ void SDR::handle_frame(struct FrameData& frame) return; } + if (frame.ts.offset_changed) { + m_device->require_timestamp_refresh(); + } + if (last_tx_time_initialised) { const size_t sizeIn = frame.buf.size() / sizeof(complexf); @@ -325,7 +329,7 @@ void SDR::handle_frame(struct FrameData& frame) tx_second << "+" << (double)tx_pps/16384000.0 << "(" << tx_pps << ")"; - frame.ts.timestamp_refresh = true; + m_device->require_timestamp_refresh(); } } diff --git a/src/output/SDR.h b/src/output/SDR.h index ee89243..33477bf 100644 --- a/src/output/SDR.h +++ b/src/output/SDR.h @@ -2,7 +2,7 @@ Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Her Majesty the Queen in Right of Canada (Communications Research Center Canada) - Copyright (C) 2018 + Copyright (C) 2022 Matthias P. Braendli, matthias.braendli@mpb.li http://opendigitalradio.org diff --git a/src/output/SDRDevice.h b/src/output/SDRDevice.h index bb63f60..b599f5a 100644 --- a/src/output/SDRDevice.h +++ b/src/output/SDRDevice.h @@ -2,7 +2,7 @@ Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Her Majesty the Queen in Right of Canada (Communications Research Center Canada) - Copyright (C) 2019 + Copyright (C) 2022 Matthias P. Braendli, matthias.braendli@mpb.li http://opendigitalradio.org @@ -142,6 +142,11 @@ class SDRDevice { virtual bool is_clk_source_ok(void) const = 0; virtual const char* device_name(void) const = 0; + + virtual void require_timestamp_refresh() { m_require_timestamp_refresh = true; } + + protected: + bool m_require_timestamp_refresh = false; }; } // namespace Output diff --git a/src/output/Soapy.cpp b/src/output/Soapy.cpp index f138e9a..684a9a4 100644 --- a/src/output/Soapy.cpp +++ b/src/output/Soapy.cpp @@ -311,7 +311,7 @@ void Soapy::transmit_frame(const struct FrameData& frame) const bool eob_because_muting = m_conf.muting; const bool end_of_burst = eob_because_muting or ( frame.ts.timestamp_valid and - frame.ts.timestamp_refresh and + m_require_timestamp_refresh and samps_to_send <= mtu ); int flags = 0; diff --git a/src/output/UHD.cpp b/src/output/UHD.cpp index 3cf5aef..ac34ce4 100644 --- a/src/output/UHD.cpp +++ b/src/output/UHD.cpp @@ -348,7 +348,7 @@ void UHD::transmit_frame(const struct FrameData& frame) // EOB and quit the loop afterwards, to avoid an underrun. md_tx.end_of_burst = eob_because_muting or ( frame.ts.timestamp_valid and - frame.ts.timestamp_refresh and + m_require_timestamp_refresh and samps_to_send <= usrp_max_num_samps ); //send a single packet |