From 4a78048cc50ebe38158b9aff8b76511af6f0f2c6 Mon Sep 17 00:00:00 2001 From: George Kiagiadakis Date: Sat, 24 Oct 2015 23:57:29 +0200 Subject: [PATCH] splitmuxsink: do not destroy the multiqueue & muxer when going to NULL Instead, delay it until all request pads have been released. This is because the release_pad() vfunc requires the multiqueue and muxer to be there in order to release their request pads as well. If those elements are destroyed earlier, release_pad() does not work, no pads are released and some resources are leaked. https://bugzilla.gnome.org/show_bug.cgi?id=753622 --- gst/multifile/gstsplitmuxsink.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gst/multifile/gstsplitmuxsink.c b/gst/multifile/gstsplitmuxsink.c index b3da76dbd5..aef9e64a39 100644 --- a/gst/multifile/gstsplitmuxsink.c +++ b/gst/multifile/gstsplitmuxsink.c @@ -1321,6 +1321,10 @@ gst_splitmux_sink_release_pad (GstElement * element, GstPad * pad) gst_element_remove_pad (element, pad); + /* Reset the internal elements only after all request pads are released */ + if (splitmux->contexts == NULL) + gst_splitmux_reset (splitmux); + fail: GST_SPLITMUX_UNLOCK (splitmux); } @@ -1554,7 +1558,9 @@ gst_splitmux_sink_change_state (GstElement * element, GstStateChange transition) case GST_STATE_CHANGE_READY_TO_NULL: GST_SPLITMUX_LOCK (splitmux); splitmux->fragment_id = 0; - gst_splitmux_reset (splitmux); + /* Reset internal elements only if no pad contexts are using them */ + if (splitmux->contexts == NULL) + gst_splitmux_reset (splitmux); GST_SPLITMUX_UNLOCK (splitmux); break; default: