summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-11-30 17:44:59 +0100
committerwm4 <wm4@nowhere>2016-11-30 17:56:33 +0100
commitec74a79e1240eeda7b0bb195b484420052ea0ad8 (patch)
tree6956d1c2b864dc5068566c4b59f99053fce1f3b5 /audio
parent20f02229cd4263b350897bed1d4d2b18b6a51a25 (diff)
downloadmpv-ec74a79e1240eeda7b0bb195b484420052ea0ad8.tar.bz2
mpv-ec74a79e1240eeda7b0bb195b484420052ea0ad8.tar.xz
ao_wasapi: log return code when probing audio formats
We log a large number of formats, but we rarely log the result of the probing. Change this. The logic in try_format_exclusive() changes slightly, but should be equivalent. EXIT_ON_ERROR() checks for FAILED(), which should be exclusive to SUCCEEDED().
Diffstat (limited to 'audio')
-rw-r--r--audio/out/ao_wasapi.h4
-rw-r--r--audio/out/ao_wasapi_utils.c18
2 files changed, 9 insertions, 13 deletions
diff --git a/audio/out/ao_wasapi.h b/audio/out/ao_wasapi.h
index ea9f5c2bad..65f16d11c1 100644
--- a/audio/out/ao_wasapi.h
+++ b/audio/out/ao_wasapi.h
@@ -50,6 +50,10 @@ void wasapi_change_uninit(struct ao* ao);
#define SAFE_RELEASE(unk, release) \
do { if ((unk) != NULL) { release; (unk) = NULL; } } while(0)
+#define mp_format_res_str(hres) \
+ (SUCCEEDED(hres) ? "ok" : ((hres) == AUDCLNT_E_UNSUPPORTED_FORMAT) \
+ ? "unsupported" : mp_HRESULT_to_str(hres))
+
enum wasapi_thread_state {
WASAPI_THREAD_FEED = 0,
WASAPI_THREAD_RESUME,
diff --git a/audio/out/ao_wasapi_utils.c b/audio/out/ao_wasapi_utils.c
index ce3f5da887..4667b57ae8 100644
--- a/audio/out/ao_wasapi_utils.c
+++ b/audio/out/ao_wasapi_utils.c
@@ -289,18 +289,12 @@ static bool set_ao_format(struct ao *ao, WAVEFORMATEX *wf,
static bool try_format_exclusive(struct ao *ao, WAVEFORMATEXTENSIBLE *wformat)
{
struct wasapi_state *state = ao->priv;
- MP_VERBOSE(ao, "Trying %s (exclusive)\n",
- waveformat_to_str(&wformat->Format));
HRESULT hr = IAudioClient_IsFormatSupported(state->pAudioClient,
AUDCLNT_SHAREMODE_EXCLUSIVE,
&wformat->Format, NULL);
- if (hr != AUDCLNT_E_UNSUPPORTED_FORMAT)
- EXIT_ON_ERROR(hr);
-
+ MP_VERBOSE(ao, "Trying %s (exclusive) -> %s\n",
+ waveformat_to_str(&wformat->Format), mp_format_res_str(hr));
return SUCCEEDED(hr);
-exit_label:
- MP_ERR(state, "Error testing exclusive format: %s\n", mp_HRESULT_to_str(hr));
- return false;
}
// This works like try_format_exclusive(), but will try to fallback to the AC3
@@ -393,11 +387,8 @@ static bool search_channels(struct ao *ao, WAVEFORMATEXTENSIBLE *wformat)
for (int j = 0; channel_layouts[j]; j++) {
mp_chmap_from_str(&entry, bstr0(channel_layouts[j]));
if (!wformat->Format.nSamplesPerSec) {
- if (search_samplerates(ao, wformat, &entry)) {
+ if (search_samplerates(ao, wformat, &entry))
mp_chmap_sel_add_map(&chmap_sel, &entry);
- MP_VERBOSE(ao, "%s is supported\n",
- waveformat_to_str(&wformat->Format));
- }
} else {
change_waveformat_channels(wformat, &entry);
if (try_format_exclusive(ao, wformat))
@@ -442,11 +433,12 @@ static bool find_formats_shared(struct ao *ao)
WAVEFORMATEXTENSIBLE wformat;
set_waveformat_with_ao(&wformat, ao);
- MP_VERBOSE(ao, "Trying %s (shared)\n", waveformat_to_str(&wformat.Format));
WAVEFORMATEX *closestMatch;
HRESULT hr = IAudioClient_IsFormatSupported(state->pAudioClient,
AUDCLNT_SHAREMODE_SHARED,
&wformat.Format, &closestMatch);
+ MP_VERBOSE(ao, "Trying %s (shared) -> %s\n",
+ waveformat_to_str(&wformat.Format), mp_format_res_str(hr));
if (hr != AUDCLNT_E_UNSUPPORTED_FORMAT)
EXIT_ON_ERROR(hr);