From c9af1d486a636b41e1167779340bd6fd8915a7c7 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Mon, 6 May 2024 20:50:21 +1000 Subject: [PATCH] webrtc: request-aux-sender, only sink floating refs Don't add an extra ref if non-floating as that ref will never be unreffed. gst_bin_add() is transfer floating (alias to transfer none). Fixes a leak when a non-floating ref was provided as a return value in the request-aux-sender signal. Part-of: --- subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c b/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c index af2f3b203a..0b10519389 100644 --- a/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c +++ b/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c @@ -7513,7 +7513,8 @@ on_rtpbin_request_aux_sender (GstElement * rtpbin, guint session_id, GstPad *sinkpad = gst_element_get_static_pad (aux_sender, "sink"); GstPad *srcpad = gst_element_get_static_pad (aux_sender, "src"); - gst_object_ref_sink (aux_sender); + if (g_object_is_floating (aux_sender)) + aux_sender = gst_object_ref_sink (aux_sender); if (!sinkpad || !srcpad) { GST_ERROR_OBJECT (webrtc,