diff options
-rw-r--r-- | gst/isomp4/qtdemux.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c index b469b9698..6ec43df4b 100644 --- a/gst/isomp4/qtdemux.c +++ b/gst/isomp4/qtdemux.c @@ -4581,7 +4581,6 @@ gst_qtdemux_chain (GstPad * sinkpad, GstBuffer * inbuf) 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; @@ -4719,6 +4718,13 @@ gst_qtdemux_chain (GstPad * sinkpad, GstBuffer * inbuf) /* initial newsegment sent here after having added pads, * possible others in sink_event */ if (G_UNLIKELY (demux->pending_newsegment)) { + /* first expose the streams, this is done here because the + * pads need to be created after the first mdat is received + * this ensure that the described streams actually have samples + * or either from the stbl (static) atom or the trun (fragmented) + * atom + */ + qtdemux_expose_streams (demux); gst_qtdemux_push_pending_newsegment (demux); /* clear to send tags on all streams */ for (i = 0; i < demux->n_streams; i++) { @@ -8322,10 +8328,12 @@ qtdemux_expose_streams (GstQTDemux * qtdemux) if (ret != GST_FLOW_ERROR) ret = GST_FLOW_OK; - /* in pull mode, we should have parsed some sample info by now; - * and quite some code will not handle no samples. - * in push mode, we'll just have to deal with it */ - if (G_UNLIKELY (qtdemux->pullbased && !stream->n_samples)) { + /* in pull mode, we expose the streams whenever we are ready to parse + * movie data. in push mode we expose whenever we are about to send + * the new segment. In both cases we should have already parsed a moof + * that describes the samples or the stbl + */ + if (G_UNLIKELY (!stream->n_samples)) { GST_DEBUG_OBJECT (qtdemux, "no samples for stream; discarding"); gst_qtdemux_stream_free (qtdemux, stream); memmove (&(qtdemux->streams[i]), &(qtdemux->streams[i + 1]), |