diff options
author | Martin Herkt <lachs0r@srsfckn.biz> | 2016-04-11 17:42:55 +0200 |
---|---|---|
committer | Martin Herkt <lachs0r@srsfckn.biz> | 2016-04-11 17:42:55 +0200 |
commit | 0803f4ad21c195519209bae8d18840dd810191f8 (patch) | |
tree | f9a869011ba90c106cf5c05c3e346912a669f63a /audio/out | |
parent | 9d2980dab752280468620df49cabe7f4843f0551 (diff) | |
parent | b968d779afb9114694976792e903b0591a71a816 (diff) | |
download | mpv-0803f4ad21c195519209bae8d18840dd810191f8.tar.bz2 mpv-0803f4ad21c195519209bae8d18840dd810191f8.tar.xz |
Merge branch 'master' into release/current
Diffstat (limited to 'audio/out')
-rw-r--r-- | audio/out/ao_coreaudio_exclusive.c | 2 | ||||
-rw-r--r-- | audio/out/ao_lavc.c | 5 | ||||
-rw-r--r-- | audio/out/ao_wasapi_utils.c | 14 |
3 files changed, 9 insertions, 12 deletions
diff --git a/audio/out/ao_coreaudio_exclusive.c b/audio/out/ao_coreaudio_exclusive.c index af07fe0f3e..510fa3a529 100644 --- a/audio/out/ao_coreaudio_exclusive.c +++ b/audio/out/ao_coreaudio_exclusive.c @@ -367,7 +367,7 @@ static void uninit(struct ao *ao) CHECK_CA_WARN("failed to remove device render callback"); if (!ca_change_physical_format_sync(ao, p->stream, p->original_asbd)) - MP_WARN(ao, "can't revert to original device format"); + MP_WARN(ao, "can't revert to original device format\n"); err = ca_enable_mixing(ao, p->device, p->changed_mixing); CHECK_CA_WARN("can't re-enable mixing"); 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. diff --git a/audio/out/ao_wasapi_utils.c b/audio/out/ao_wasapi_utils.c index 8d0ea30bd7..0e7dec885a 100644 --- a/audio/out/ao_wasapi_utils.c +++ b/audio/out/ao_wasapi_utils.c @@ -364,17 +364,9 @@ static bool search_samplerates(struct ao *ao, WAVEFORMATEXTENSIBLE *wformat, } } - for (int i = 0; supported[i]; i++) { - // first choose the lowest integer multiple of the sample rate - if (!(supported[i] % ao->samplerate)) { - change_waveformat_samplerate(wformat, supported[i]); - return true; - } - } - - // then choose the highest supported (if any) - if (n) { - change_waveformat_samplerate(wformat, supported[n-1]); + int samplerate = af_select_best_samplerate(ao->samplerate, supported); + if (samplerate > 0) { + change_waveformat_samplerate(wformat, samplerate); return true; } |