aboutsummaryrefslogtreecommitdiff
path: root/audio/spiceaudio.c
diff options
context:
space:
mode:
authorVolker RĂ¼melin <vr_qemu@t-online.de>2020-09-20 19:17:23 +0200
committerGerd Hoffmann <kraxel@redhat.com>2020-09-23 08:19:42 +0200
commitaec6d0dc4ef243b957115b3c3aef39c348fefb25 (patch)
treea573fd566d75bdf455da826a6ec6b872899406cd /audio/spiceaudio.c
parent4c3356f96557e848f0323772f9502d60817682dc (diff)
audio/spiceaudio: always rate limit playback stream
The playback rate with the spiceaudio backend is currently too fast if there's no spice client connected or the spice client can't play audio. Rate limit the audio playback stream in all cases. To calculate the rate correctly the limiter has to know the maximum buffer size. Fixes: 8c198ff065 ("spiceaudio: port to the new audio backend api") Signed-off-by: Volker RĂ¼melin <vr_qemu@t-online.de> Message-id: 20200920171729.15861-3-vr_qemu@t-online.de Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'audio/spiceaudio.c')
-rw-r--r--audio/spiceaudio.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c
index c8d81ba442..c062742622 100644
--- a/audio/spiceaudio.c
+++ b/audio/spiceaudio.c
@@ -130,13 +130,11 @@ static void *line_out_get_buffer(HWVoiceOut *hw, size_t *size)
}
if (out->frame) {
- *size = audio_rate_get_bytes(
- &hw->info, &out->rate,
- (out->fsize - out->fpos) * hw->info.bytes_per_frame);
- } else {
- audio_rate_start(&out->rate);
- *size = LINE_OUT_SAMPLES << 2;
+ *size = MIN((out->fsize - out->fpos) << 2, *size);
}
+
+ *size = audio_rate_get_bytes(&hw->info, &out->rate, *size);
+
return out->frame + out->fpos;
}