summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Ross-Gowan <rossymiles@gmail.com>2015-01-21 14:11:31 +1100
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>2015-01-25 17:00:21 +0900
commit6f9eb960c7a83422dd17079b3d3b3171546006c5 (patch)
tree6cb73c3213652d62ffceaa709381467aa2827501
parenta4b21b5a13a3caa883003a3c9f798e0b0eb8d9bd (diff)
downloadmpv-6f9eb960c7a83422dd17079b3d3b3171546006c5.tar.bz2
mpv-6f9eb960c7a83422dd17079b3d3b3171546006c5.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);