mirror of https://github.com/mpv-player/mpv
ao/wasapi: more debugging messages
This commit is contained in:
parent
ecb491fd95
commit
d0c37f0731
|
@ -142,6 +142,7 @@ static DWORD __stdcall ThreadLoop(void *lpParameter)
|
|||
QS_POSTMESSAGE | QS_SENDMESSAGE);
|
||||
switch (waitstatus) {
|
||||
case WAIT_OBJECT_0: /*shutdown*/
|
||||
MP_DBG(ao, "Thread shutdown\n");
|
||||
thread_ret = 0;
|
||||
goto exit_label;
|
||||
case (WAIT_OBJECT_0 + 1): /* feed */
|
||||
|
@ -152,6 +153,7 @@ static DWORD __stdcall ThreadLoop(void *lpParameter)
|
|||
SetEvent(state->hFeedDone);
|
||||
break;
|
||||
case (WAIT_OBJECT_0 + 3): /* messages to dispatch (COM marshalling) */
|
||||
MP_DBG(ao, "Dispatch\n");
|
||||
wasapi_dispatch();
|
||||
break;
|
||||
default:
|
||||
|
@ -164,6 +166,7 @@ exit_label:
|
|||
wasapi_thread_uninit(ao);
|
||||
|
||||
CoUninitialize();
|
||||
MP_DBG(ao, "Thread return %u\n", (unsigned)thread_ret);
|
||||
return thread_ret;
|
||||
}
|
||||
|
||||
|
@ -186,7 +189,7 @@ static void uninit(struct ao *ao)
|
|||
SetEvent(state->hUninit);
|
||||
/* wait up to 10 seconds */
|
||||
if (WaitForSingleObject(state->threadLoop, 10000) == WAIT_TIMEOUT){
|
||||
MP_ERR(ao, "Audio loop thread refuses to abort");
|
||||
MP_ERR(ao, "Audio loop thread refuses to abort\n");
|
||||
return;
|
||||
}
|
||||
if (state->VistaBlob.hAvrt)
|
||||
|
@ -201,8 +204,10 @@ static int init(struct ao *ao)
|
|||
ao->format = af_fmt_from_planar(ao->format);
|
||||
struct mp_chmap_sel sel = {0};
|
||||
mp_chmap_sel_add_waveext(&sel);
|
||||
if (!ao_chmap_sel_adjust(ao, &sel, &ao->channels))
|
||||
if (!ao_chmap_sel_adjust(ao, &sel, &ao->channels)) {
|
||||
MP_ERR(ao, "Error adjusting channel map to waveext channel order\n");
|
||||
return -1;
|
||||
}
|
||||
struct wasapi_state *state = (struct wasapi_state *)ao->priv;
|
||||
state->log = ao->log;
|
||||
wasapi_fill_VistaBlob(state);
|
||||
|
|
|
@ -85,7 +85,10 @@ const char *wasapi_explain_err(const HRESULT hr)
|
|||
E(E_FAIL)
|
||||
E(E_OUTOFMEMORY)
|
||||
E(E_POINTER)
|
||||
E(E_HANDLE)
|
||||
E(E_NOTIMPL)
|
||||
E(E_INVALIDARG)
|
||||
E(REGDB_E_IIDNOTREG)
|
||||
E(AUDCLNT_E_NOT_INITIALIZED)
|
||||
E(AUDCLNT_E_ALREADY_INITIALIZED)
|
||||
E(AUDCLNT_E_WRONG_ENDPOINT_TYPE)
|
||||
|
@ -242,7 +245,6 @@ static int try_mix_format(struct wasapi_state *state,
|
|||
{
|
||||
WAVEFORMATEX *deviceFormat = NULL;
|
||||
WAVEFORMATEX *closestMatch = NULL;
|
||||
int ret = 0;
|
||||
|
||||
HRESULT hr = IAudioClient_GetMixFormat(state->pAudioClient, &deviceFormat);
|
||||
EXIT_ON_ERROR(hr);
|
||||
|
@ -251,15 +253,20 @@ static int try_mix_format(struct wasapi_state *state,
|
|||
u.ex = deviceFormat;
|
||||
WAVEFORMATEXTENSIBLE wformat = *u.extensible;
|
||||
|
||||
ret = try_format(state, ao, wformat.Format.wBitsPerSample,
|
||||
int ret = try_format(ao, wformat.Format.wBitsPerSample,
|
||||
wformat.Format.nSamplesPerSec, ao->channels);
|
||||
if (ret)
|
||||
state->format = wformat;
|
||||
|
||||
exit_label:
|
||||
SAFE_RELEASE(deviceFormat, CoTaskMemFree(deviceFormat));
|
||||
SAFE_RELEASE(closestMatch, CoTaskMemFree(closestMatch));
|
||||
return ret;
|
||||
exit_label:
|
||||
MP_ERR(state, "Error getting mix format: %s (0x%"PRIx32")\n",
|
||||
wasapi_explain_err(hr), (uint32_t)hr);
|
||||
SAFE_RELEASE(deviceFormat, CoTaskMemFree(deviceFormat));
|
||||
SAFE_RELEASE(closestMatch, CoTaskMemFree(closestMatch));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int try_passthrough(struct wasapi_state *state,
|
||||
|
@ -447,10 +454,9 @@ static HRESULT init_session_display(struct wasapi_state *state) {
|
|||
|
||||
return S_OK;
|
||||
exit_label:
|
||||
MP_ERR(state, "Error setting audio session display name: %s (0x%"PRIx32")\n",
|
||||
wasapi_explain_err(hr), (uint32_t)hr);
|
||||
// No reason to abort initialization.
|
||||
return S_OK;
|
||||
MP_WARN(state, "Error setting audio session display name: %s (0x%"PRIx32")\n",
|
||||
wasapi_explain_err(hr), (uint32_t)hr);
|
||||
return S_OK; // No reason to abort initialization.
|
||||
}
|
||||
|
||||
static HRESULT fix_format(struct ao *ao)
|
||||
|
@ -913,11 +919,10 @@ HRESULT wasapi_setup_proxies(struct wasapi_state *state) {
|
|||
|
||||
#undef UNMARSHAL
|
||||
|
||||
return S_OK;
|
||||
exit_label:
|
||||
if (hr != S_OK) {
|
||||
MP_ERR(state, "Error reading COM proxy: %s (0x%"PRIx32")\n",
|
||||
wasapi_explain_err(hr), (uint32_t)hr);
|
||||
}
|
||||
MP_ERR(state, "Error reading COM proxy: %s (0x%"PRIx32")\n",
|
||||
wasapi_explain_err(hr), (uint32_t)hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
@ -947,7 +952,10 @@ static HRESULT create_proxies(struct wasapi_state *state) {
|
|||
MARSHAL(IID_IAudioEndpointVolume, state->sEndpointVolume, state->pEndpointVolume);
|
||||
MARSHAL(IID_IAudioSessionControl, state->sSessionControl, state->pSessionControl);
|
||||
|
||||
return S_OK;
|
||||
exit_label:
|
||||
MP_ERR(state, "Error creating COM proxy: %s (0x%"PRIx32")\n",
|
||||
wasapi_explain_err(hr), (uint32_t)hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
@ -1009,7 +1017,7 @@ retry:
|
|||
hr = IAudioEndpointVolume_QueryHardwareSupport(state->pEndpointVolume,
|
||||
&state->vol_hw_support);
|
||||
if ( hr != S_OK )
|
||||
MP_WARN(ao, "Query hardware volume control: %s (0x%"PRIx32")\n",
|
||||
MP_WARN(ao, "Error querying hardware volume control: %s (0x%"PRIx32")\n",
|
||||
wasapi_explain_err(hr), (uint32_t)hr);
|
||||
|
||||
MP_DBG(ao, "Probing formats\n");
|
||||
|
|
Loading…
Reference in New Issue