0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 03:52:22 +02:00

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.
This commit is contained in:
Tom Yan 2021-11-19 12:40:06 +08:00 committed by sfan5
parent 17df53519f
commit d1e9f4a159

View File

@ -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));