From e26462599bc272f7e90c2c6e820d5d9ec1c801d6 Mon Sep 17 00:00:00 2001 From: Kevin Mitchell Date: Thu, 17 Mar 2016 00:58:07 -0700 Subject: ao_lavc: use new af_select_best_samplerate function This is particularly useful for opus which allows only a fairly restrictive set of samplerates. If the codec doesn't provide a list of samplerates, just continue to try the requsted one and hope for the best. fixes #2957 --- audio/out/ao_lavc.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'audio') diff --git a/audio/out/ao_lavc.c b/audio/out/ao_lavc.c index b671301922..bf1728682a 100644 --- a/audio/out/ao_lavc.c +++ b/audio/out/ao_lavc.c @@ -108,6 +108,11 @@ static int init(struct ao *ao) codec = encode_lavc_get_codec(ao->encode_lavc_ctx, ac->stream); + int samplerate = af_select_best_samplerate(ao->samplerate, + codec->supported_samplerates); + if (samplerate > 0) + ao->samplerate = samplerate; + // TODO: Remove this redundancy with encode_lavc_alloc_stream also // setting the time base. // Using codec->time_bvase is deprecated, but needed for older lavf. -- cgit v1.2.3