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

mmdevice: improve handling of session disconnect event

It could still be better. If the disconnection is unrecoverable,
I suspect a flood of identical errors will be emitted continuously
as the core keeps pushing audio buffers.
parent c2ae62db
......@@ -428,12 +428,36 @@ vlc_AudioSessionEvents_OnStateChanged(IAudioSessionEvents *this,
static STDMETHODIMP
vlc_AudioSessionEvents_OnSessionDisconnected(IAudioSessionEvents *this,
AudioSessionDisconnectReason reason)
AudioSessionDisconnectReason reason)
{
aout_sys_t *sys = vlc_AudioSessionEvents_sys(this);
audio_output_t *aout = sys->aout;
msg_Dbg(aout, "session disconnected: reason %d", reason);
switch (reason)
{
case DisconnectReasonDeviceRemoval:
msg_Warn(aout, "session disconnected: %s", "device removed");
break;
case DisconnectReasonServerShutdown:
msg_Err(aout, "session disconnected: %s", "service stopped");
return S_OK;
case DisconnectReasonFormatChanged:
msg_Warn(aout, "session disconnected: %s", "format changed");
break;
case DisconnectReasonSessionLogoff:
msg_Err(aout, "session disconnected: %s", "user logged off");
return S_OK;
case DisconnectReasonSessionDisconnected:
msg_Err(aout, "session disconnected: %s", "session disconnected");
return S_OK;
case DisconnectReasonExclusiveModeOverride:
msg_Err(aout, "session disconnected: %s", "stream overriden");
return S_OK;
default:
msg_Warn(aout, "session disconnected: unknown reason %d", reason);
return S_OK;
}
var_TriggerCallback(aout, "audio-device");
return S_OK;
}
......
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