diff options
author | Jan Schmidt <jan@centricular.com> | 2016-10-25 14:51:52 +1100 |
---|---|---|
committer | Jan Schmidt <jan@centricular.com> | 2016-10-26 20:17:40 +1100 |
commit | a80265d65a878fb64cbd7736cde90d3b75aa8dc8 (patch) | |
tree | c41974a83540086793076b8aca7ad93e8809dc0f | |
parent | 83e7182b30b24e9969d6dd028ee6a152379a5741 (diff) |
splitmuxsink: Set child elements to NULL when removing.
Make sure that elements are in the NULL state when removing.
Fixes critical warnings when errors occur early on in starting up.
-rw-r--r-- | gst/multifile/gstsplitmuxsink.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/gst/multifile/gstsplitmuxsink.c b/gst/multifile/gstsplitmuxsink.c index eb97c3778..54c22bd2a 100644 --- a/gst/multifile/gstsplitmuxsink.c +++ b/gst/multifile/gstsplitmuxsink.c @@ -264,12 +264,21 @@ gst_splitmux_sink_init (GstSplitMuxSink * splitmux) static void gst_splitmux_reset (GstSplitMuxSink * splitmux) { - if (splitmux->mq) + if (splitmux->mq) { + gst_element_set_locked_state (splitmux->mq, TRUE); + gst_element_set_state (splitmux->mq, GST_STATE_NULL); gst_bin_remove (GST_BIN (splitmux), splitmux->mq); - if (splitmux->muxer) + } + if (splitmux->muxer) { + gst_element_set_locked_state (splitmux->muxer, TRUE); + gst_element_set_state (splitmux->muxer, GST_STATE_NULL); gst_bin_remove (GST_BIN (splitmux), splitmux->muxer); - if (splitmux->active_sink) + } + if (splitmux->active_sink) { + gst_element_set_locked_state (splitmux->active_sink, TRUE); + gst_element_set_state (splitmux->active_sink, GST_STATE_NULL); gst_bin_remove (GST_BIN (splitmux), splitmux->active_sink); + } splitmux->sink = splitmux->active_sink = splitmux->muxer = splitmux->mq = NULL; @@ -1551,6 +1560,8 @@ create_elements (GstSplitMuxSink * splitmux) create_element (splitmux, "mp4mux", "muxer")) == NULL) goto fail; } else { + /* Ensure it's not in locked state (we might be reusing an old element) */ + gst_element_set_locked_state (provided_muxer, FALSE); if (!gst_bin_add (GST_BIN (splitmux), provided_muxer)) { g_warning ("Could not add muxer element - splitmuxsink will not work"); gst_object_unref (provided_muxer); @@ -1627,6 +1638,8 @@ create_sink (GstSplitMuxSink * splitmux) goto fail; splitmux->active_sink = splitmux->sink; } else { + /* Ensure it's not in locked state (we might be reusing an old element) */ + gst_element_set_locked_state (provided_sink, FALSE); if (!gst_bin_add (GST_BIN (splitmux), provided_sink)) { g_warning ("Could not add sink elements - splitmuxsink will not work"); gst_object_unref (provided_sink); |