diff options
author | Kevin Mitchell <kevmitch@gmail.com> | 2016-03-17 00:58:07 -0700 |
---|---|---|
committer | Kevin Mitchell <kevmitch@gmail.com> | 2016-03-17 02:31:05 -0700 |
commit | e26462599bc272f7e90c2c6e820d5d9ec1c801d6 (patch) | |
tree | ce7a4306831ece9d3d7539aba547142251cd2f08 /audio | |
parent | 96053d53a75f69ff1662a0641e009f7cbad3cbc2 (diff) |
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
Diffstat (limited to 'audio')
-rw-r--r-- | audio/out/ao_lavc.c | 5 |
1 files changed, 5 insertions, 0 deletions
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. |