mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
wasapi: Call CoIn/Uninitialize() around prepare()
Seems to be required for exclusive mode and also for all initialization on Windows 7 https://bugzilla.gnome.org/show_bug.cgi?id=795274
This commit is contained in:
parent
b476893560
commit
ff17a404b3
3 changed files with 9 additions and 11 deletions
|
@ -474,6 +474,8 @@ gst_wasapi_sink_prepare (GstAudioSink * asink, GstAudioRingBufferSpec * spec)
|
||||||
guint bpf, rate, devicep_frames;
|
guint bpf, rate, devicep_frames;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
|
CoInitialize (NULL);
|
||||||
|
|
||||||
if (gst_wasapi_sink_can_audioclient3 (self)) {
|
if (gst_wasapi_sink_can_audioclient3 (self)) {
|
||||||
if (!gst_wasapi_util_initialize_audioclient3 (GST_ELEMENT (self), spec,
|
if (!gst_wasapi_util_initialize_audioclient3 (GST_ELEMENT (self), spec,
|
||||||
(IAudioClient3 *) self->client, self->mix_format, self->low_latency,
|
(IAudioClient3 *) self->client, self->mix_format, self->low_latency,
|
||||||
|
@ -577,9 +579,7 @@ gst_wasapi_sink_unprepare (GstAudioSink * asink)
|
||||||
{
|
{
|
||||||
GstWasapiSink *self = GST_WASAPI_SINK (asink);
|
GstWasapiSink *self = GST_WASAPI_SINK (asink);
|
||||||
|
|
||||||
if (self->sharemode == AUDCLNT_SHAREMODE_EXCLUSIVE &&
|
CoUninitialize ();
|
||||||
!gst_wasapi_sink_can_audioclient3 (self))
|
|
||||||
CoUninitialize ();
|
|
||||||
|
|
||||||
if (self->thread_priority_handle != NULL) {
|
if (self->thread_priority_handle != NULL) {
|
||||||
gst_wasapi_util_revert_thread_characteristics
|
gst_wasapi_util_revert_thread_characteristics
|
||||||
|
@ -596,6 +596,8 @@ gst_wasapi_sink_unprepare (GstAudioSink * asink)
|
||||||
self->render_client = NULL;
|
self->render_client = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CoUninitialize ();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -436,6 +436,8 @@ gst_wasapi_src_prepare (GstAudioSrc * asrc, GstAudioRingBufferSpec * spec)
|
||||||
guint bpf, rate, devicep_frames, buffer_frames;
|
guint bpf, rate, devicep_frames, buffer_frames;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
|
CoInitialize (NULL);
|
||||||
|
|
||||||
if (gst_wasapi_src_can_audioclient3 (self)) {
|
if (gst_wasapi_src_can_audioclient3 (self)) {
|
||||||
if (!gst_wasapi_util_initialize_audioclient3 (GST_ELEMENT (self), spec,
|
if (!gst_wasapi_util_initialize_audioclient3 (GST_ELEMENT (self), spec,
|
||||||
(IAudioClient3 *) self->client, self->mix_format, self->low_latency,
|
(IAudioClient3 *) self->client, self->mix_format, self->low_latency,
|
||||||
|
@ -517,10 +519,6 @@ gst_wasapi_src_unprepare (GstAudioSrc * asrc)
|
||||||
{
|
{
|
||||||
GstWasapiSrc *self = GST_WASAPI_SRC (asrc);
|
GstWasapiSrc *self = GST_WASAPI_SRC (asrc);
|
||||||
|
|
||||||
if (self->sharemode == AUDCLNT_SHAREMODE_EXCLUSIVE &&
|
|
||||||
!gst_wasapi_src_can_audioclient3 (self))
|
|
||||||
CoUninitialize ();
|
|
||||||
|
|
||||||
if (self->thread_priority_handle != NULL) {
|
if (self->thread_priority_handle != NULL) {
|
||||||
gst_wasapi_util_revert_thread_characteristics
|
gst_wasapi_util_revert_thread_characteristics
|
||||||
(self->thread_priority_handle);
|
(self->thread_priority_handle);
|
||||||
|
@ -543,6 +541,8 @@ gst_wasapi_src_unprepare (GstAudioSrc * asrc)
|
||||||
|
|
||||||
self->client_clock_freq = 0;
|
self->client_clock_freq = 0;
|
||||||
|
|
||||||
|
CoUninitialize ();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -870,10 +870,6 @@ gst_wasapi_util_initialize_audioclient (GstElement * self,
|
||||||
min_period, &device_period, &device_buffer_duration);
|
min_period, &device_period, &device_buffer_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For some reason, we need to call this a second time for exclusive mode */
|
|
||||||
if (sharemode == AUDCLNT_SHAREMODE_EXCLUSIVE)
|
|
||||||
CoInitialize (NULL);
|
|
||||||
|
|
||||||
stream_flags = AUDCLNT_STREAMFLAGS_EVENTCALLBACK;
|
stream_flags = AUDCLNT_STREAMFLAGS_EVENTCALLBACK;
|
||||||
if (loopback)
|
if (loopback)
|
||||||
stream_flags |= AUDCLNT_STREAMFLAGS_LOOPBACK;
|
stream_flags |= AUDCLNT_STREAMFLAGS_LOOPBACK;
|
||||||
|
|
Loading…
Reference in a new issue