From 2b50a338c348af7df95dc22bd12d5c0ea2ca016c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 27 Mar 2017 21:52:00 +0300 Subject: [PATCH] qtdemux: In gap mode, consider the mdat offset when calculating the remaining mdat size The mdat generally does not start at offset 0, we have to include the size of the moof and whatever else was in front of the mdat. --- gst/isomp4/qtdemux.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c index 87f8f42814..f8f08cd329 100644 --- a/gst/isomp4/qtdemux.c +++ b/gst/isomp4/qtdemux.c @@ -3282,6 +3282,7 @@ qtdemux_parse_trun (GstQTDemux * qtdemux, GstByteReader * trun, * size, else we will still be able to use this when dealing with gap'ed * input */ qtdemux->mdatleft = *running_offset - initial_offset; + qtdemux->mdatoffset = initial_offset; qtdemux->mdatsize = qtdemux->mdatleft; stream->n_samples += samples_count; @@ -6276,7 +6277,8 @@ gst_qtdemux_chain (GstPad * sinkpad, GstObject * parent, GstBuffer * inbuf) /* Finally update all push-based values to the expected values */ demux->neededbytes = demux->streams[i]->samples[res].size; demux->offset = GST_BUFFER_OFFSET (inbuf); - demux->mdatleft = demux->mdatsize - demux->offset; + demux->mdatleft = + demux->mdatsize - demux->offset + demux->mdatoffset; demux->todrop = 0; } }