[vlc-devel] [PATCH 2/4] mmdevice: support WASAPI device endpoint activation events

Thomas Guillem thomas at gllm.fr
Tue May 24 18:16:31 CEST 2016


From: Sean McGovern <gseanmcg at gmail.com>

Some devices expose more than one endpoint such as speakers and headphone
output. Disconnecting headphones does not remove the endpoint but instead marks
it as being in unplugged state.

Respond to the appropriate activation events in order to enable/disable
endpoints correctly when they are added/removed from set of "active" endpoints.

Fix #15966

Signed-off-by: Thomas Guillem <thomas at gllm.fr>
---
 modules/audio_output/mmdevice.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/modules/audio_output/mmdevice.c b/modules/audio_output/mmdevice.c
index a58b7dc..4734878 100644
--- a/modules/audio_output/mmdevice.c
+++ b/modules/audio_output/mmdevice.c
@@ -619,7 +619,7 @@ vlc_MMNotificationClient_OnDeviceStateChanged(IMMNotificationClient *this,
             break;
         case DEVICE_STATE_ACTIVE:
             msg_Warn(aout, "device %ls became active", wid);
-            break;
+            return DeviceUpdated(aout, wid);
         case DEVICE_STATE_DISABLED:
             msg_Warn(aout, "device %ls was disabled", wid);
             break;
@@ -628,9 +628,15 @@ vlc_MMNotificationClient_OnDeviceStateChanged(IMMNotificationClient *this,
             break;
         default:
             msg_Warn(aout, "device %ls: unknown state %08lx", wid, state);
-            break;
+            return E_FAIL;
     }
 
+    /* Unplugged, disabled or notpresent */
+    char *id = FromWide(wid);
+    if (likely(id != NULL))
+        aout_HotplugReport(aout, id, NULL);
+    free(id);
+
     return S_OK;
 }
 
-- 
2.8.1



More information about the vlc-devel mailing list