From: Sebastian Dröge Date: Tue, 17 May 2022 11:02:28 +0000 (+0300) Subject: sdpdemux: Release request pads from rtpbin when freeing a stream X-Git-Tag: 1.22.0~1624 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3487c81ac28bd2c1b196dff748965543c8ebcf3d;p=platform%2Fupstream%2Fgstreamer.git sdpdemux: Release request pads from rtpbin when freeing a stream Otherwise the pads of the rtpbin stay around forever and are leaked. Part-of: --- diff --git a/subprojects/gst-plugins-bad/gst/sdp/gstsdpdemux.c b/subprojects/gst-plugins-bad/gst/sdp/gstsdpdemux.c index 5d18b6b..a97dd54 100644 --- a/subprojects/gst-plugins-bad/gst/sdp/gstsdpdemux.c +++ b/subprojects/gst-plugins-bad/gst/sdp/gstsdpdemux.c @@ -313,18 +313,34 @@ gst_sdp_demux_stream_free (GstSDPDemux * demux, GstSDPStream * stream) for (i = 0; i < 2; i++) { GstElement *udpsrc = stream->udpsrc[i]; + GstPad *channelpad = stream->channelpad[i]; if (udpsrc) { gst_element_set_state (udpsrc, GST_STATE_NULL); gst_bin_remove (GST_BIN_CAST (demux), udpsrc); stream->udpsrc[i] = NULL; } + + if (channelpad) { + if (demux->session) { + gst_element_release_request_pad (demux->session, channelpad); + } + gst_object_unref (channelpad); + stream->channelpad[i] = NULL; + } } if (stream->udpsink) { gst_element_set_state (stream->udpsink, GST_STATE_NULL); gst_bin_remove (GST_BIN_CAST (demux), stream->udpsink); stream->udpsink = NULL; } + if (stream->rtcppad) { + if (demux->session) { + gst_element_release_request_pad (demux->session, stream->rtcppad); + } + gst_object_unref (stream->rtcppad); + stream->rtcppad = NULL; + } if (stream->srcpad) { gst_pad_set_active (stream->srcpad, FALSE); if (stream->added) { @@ -842,7 +858,7 @@ static gboolean gst_sdp_demux_stream_configure_udp_sink (GstSDPDemux * demux, GstSDPStream * stream) { - GstPad *pad, *sinkpad; + GstPad *sinkpad; gint port; GSocket *socket; gchar *destination, *uri, *name; @@ -894,21 +910,19 @@ gst_sdp_demux_stream_configure_udp_sink (GstSDPDemux * demux, /* get session RTCP pad */ name = g_strdup_printf ("send_rtcp_src_%u", stream->id); - pad = gst_element_request_pad_simple (demux->session, name); + stream->rtcppad = gst_element_request_pad_simple (demux->session, name); g_free (name); /* and link */ - if (pad) { + if (stream->rtcppad) { sinkpad = gst_element_get_static_pad (stream->udpsink, "sink"); - gst_pad_link (pad, sinkpad); - gst_object_unref (pad); + gst_pad_link (stream->rtcppad, sinkpad); gst_object_unref (sinkpad); } else { /* not very fatal, we just won't be able to send RTCP */ GST_WARNING_OBJECT (demux, "could not get session RTCP pad"); } - return TRUE; /* ERRORS */