summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2018-03-27 19:38:01 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2018-03-27 19:38:01 +0200
commitacd65685a06f23e4aae8304e0d81de52b54a1827 (patch)
tree8cbe79fa3e055944fcc737010c551d4cf56627d0
parent054b21d369a6cdddd7d309e1aad2cf0fa883c277 (diff)
downloaddabmux-acd65685a06f23e4aae8304e0d81de52b54a1827.tar.gz
dabmux-acd65685a06f23e4aae8304e0d81de52b54a1827.tar.bz2
dabmux-acd65685a06f23e4aae8304e0d81de52b54a1827.zip
Fix segmentation fault
This bug occurs when the output is blocking, e.g. a pipe and the input has time to fill quicker than with a nonblocking output.
-rw-r--r--src/ManagementServer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/ManagementServer.cpp b/src/ManagementServer.cpp
index 16a21b1..5741e38 100644
--- a/src/ManagementServer.cpp
+++ b/src/ManagementServer.cpp
@@ -428,7 +428,7 @@ void InputStat::notifyPeakLevels(int peak_left, int peak_right)
// Calculate the peak over the short window
m_short_window_length = PEAK_STATS_SHORT_WINDOW / insertion_interval;
- const size_t short_window = std::max(
+ const size_t short_window = std::min(
m_peaks_left.size(), m_short_window_length);
const auto max_left = *max_element(m_peaks_left.begin(),
m_peaks_left.begin() + short_window);