From 345f74b09d2a8eb421f9c77d8d2a65aec0e83005 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Wed, 23 Sep 2020 15:25:36 -0400 Subject: [PATCH] rtpbin: Remove the rtpjitterbuffer with the stream Since !348, the jitterbuffer was only removed with the session. This restores the original behaviour and removes the jitterbuffer when the stream is removed. This avoid accumulating jitterbuffer objects into the bin when a session is reused. Part-of: --- gst/rtpmanager/gstrtpbin.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gst/rtpmanager/gstrtpbin.c b/gst/rtpmanager/gstrtpbin.c index bdb16a0a3a..1fb98ffc71 100644 --- a/gst/rtpmanager/gstrtpbin.c +++ b/gst/rtpmanager/gstrtpbin.c @@ -859,6 +859,7 @@ free_session (GstRtpBinSession * sess, GstRtpBin * bin) g_slist_foreach (sess->elements, (GFunc) remove_bin_element, bin); g_slist_free (sess->elements); + sess->elements = NULL; g_slist_foreach (sess->streams, (GFunc) free_stream, bin); g_slist_free (sess->streams); @@ -1849,6 +1850,7 @@ no_demux: static void free_stream (GstRtpBinStream * stream, GstRtpBin * bin) { + GstRtpBinSession *sess = stream->session; GSList *clients, *next_client; GST_DEBUG_OBJECT (bin, "freeing stream %p", stream); @@ -1875,7 +1877,10 @@ free_stream (GstRtpBinStream * stream, GstRtpBin * bin) if (stream->buffer_ntpstop_sig) g_signal_handler_disconnect (stream->buffer, stream->buffer_ntpstop_sig); + sess->elements = g_slist_remove (sess->elements, stream->buffer); + remove_bin_element (stream->buffer, bin); gst_object_unref (stream->buffer); + if (stream->demux) gst_bin_remove (GST_BIN_CAST (bin), stream->demux);