summaryrefslogtreecommitdiffstats
path: root/audio/ossaudio.c
diff options
context:
space:
mode:
authorVolker RĂ¼melin2022-03-01 20:13:06 +0100
committerGerd Hoffmann2022-03-04 11:05:13 +0100
commit9833438ef624155de879d4ed57ecfcd3464a0bbe (patch)
tree2774d4652e970f5ff9fb2d5caa96204882d5765a /audio/ossaudio.c
parentRevert "audio: fix wavcapture segfault" (diff)
downloadqemu-9833438ef624155de879d4ed57ecfcd3464a0bbe.tar.gz
qemu-9833438ef624155de879d4ed57ecfcd3464a0bbe.tar.xz
qemu-9833438ef624155de879d4ed57ecfcd3464a0bbe.zip
audio: restore mixing-engine playback buffer size
Commit ff095e5231 "audio: api for mixeng code free backends" introduced another FIFO for the audio subsystem with exactly the same size as the mixing-engine FIFO. Most audio backends use this generic FIFO. The generic FIFO used together with the mixing-engine FIFO doubles the audio FIFO size, because that's just two independent FIFOs connected together in series. For audio playback this nearly doubles the playback latency. This patch restores the effective mixing-engine playback buffer size to a pre v4.2.0 size by only accepting the amount of samples for the mixing-engine queue which the downstream queue accepts. Signed-off-by: Volker RĂ¼melin <vr_qemu@t-online.de> Reviewed-by: Akihiko Odaki <akihiko.odaki@gmail.com> Message-Id: <20220301191311.26695-10-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'audio/ossaudio.c')
-rw-r--r--audio/ossaudio.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/audio/ossaudio.c b/audio/ossaudio.c
index 60eff66424..1bd6800840 100644
--- a/audio/ossaudio.c
+++ b/audio/ossaudio.c
@@ -389,6 +389,17 @@ static void oss_run_buffer_out(HWVoiceOut *hw)
}
}
+static size_t oss_buffer_get_free(HWVoiceOut *hw)
+{
+ OSSVoiceOut *oss = (OSSVoiceOut *)hw;
+
+ if (oss->mmapped) {
+ return INT_MAX;
+ } else {
+ return audio_generic_buffer_get_free(hw);
+ }
+}
+
static void *oss_get_buffer_out(HWVoiceOut *hw, size_t *size)
{
OSSVoiceOut *oss = (OSSVoiceOut *) hw;
@@ -750,6 +761,7 @@ static struct audio_pcm_ops oss_pcm_ops = {
.init_out = oss_init_out,
.fini_out = oss_fini_out,
.write = oss_write,
+ .buffer_get_free = oss_buffer_get_free,
.run_buffer_out = oss_run_buffer_out,
.get_buffer_out = oss_get_buffer_out,
.put_buffer_out = oss_put_buffer_out,