summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Schmidt <jan@centricular.com>2016-05-15 22:07:14 +1000
committerJan Schmidt <jan@centricular.com>2016-05-15 22:09:04 +1000
commitd7eb97393c1f0bbd5942033e53f3634cccd6af89 (patch)
treebc209f06261ff0e804a66aad04542f3dc8f93066
parent17ff6e72f92d9148c7c74180492aabd5e3e5a79f (diff)
splitmuxsrc: Connect to demux signals before activating
Fix a race in splitmuxsrc by properly connecting to the demuxer signals we're interested in *before* setting it running.
-rw-r--r--gst/multifile/gstsplitmuxpartreader.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/gst/multifile/gstsplitmuxpartreader.c b/gst/multifile/gstsplitmuxpartreader.c
index 2ba5e00b5..5e98166d4 100644
--- a/gst/multifile/gstsplitmuxpartreader.c
+++ b/gst/multifile/gstsplitmuxpartreader.c
@@ -737,8 +737,11 @@ new_decoded_pad_added_cb (GstElement * element, GstPad * pad,
/* Look up or create the output pad */
if (reader->get_pad_cb)
out_pad = reader->get_pad_cb (reader, pad, reader->cb_data);
- if (out_pad == NULL)
+ if (out_pad == NULL) {
+ GST_DEBUG_OBJECT (reader,
+ "No output pad for %" GST_PTR_FORMAT ". Ignoring", pad);
return;
+ }
/* Create our proxy pad to interact with this new pad */
proxy_pad = gst_splitmux_part_reader_new_proxy_pad (reader, out_pad);
@@ -911,16 +914,16 @@ type_found (GstElement * typefind, guint probability,
return;
}
- gst_element_set_locked_state (demux, TRUE);
- gst_bin_add (GST_BIN_CAST (reader), demux);
- gst_element_link_pads (reader->typefind, "src", demux, NULL);
- gst_element_sync_state_with_parent (reader->demux);
- gst_element_set_locked_state (demux, FALSE);
-
/* Connect to demux signals */
g_signal_connect (demux,
"pad-added", G_CALLBACK (new_decoded_pad_added_cb), reader);
g_signal_connect (demux, "no-more-pads", G_CALLBACK (no_more_pads), reader);
+
+ gst_element_set_locked_state (demux, TRUE);
+ gst_bin_add (GST_BIN_CAST (reader), demux);
+ gst_element_link_pads (reader->typefind, "src", demux, NULL);
+ gst_element_set_state (reader->demux, GST_STATE_TARGET (reader));
+ gst_element_set_locked_state (demux, FALSE);
}
static void