diff options
author | Tom Yan <tom.ty89@gmail.com> | 2021-11-19 12:40:06 +0800 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2021-11-19 14:27:52 +0100 |
commit | d1e9f4a159a88d9a51197c31b0823b5875d0f97b (patch) | |
tree | 1bc9ba662acdbfa13292ae916a2f203b39a6181b | |
parent | 17df53519f6359881462da0251e85f99fefd884d (diff) | |
download | mpv-d1e9f4a159a88d9a51197c31b0823b5875d0f97b.tar.bz2 mpv-d1e9f4a159a88d9a51197c31b0823b5875d0f97b.tar.xz |
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.
-rw-r--r-- | audio/out/ao_opensles.c | 2 |
1 files changed, 2 insertions, 0 deletions
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)); |