From ed03106ec4ad126509af35686fe79c9b2574b035 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Wed, 12 Aug 2020 11:24:32 +0200 Subject: EDI input: fix timestamps ignored when switching from prebuffering to timestamped --- src/input/Edi.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/input/Edi.cpp b/src/input/Edi.cpp index 449c221..a5e6525 100644 --- a/src/input/Edi.cpp +++ b/src/input/Edi.cpp @@ -297,16 +297,7 @@ size_t Edi::readFrame(uint8_t *buffer, size_t size, std::time_t seconds, int utc ts_req += m_tist_delay; const double offset = m_pending_sti_frame.timestamp.diff_s(ts_req); - if (offset > 24e-3) { - m_stats.notifyUnderrun(); - m_is_prebuffering = true; - m_pending_sti_frame.frame.clear(); - etiLog.level(warn) << "EDI input " << m_name << - " timestamp out of bounds, re-enabling pre-buffering"; - memset(buffer, 0, size); - return 0; - } - else { + if (-24e-3 < offset and offset <= 0) { if (not m_pending_sti_frame.version_data.version.empty()) { m_stats.notifyVersion( m_pending_sti_frame.version_data.version, @@ -319,6 +310,15 @@ size_t Edi::readFrame(uint8_t *buffer, size_t size, std::time_t seconds, int utc m_pending_sti_frame.frame.clear(); return size; } + else { + m_stats.notifyUnderrun(); + m_is_prebuffering = true; + m_pending_sti_frame.frame.clear(); + etiLog.level(warn) << "EDI input " << m_name << + " timestamp out of bounds, re-enabling pre-buffering"; + memset(buffer, 0, size); + return 0; + } } } } -- cgit v1.2.3