From c6e9c67f63ccb87c61dfc348252ddbfc0866bb0f Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Thu, 13 Apr 2017 13:25:06 +0200 Subject: [PATCH] qtdemux: Properly reset demuxer when all streams are EOS Make sure offset and neededbytes are properly resetted when all streams are EOS in push-mode. Avoids cases when some data might still be pushed by upstream (because it didn't yet see the resulting GST_FLOW_EOS yet) and qtdemux gets completely lost. https://bugzilla.gnome.org/show_bug.cgi?id=781266 --- gst/isomp4/qtdemux.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c index 41fea0c76..c03f3ecf2 100644 --- a/gst/isomp4/qtdemux.c +++ b/gst/isomp4/qtdemux.c @@ -6885,6 +6885,7 @@ gst_qtdemux_process_adapter (GstQTDemux * demux, gboolean force) /* skip this data, stream is EOS */ gst_adapter_flush (demux->adapter, demux->neededbytes); + demux->offset += demux->neededbytes; /* check if all streams are eos */ ret = GST_FLOW_EOS; @@ -6894,11 +6895,6 @@ gst_qtdemux_process_adapter (GstQTDemux * demux, gboolean force) break; } } - - if (ret == GST_FLOW_EOS) { - GST_DEBUG_OBJECT (demux, "All streams are EOS, signal upstream"); - goto eos; - } } else { GstBuffer *outbuf; @@ -6929,6 +6925,13 @@ gst_qtdemux_process_adapter (GstQTDemux * demux, gboolean force) GST_LOG_OBJECT (demux, "offset is now %" G_GUINT64_FORMAT, demux->offset); + + if (ret == GST_FLOW_EOS) { + GST_DEBUG_OBJECT (demux, "All streams are EOS, signal upstream"); + demux->neededbytes = -1; + goto eos; + } + if ((demux->neededbytes = next_entry_size (demux)) == -1) { if (demux->fragmented) { GST_DEBUG_OBJECT (demux, "(temporarily) out of fragmented samples"); -- GitLab