diff options
-rw-r--r-- | gst/isomp4/qtdemux.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c index eb6954714..ea94cb25b 100644 --- a/gst/isomp4/qtdemux.c +++ b/gst/isomp4/qtdemux.c @@ -4224,25 +4224,32 @@ gst_qtdemux_chain (GstPad * sinkpad, GstBuffer * inbuf) extract_initial_length_and_fourcc (data, demux->neededbytes, NULL, &fourcc); if (fourcc == FOURCC_moov) { - GST_DEBUG_OBJECT (demux, "Parsing [moov]"); + /* in usual fragmented setup we could try to scan for more + * and end up at the the moov (after mdat) again */ + if (demux->got_moov && demux->n_streams > 0) { + GST_DEBUG_OBJECT (demux, + "Skipping moov atom as we have one already"); + } else { + GST_DEBUG_OBJECT (demux, "Parsing [moov]"); - demux->got_moov = TRUE; + demux->got_moov = TRUE; - /* prepare newsegment to send when streaming actually starts */ - if (!demux->pending_newsegment) { - demux->pending_newsegment = - gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, - 0, GST_CLOCK_TIME_NONE, 0); - } + /* prepare newsegment to send when streaming actually starts */ + if (!demux->pending_newsegment) { + demux->pending_newsegment = + gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, + 0, GST_CLOCK_TIME_NONE, 0); + } - qtdemux_parse_moov (demux, data, demux->neededbytes); - qtdemux_node_dump (demux, demux->moov_node); - qtdemux_parse_tree (demux); - qtdemux_expose_streams (demux); + qtdemux_parse_moov (demux, data, demux->neededbytes); + qtdemux_node_dump (demux, demux->moov_node); + qtdemux_parse_tree (demux); + qtdemux_expose_streams (demux); - g_node_destroy (demux->moov_node); - demux->moov_node = NULL; - GST_DEBUG_OBJECT (demux, "Finished parsing the header"); + g_node_destroy (demux->moov_node); + demux->moov_node = NULL; + GST_DEBUG_OBJECT (demux, "Finished parsing the header"); + } } else if (fourcc == FOURCC_moof) { if (demux->got_moov && demux->fragmented) { GST_DEBUG_OBJECT (demux, "Parsing [moof]"); |