From b7845bd702af01926e8ee41dcb794ede7112aaea Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 28 Apr 2022 13:04:39 +0200 Subject: [PATCH] alsa: scale buffer with frame_scale Make the alsa buffer a little larger when we scaled the samplerate, like for DSD. This allows us to go all the way up to the quantum limit. --- spa/plugins/alsa/alsa-pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c index 2a12430e5..9bd8fc136 100644 --- a/spa/plugins/alsa/alsa-pcm.c +++ b/spa/plugins/alsa/alsa-pcm.c @@ -1483,7 +1483,7 @@ int spa_alsa_set_format(struct state *state, struct spa_audio_info *fmt, uint32_ } else { CHECK(snd_pcm_hw_params_get_buffer_size_max(params, &state->buffer_frames), "get_buffer_size_max"); - state->buffer_frames = SPA_MIN(state->buffer_frames, state->quantum_limit * 4); + state->buffer_frames = SPA_MIN(state->buffer_frames, state->quantum_limit * 4)* state->frame_scale; CHECK(snd_pcm_hw_params_set_buffer_size_min(hndl, params, &state->buffer_frames), "set_buffer_size_min"); CHECK(snd_pcm_hw_params_set_buffer_size_near(hndl, params, &state->buffer_frames), "set_buffer_size_near");