From d1e9f4a159a88d9a51197c31b0823b5875d0f97b Mon Sep 17 00:00:00 2001 From: Tom Yan Date: Fri, 19 Nov 2021 12:40:06 +0800 Subject: ao_opensles: add guards for sample rate to use Upstream "Wilhelm" (the Android OpenSLES implementation) supports only 8000 <= rate <= 192000. Make sure mpv resamples the audio when necessary. --- audio/out/ao_opensles.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/audio/out/ao_opensles.c b/audio/out/ao_opensles.c index 40ab5324b5..1348cebffb 100644 --- a/audio/out/ao_opensles.c +++ b/audio/out/ao_opensles.c @@ -111,6 +111,8 @@ static int init(struct ao *ao) // This AO only supports two channels at the moment mp_chmap_from_channels(&ao->channels, 2); + // Upstream "Wilhelm" supports only 8000 <= rate <= 192000 + ao->samplerate = MPCLAMP(ao->samplerate, 8000, 192000); CHK(slCreateEngine(&p->sl, 0, NULL, 0, NULL, NULL)); CHK((*p->sl)->Realize(p->sl, SL_BOOLEAN_FALSE)); -- cgit v1.2.3