From 8e821c7f8ef72415d84e3f78270c1ae1a85a5304 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Tue, 22 Nov 2022 16:52:10 +0100 Subject: EDI: do not fill logs with size mismatch entries --- src/input/Edi.cpp | 17 +++++++++++++---- src/input/Edi.h | 3 +++ 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'src/input') diff --git a/src/input/Edi.cpp b/src/input/Edi.cpp index ebeca77..692ecb3 100644 --- a/src/input/Edi.cpp +++ b/src/input/Edi.cpp @@ -140,8 +140,11 @@ size_t Edi::readFrame(uint8_t *buffer, size_t size) else if (not m_pending_sti_frame.frame.empty()) { // Can only happen when switching from timestamp-based buffer management! if (m_pending_sti_frame.frame.size() != size) { - etiLog.level(debug) << "EDI input " << m_name << " size mismatch: " << - m_pending_sti_frame.frame.size() << " received, " << size << " requested"; + if (not m_size_mismatch_printed) { + etiLog.level(debug) << "EDI input " << m_name << " size mismatch: " << + m_pending_sti_frame.frame.size() << " received, " << size << " requested"; + m_size_mismatch_printed = true; + } memset(buffer, 0, size * sizeof(*buffer)); m_stats.notifyUnderrun(); return 0; @@ -158,6 +161,7 @@ size_t Edi::readFrame(uint8_t *buffer, size_t size) m_pending_sti_frame.frame.end(), buffer); m_pending_sti_frame.frame.clear(); + m_size_mismatch_printed = false; return size; } } @@ -192,11 +196,15 @@ size_t Edi::readFrame(uint8_t *buffer, size_t size) m_stats.notifyPeakLevels(sti.audio_levels.left, sti.audio_levels.right); copy(sti.frame.cbegin(), sti.frame.cend(), buffer); + m_size_mismatch_printed = false; return size; } else { - etiLog.level(debug) << "EDI input " << m_name << " size mismatch: " << - sti.frame.size() << " received, " << size << " requested"; + if (not m_size_mismatch_printed) { + etiLog.level(debug) << "EDI input " << m_name << " size mismatch: " << + sti.frame.size() << " received, " << size << " requested"; + m_size_mismatch_printed = true; + } memset(buffer, 0, size * sizeof(*buffer)); m_stats.notifyUnderrun(); return 0; @@ -206,6 +214,7 @@ size_t Edi::readFrame(uint8_t *buffer, size_t size) memset(buffer, 0, size * sizeof(*buffer)); m_is_prebuffering = true; etiLog.level(info) << "EDI input " << m_name << " re-enabling pre-buffering"; + m_size_mismatch_printed = false; m_stats.notifyUnderrun(); return 0; } diff --git a/src/input/Edi.h b/src/input/Edi.h index ca465bd..cf4c576 100644 --- a/src/input/Edi.h +++ b/src/input/Edi.h @@ -105,6 +105,9 @@ class Edi : public InputBase, public RemoteControllable { // State variable used in prebuffering-based buffer management bool m_is_prebuffering = true; + // Display the 'size mismatch' warning only once + bool m_size_mismatch_printed = false; + /* When using prebuffering, consider the buffer to be full on the * receive side if it's above the overrun threshold. * -- cgit v1.2.3