wasapideviceprovider: Add support for dynamic device add/remove
authorSeungha Yang <seungha@centricular.com>
Mon, 23 Aug 2021 18:54:27 +0000 (03:54 +0900)
committerSeungha Yang <seungha@centricular.com>
Tue, 21 Sep 2021 17:34:35 +0000 (17:34 +0000)
commit589ff8ca6dcb16057082fbbc0878413728fd1a9e
tree261f247b387c165cb10cc2fb022c4135228a4cbc
parent3c937c8023bc6158f26baebfcce4063e1fbc50f5
wasapideviceprovider: Add support for dynamic device add/remove

Adding IMMDeviceEnumerator::RegisterEndpointNotificationCallback
in order to support device monitoring.
On OnDeviceAdded(), OnDeviceRemoved(), and OnDefaultDeviceChanged()
callback, wasapi device provider implementation will enumerate
devices again and will notify newly added and removed device
via GstDeviceProvider API.

As a bonus point, this IMMDeviceEnumerator abstraction object
will spawn a dedicated internal COM thread, so various COM thread
related issues of WASAPI plugin can be resolved by this commit.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1649
Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1110
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2484>
12 files changed:
sys/wasapi/gstmmdeviceenumerator.cpp [new file with mode: 0644]
sys/wasapi/gstmmdeviceenumerator.h [new file with mode: 0644]
sys/wasapi/gstwasapidevice.c
sys/wasapi/gstwasapidevice.h
sys/wasapi/gstwasapisink.c
sys/wasapi/gstwasapisink.h
sys/wasapi/gstwasapisrc.c
sys/wasapi/gstwasapisrc.h
sys/wasapi/gstwasapiutil.c
sys/wasapi/gstwasapiutil.h
sys/wasapi/meson.build
tests/check/elements/wasapi.c