wasapi2: Activate device asynchronously if required
authorSeungha Yang <seungha@centricular.com>
Fri, 24 Jul 2020 15:17:29 +0000 (00:17 +0900)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Sun, 26 Jul 2020 12:52:15 +0000 (12:52 +0000)
commit9e56d202793d3e9a71836420536bb19e6744b999
treef67bfe39f83ad545bc2d2e8f915c7e8019961d10
parentb10afc574e72d1f55ba4ce8f5f7572c3df48acf1
wasapi2: Activate device asynchronously if required

In case of UWP, documentation from MS is saying that
ActivateAudioInterfaceAsync() method should be called from UI thread.
And the resulting callback might not happen until user interaction
has been made.
So we cannot wait the activation result on constructed() method.
and therefore we should return gst_wasapi2_client_new()
immediately without waiting the result if wasapi2 elements are
running on UWP application.
In addition to async operation fix, this commit includes COM object
reference counting issue around ActivateAudioInterfaceAsync() call.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1466>
sys/wasapi2/gstwasapi2client.cpp
sys/wasapi2/gstwasapi2client.h
sys/wasapi2/gstwasapi2sink.c
sys/wasapi2/gstwasapi2src.c