summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Ross-Gowan <rossymiles@gmail.com>2015-01-21 14:11:31 +1100
committerJames Ross-Gowan <rossymiles@gmail.com>2015-01-23 22:02:15 +1100
commit3c10ed540b5ef1132d80074c4ccbd67fdfda6bae (patch)
tree3eb68fb1cdcd25637a2efcef5b4db634015e65e4
parent9c45cdd55e7faa8fecd28be6e1941102d98ae56d (diff)
downloadmpv-3c10ed540b5ef1132d80074c4ccbd67fdfda6bae.tar.bz2
mpv-3c10ed540b5ef1132d80074c4ccbd67fdfda6bae.tar.xz
ao_wasapi: fix try_format logic in shared mode
The MSDN documentation for IsFormatSupported says a return code of AUDCLNT_E_UNSUPPORTED_FORMAT means the function "succeeded but the specified format is not supported in exclusive mode." This seems to imply that the format is supported in shared mode, and that's what the old code assumed, however try_format would incorrectly return success with some drivers. The remarks section of the documentation contradicts that assumption. It says that in shared mode, if the audio engine does not support the caller-specified format or any similar format, ppClosestMatch is set to NULL and the function returns AUDCLNT_E_UNSUPPORTED_FORMAT. This is the same as in exclusive mode, so treat AUDCLNT_E_UNSUPPORTED_FORMAT the same regardless of opt_exclusive. In shared mode, the format selection code will fall back to the mix format, which should always be supported.
-rwxr-xr-xaudio/out/ao_wasapi_utils.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/audio/out/ao_wasapi_utils.c b/audio/out/ao_wasapi_utils.c
index 30f1f38ae8..08fdd14930 100755
--- a/audio/out/ao_wasapi_utils.c
+++ b/audio/out/ao_wasapi_utils.c
@@ -324,8 +324,7 @@ static bool try_format(struct ao *ao,
ao->channels.num, af_fmt_to_str(ao->format), ao->samplerate);
return true;
}
- } if (hr == S_OK || (!state->opt_exclusive && hr == AUDCLNT_E_UNSUPPORTED_FORMAT)) {
- // AUDCLNT_E_UNSUPPORTED_FORMAT here means "works in shared, doesn't in exclusive"
+ } else if (hr == S_OK) {
if (set_ao_format(ao, &wformat.Format)) {
MP_VERBOSE(ao, "%dch %s @ %dhz accepted\n",
ao->channels.num, af_fmt_to_str(ao->format), samplerate);