diff options
author | Kevin Mitchell <kevmitch@gmail.com> | 2016-03-16 23:41:30 -0700 |
---|---|---|
committer | Kevin Mitchell <kevmitch@gmail.com> | 2016-03-17 02:31:05 -0700 |
commit | 96053d53a75f69ff1662a0641e009f7cbad3cbc2 (patch) | |
tree | 34eb83b3aa4afc33c291da2d105cf551efecaa58 /audio | |
parent | a0884c82a91a3688bd0f448ad4502796782db7bb (diff) | |
download | mpv-96053d53a75f69ff1662a0641e009f7cbad3cbc2.tar.bz2 mpv-96053d53a75f69ff1662a0641e009f7cbad3cbc2.tar.xz |
ao_wasapi: use new af_select_best_samplerate function
It duplicates the logic that was previously used here.
Diffstat (limited to 'audio')
-rw-r--r-- | audio/out/ao_wasapi_utils.c | 14 |
1 files changed, 3 insertions, 11 deletions
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; } |