aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2022-11-22 16:52:10 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2022-11-22 16:52:10 +0100
commit8e821c7f8ef72415d84e3f78270c1ae1a85a5304 (patch)
treef2763ff2e5d8ebf8f5b994a1af3b303215b442d4
parentcf1ce1f08c0e49a0c6c818135971b201026258c2 (diff)
downloaddabmux-8e821c7f8ef72415d84e3f78270c1ae1a85a5304.tar.gz
dabmux-8e821c7f8ef72415d84e3f78270c1ae1a85a5304.tar.bz2
dabmux-8e821c7f8ef72415d84e3f78270c1ae1a85a5304.zip
EDI: do not fill logs with size mismatch entries
-rw-r--r--src/input/Edi.cpp17
-rw-r--r--src/input/Edi.h3
2 files changed, 16 insertions, 4 deletions
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.
*