summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd
diff options
context:
space:
mode:
author hap <happppp@users.noreply.github.com>2026-03-11 09:17:40 +0100
committer hap <happppp@users.noreply.github.com>2026-03-11 09:17:58 +0100
commit88cbf8df14255459470125a480c150d6ced1a105 (patch)
treeb4ae930b46ec34781406a03c0bd74783daa29c58 /src/osd
parentb117011a7bdead5af0ac3b8a117f1af9c66d75b0 (diff)
sound abuffer: it was still getting a buffer underrun sometimes after overflow when reduced to 1
Diffstat (limited to 'src/osd')
-rw-r--r--src/osd/modules/sound/sound_module.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/osd/modules/sound/sound_module.cpp b/src/osd/modules/sound/sound_module.cpp
index d8ba6362aa2..c2c0ee718cf 100644
--- a/src/osd/modules/sound/sound_module.cpp
+++ b/src/osd/modules/sound/sound_module.cpp
@@ -96,14 +96,13 @@ void sound_module::abuffer::push(const int16_t *data, uint32_t samples)
};
if(m_overflow && std::accumulate(m_history.begin(), m_history.end(), 0) >= -2) {
- if(m_used_buffers > 1) {
- // Once it's stabilized after an overflow, reduce latency to the minimum
- reduce_buffers(1);
+ if(m_used_buffers > 2) {
+ // Once it's stabilized after an overflow, reduce buffers to 2
+ reduce_buffers(2);
std::fill(m_history.begin(), m_history.end(), 0);
}
m_overflow = false;
- }
- else if(m_used_buffers > 8) {
+ } else if(m_used_buffers > 8) {
// If there are way too many buffers, drop some so only 8 are left (roughly 0.16s)
reduce_buffers(8);
m_overflow = true;