Commit f0362f18 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

wasapi: retry if device is invalidated during open (refs #6826)

parent e351093a
...@@ -479,7 +479,7 @@ static int Open(vlc_object_t *obj) ...@@ -479,7 +479,7 @@ static int Open(vlc_object_t *obj)
free(sys); free(sys);
return VLC_EGENERIC; return VLC_EGENERIC;
} }
retry:
/* Get audio device according to policy */ /* Get audio device according to policy */
var_Create (aout, "audio-device", VLC_VAR_STRING|VLC_VAR_HASCHOICE); var_Create (aout, "audio-device", VLC_VAR_STRING|VLC_VAR_HASCHOICE);
...@@ -546,7 +546,6 @@ static int Open(vlc_object_t *obj) ...@@ -546,7 +546,6 @@ static int Open(vlc_object_t *obj)
vlc_ToWave(&wf, &format); vlc_ToWave(&wf, &format);
hr = IAudioClient_IsFormatSupported(sys->client, AUDCLNT_SHAREMODE_SHARED, hr = IAudioClient_IsFormatSupported(sys->client, AUDCLNT_SHAREMODE_SHARED,
&wf.Format, &pwf); &wf.Format, &pwf);
// TODO: deal with (hr == AUDCLNT_E_DEVICE_INVALIDATED) ?
if (FAILED(hr)) if (FAILED(hr))
{ {
msg_Err(aout, "cannot negotiate audio format (error 0x%lx)", hr); msg_Err(aout, "cannot negotiate audio format (error 0x%lx)", hr);
...@@ -617,8 +616,13 @@ error: ...@@ -617,8 +616,13 @@ error:
CloseHandle(sys->done); CloseHandle(sys->done);
if (sys->client != NULL) if (sys->client != NULL)
IAudioClient_Release(sys->client); IAudioClient_Release(sys->client);
var_Destroy(aout, "audio-device");
if (hr == AUDCLNT_E_DEVICE_INVALIDATED)
{
msg_Warn(aout, "device invalidated, retrying");
goto retry;
}
Leave(); Leave();
var_Destroy (aout, "audio-device");
free(sys); free(sys);
return VLC_EGENERIC; return VLC_EGENERIC;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment