mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
wasapi2ringbuffer: Fix client object leak
Check whether ringbuffer is holding client object already since open_device() may be called multiple times Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1307>
This commit is contained in:
parent
f9a97efbe1
commit
8eee442715
1 changed files with 2 additions and 12 deletions
|
@ -165,7 +165,6 @@ struct _GstWasapi2RingBuffer
|
|||
guint64 expected_position;
|
||||
gboolean is_first;
|
||||
gboolean running;
|
||||
gboolean opened;
|
||||
UINT32 buffer_size;
|
||||
UINT32 loopback_buffer_size;
|
||||
|
||||
|
@ -231,8 +230,6 @@ gst_wasapi2_ring_buffer_class_init (GstWasapi2RingBufferClass * klass)
|
|||
static void
|
||||
gst_wasapi2_ring_buffer_init (GstWasapi2RingBuffer * self)
|
||||
{
|
||||
self->opened = FALSE;
|
||||
|
||||
self->volume = 1.0f;
|
||||
self->mute = FALSE;
|
||||
|
||||
|
@ -377,7 +374,7 @@ gst_wasapi2_ring_buffer_open_device (GstAudioRingBuffer * buf)
|
|||
|
||||
GST_DEBUG_OBJECT (self, "Open");
|
||||
|
||||
if (self->opened) {
|
||||
if (self->client) {
|
||||
GST_DEBUG_OBJECT (self, "Already opened");
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -430,8 +427,6 @@ gst_wasapi2_ring_buffer_close_device_internal (GstAudioRingBuffer * buf)
|
|||
gst_clear_object (&self->client);
|
||||
gst_clear_object (&self->loopback_client);
|
||||
|
||||
self->opened = FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -972,7 +967,7 @@ gst_wasapi2_ring_buffer_acquire (GstAudioRingBuffer * buf,
|
|||
|
||||
GST_DEBUG_OBJECT (buf, "Acquire");
|
||||
|
||||
if (!self->opened && !gst_wasapi2_ring_buffer_open_device (buf))
|
||||
if (!self->client && !gst_wasapi2_ring_buffer_open_device (buf))
|
||||
return FALSE;
|
||||
|
||||
if (self->device_class == GST_WASAPI2_CLIENT_DEVICE_CLASS_LOOPBACK_CAPTURE) {
|
||||
|
@ -982,11 +977,6 @@ gst_wasapi2_ring_buffer_acquire (GstAudioRingBuffer * buf,
|
|||
}
|
||||
}
|
||||
|
||||
if (!self->client) {
|
||||
GST_ERROR_OBJECT (self, "No configured client object");
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!gst_wasapi2_client_ensure_activation (self->client)) {
|
||||
GST_ERROR_OBJECT (self, "Failed to activate audio client");
|
||||
goto error;
|
||||
|
|
Loading…
Reference in a new issue