mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-24 16:18:16 +00:00
sdpdemux: Release request pads from rtpbin when freeing a stream
Otherwise the pads of the rtpbin stay around forever and are leaked. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2437>
This commit is contained in:
parent
7322a6d004
commit
3487c81ac2
1 changed files with 20 additions and 6 deletions
|
@ -313,18 +313,34 @@ gst_sdp_demux_stream_free (GstSDPDemux * demux, GstSDPStream * stream)
|
||||||
|
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
GstElement *udpsrc = stream->udpsrc[i];
|
GstElement *udpsrc = stream->udpsrc[i];
|
||||||
|
GstPad *channelpad = stream->channelpad[i];
|
||||||
|
|
||||||
if (udpsrc) {
|
if (udpsrc) {
|
||||||
gst_element_set_state (udpsrc, GST_STATE_NULL);
|
gst_element_set_state (udpsrc, GST_STATE_NULL);
|
||||||
gst_bin_remove (GST_BIN_CAST (demux), udpsrc);
|
gst_bin_remove (GST_BIN_CAST (demux), udpsrc);
|
||||||
stream->udpsrc[i] = NULL;
|
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) {
|
if (stream->udpsink) {
|
||||||
gst_element_set_state (stream->udpsink, GST_STATE_NULL);
|
gst_element_set_state (stream->udpsink, GST_STATE_NULL);
|
||||||
gst_bin_remove (GST_BIN_CAST (demux), stream->udpsink);
|
gst_bin_remove (GST_BIN_CAST (demux), stream->udpsink);
|
||||||
stream->udpsink = NULL;
|
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) {
|
if (stream->srcpad) {
|
||||||
gst_pad_set_active (stream->srcpad, FALSE);
|
gst_pad_set_active (stream->srcpad, FALSE);
|
||||||
if (stream->added) {
|
if (stream->added) {
|
||||||
|
@ -842,7 +858,7 @@ static gboolean
|
||||||
gst_sdp_demux_stream_configure_udp_sink (GstSDPDemux * demux,
|
gst_sdp_demux_stream_configure_udp_sink (GstSDPDemux * demux,
|
||||||
GstSDPStream * stream)
|
GstSDPStream * stream)
|
||||||
{
|
{
|
||||||
GstPad *pad, *sinkpad;
|
GstPad *sinkpad;
|
||||||
gint port;
|
gint port;
|
||||||
GSocket *socket;
|
GSocket *socket;
|
||||||
gchar *destination, *uri, *name;
|
gchar *destination, *uri, *name;
|
||||||
|
@ -894,21 +910,19 @@ gst_sdp_demux_stream_configure_udp_sink (GstSDPDemux * demux,
|
||||||
|
|
||||||
/* get session RTCP pad */
|
/* get session RTCP pad */
|
||||||
name = g_strdup_printf ("send_rtcp_src_%u", stream->id);
|
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);
|
g_free (name);
|
||||||
|
|
||||||
/* and link */
|
/* and link */
|
||||||
if (pad) {
|
if (stream->rtcppad) {
|
||||||
sinkpad = gst_element_get_static_pad (stream->udpsink, "sink");
|
sinkpad = gst_element_get_static_pad (stream->udpsink, "sink");
|
||||||
gst_pad_link (pad, sinkpad);
|
gst_pad_link (stream->rtcppad, sinkpad);
|
||||||
gst_object_unref (pad);
|
|
||||||
gst_object_unref (sinkpad);
|
gst_object_unref (sinkpad);
|
||||||
} else {
|
} else {
|
||||||
/* not very fatal, we just won't be able to send RTCP */
|
/* not very fatal, we just won't be able to send RTCP */
|
||||||
GST_WARNING_OBJECT (demux, "could not get session RTCP pad");
|
GST_WARNING_OBJECT (demux, "could not get session RTCP pad");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
|
|
Loading…
Reference in a new issue