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: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/735>
This commit is contained in:
Nicolas Dufresne 2020-09-23 15:25:36 -04:00
parent ecc110ca8b
commit 345f74b09d

View file

@ -859,6 +859,7 @@ free_session (GstRtpBinSession * sess, GstRtpBin * bin)
g_slist_foreach (sess->elements, (GFunc) remove_bin_element, bin); g_slist_foreach (sess->elements, (GFunc) remove_bin_element, bin);
g_slist_free (sess->elements); g_slist_free (sess->elements);
sess->elements = NULL;
g_slist_foreach (sess->streams, (GFunc) free_stream, bin); g_slist_foreach (sess->streams, (GFunc) free_stream, bin);
g_slist_free (sess->streams); g_slist_free (sess->streams);
@ -1849,6 +1850,7 @@ no_demux:
static void static void
free_stream (GstRtpBinStream * stream, GstRtpBin * bin) free_stream (GstRtpBinStream * stream, GstRtpBin * bin)
{ {
GstRtpBinSession *sess = stream->session;
GSList *clients, *next_client; GSList *clients, *next_client;
GST_DEBUG_OBJECT (bin, "freeing stream %p", stream); GST_DEBUG_OBJECT (bin, "freeing stream %p", stream);
@ -1875,7 +1877,10 @@ free_stream (GstRtpBinStream * stream, GstRtpBin * bin)
if (stream->buffer_ntpstop_sig) if (stream->buffer_ntpstop_sig)
g_signal_handler_disconnect (stream->buffer, 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); gst_object_unref (stream->buffer);
if (stream->demux) if (stream->demux)
gst_bin_remove (GST_BIN_CAST (bin), stream->demux); gst_bin_remove (GST_BIN_CAST (bin), stream->demux);