From 06392e7ec12c35961a3e09115ec881d2a19407ad Mon Sep 17 00:00:00 2001 From: Aman Karmani Date: Tue, 19 Oct 2021 14:39:48 -0700 Subject: ao_audiotrack: change buffer sizing logic Previously number of channels was being ignored. The buffer will now be between 75ms and 150ms Signed-off-by: Aman Karmani --- audio/out/ao_audiotrack.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'audio') diff --git a/audio/out/ao_audiotrack.c b/audio/out/ao_audiotrack.c index 3ddd559ffe..fbbdaa1c7a 100644 --- a/audio/out/ao_audiotrack.c +++ b/audio/out/ao_audiotrack.c @@ -721,8 +721,8 @@ static int init(struct ao *ao) return -1; } - int min = 0.200 * p->samplerate * af_fmt_to_bytes(ao->format); - int max = min * 3 / 2; + int min = 0.075 * p->samplerate * af_fmt_to_bytes(ao->format) * ao->channels.num; + int max = min * 2; p->size = MPCLAMP(buffer_size * 2, min, max); MP_VERBOSE(ao, "Setting bufferSize = %d (driver=%d, min=%d, max=%d)\n", p->size, buffer_size, min, max); ao->device_buffer = p->size / af_fmt_to_bytes(ao->format); -- cgit v1.2.3