wasapi: Move to CoInitializeEx for COM initialization
authorNirbheek Chauhan <nirbheek@centricular.com>
Tue, 13 Aug 2019 17:24:42 +0000 (22:54 +0530)
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>
Tue, 27 Aug 2019 19:10:36 +0000 (19:10 +0000)
CoInitialize is not allowed when targeting UWP and causes a Windows
Application Certification Kit (WACK) error.

sys/wasapi/gstwasapidevice.c
sys/wasapi/gstwasapisink.c
sys/wasapi/gstwasapisrc.c

index 723368e75d75c5e0125bbcf286383194b8b83b02..4371e4487709e8be937c20131bff72dea2d09f9d 100644 (file)
@@ -48,7 +48,7 @@ gst_wasapi_device_provider_class_init (GstWasapiDeviceProviderClass * klass)
 static void
 gst_wasapi_device_provider_init (GstWasapiDeviceProvider * provider)
 {
-  CoInitialize (NULL);
+  CoInitializeEx (NULL, COINIT_MULTITHREADED);
 }
 
 static void
index cf8a075308b3c2daa5af12e9c87e54114c113563..d21c42f9040c5f2ee18fb1e9b2d357845d1d0718 100644 (file)
@@ -177,7 +177,7 @@ gst_wasapi_sink_init (GstWasapiSink * self)
   self->event_handle = CreateEvent (NULL, FALSE, FALSE, NULL);
   self->client_needs_restart = FALSE;
 
-  CoInitialize (NULL);
+  CoInitializeEx (NULL, COINIT_MULTITHREADED);
 }
 
 static void
@@ -475,7 +475,7 @@ gst_wasapi_sink_prepare (GstAudioSink * asink, GstAudioRingBufferSpec * spec)
   guint bpf, rate, devicep_frames;
   HRESULT hr;
 
-  CoInitialize (NULL);
+  CoInitializeEx (NULL, COINIT_MULTITHREADED);
 
   if (gst_wasapi_sink_can_audioclient3 (self)) {
     if (!gst_wasapi_util_initialize_audioclient3 (GST_ELEMENT (self), spec,
index 3bb8b3f8426dace86239817ed6cddb0d8d6db60b..e52ea7e98af71e03451cc6b53ecef4c77fc22a11 100644 (file)
@@ -191,7 +191,7 @@ gst_wasapi_src_init (GstWasapiSrc * self)
   self->event_handle = CreateEvent (NULL, FALSE, FALSE, NULL);
   self->client_needs_restart = FALSE;
 
-  CoInitialize (NULL);
+  CoInitializeEx (NULL, COINIT_MULTITHREADED);
 }
 
 static void
@@ -444,7 +444,7 @@ gst_wasapi_src_prepare (GstAudioSrc * asrc, GstAudioRingBufferSpec * spec)
   guint bpf, rate, devicep_frames, buffer_frames;
   HRESULT hr;
 
-  CoInitialize (NULL);
+  CoInitializeEx (NULL, COINIT_MULTITHREADED);
 
   if (gst_wasapi_src_can_audioclient3 (self)) {
     if (!gst_wasapi_util_initialize_audioclient3 (GST_ELEMENT (self), spec,