ossaudio: reduce effective playback buffer size

Return the free buffer size for the mmapped case in function
oss_buffer_get_free() to reduce the effective playback buffer
size. All intermediate audio playback buffers become temporary
buffers.

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-Id: <20220301191311.26695-13-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
Volker Rümelin 2022-03-01 20:13:09 +01:00 committed by Gerd Hoffmann
parent c93a593372
commit 385211e8f9
1 changed files with 4 additions and 3 deletions

View File

@ -394,7 +394,7 @@ static size_t oss_buffer_get_free(HWVoiceOut *hw)
OSSVoiceOut *oss = (OSSVoiceOut *)hw; OSSVoiceOut *oss = (OSSVoiceOut *)hw;
if (oss->mmapped) { if (oss->mmapped) {
return INT_MAX; return oss_get_available_bytes(oss);
} else { } else {
return audio_generic_buffer_get_free(hw); return audio_generic_buffer_get_free(hw);
} }
@ -402,9 +402,10 @@ static size_t oss_buffer_get_free(HWVoiceOut *hw)
static void *oss_get_buffer_out(HWVoiceOut *hw, size_t *size) static void *oss_get_buffer_out(HWVoiceOut *hw, size_t *size)
{ {
OSSVoiceOut *oss = (OSSVoiceOut *) hw; OSSVoiceOut *oss = (OSSVoiceOut *)hw;
if (oss->mmapped) { if (oss->mmapped) {
*size = MIN(oss_get_available_bytes(oss), hw->size_emul - hw->pos_emul); *size = hw->size_emul - hw->pos_emul;
return hw->buf_emul + hw->pos_emul; return hw->buf_emul + hw->pos_emul;
} else { } else {
return audio_generic_get_buffer_out(hw, size); return audio_generic_get_buffer_out(hw, size);