Commit a56a01f1 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

dashdemux: Update mdatleft from overall mdatsize and offset when observing a gap

Otherwise mdatleft will have a value calculated from the initial
mdatsize minus the parts of the stream that we saw, which is not
including all the parts of the stream that might've been skipped.
parent f26edcdf
...@@ -2005,6 +2005,7 @@ gst_qtdemux_reset (GstQTDemux * qtdemux, gboolean hard) ...@@ -2005,6 +2005,7 @@ gst_qtdemux_reset (GstQTDemux * qtdemux, gboolean hard)
qtdemux->mdatbuffer = NULL; qtdemux->mdatbuffer = NULL;
qtdemux->restoredata_buffer = NULL; qtdemux->restoredata_buffer = NULL;
qtdemux->mdatleft = 0; qtdemux->mdatleft = 0;
qtdemux->mdatsize = 0;
if (qtdemux->comp_brands) if (qtdemux->comp_brands)
gst_buffer_unref (qtdemux->comp_brands); gst_buffer_unref (qtdemux->comp_brands);
qtdemux->comp_brands = NULL; qtdemux->comp_brands = NULL;
...@@ -3272,6 +3273,7 @@ qtdemux_parse_trun (GstQTDemux * qtdemux, GstByteReader * trun, ...@@ -3272,6 +3273,7 @@ qtdemux_parse_trun (GstQTDemux * qtdemux, GstByteReader * trun,
* size, else we will still be able to use this when dealing with gap'ed * size, else we will still be able to use this when dealing with gap'ed
* input */ * input */
qtdemux->mdatleft = *running_offset - initial_offset; qtdemux->mdatleft = *running_offset - initial_offset;
qtdemux->mdatsize = qtdemux->mdatleft;
stream->n_samples += samples_count; stream->n_samples += samples_count;
stream->n_samples_moof += samples_count; stream->n_samples_moof += samples_count;
...@@ -6264,8 +6266,9 @@ gst_qtdemux_chain (GstPad * sinkpad, GstObject * parent, GstBuffer * inbuf) ...@@ -6264,8 +6266,9 @@ gst_qtdemux_chain (GstPad * sinkpad, GstObject * parent, GstBuffer * inbuf)
demux->streams[i]->sample_index = res; demux->streams[i]->sample_index = res;
/* Finally update all push-based values to the expected values */ /* Finally update all push-based values to the expected values */
demux->neededbytes = demux->streams[i]->samples[res].size; demux->neededbytes = demux->streams[i]->samples[res].size;
demux->todrop = 0;
demux->offset = GST_BUFFER_OFFSET (inbuf); demux->offset = GST_BUFFER_OFFSET (inbuf);
demux->mdatleft = demux->mdatsize - demux->offset;
demux->todrop = 0;
} }
} }
} }
...@@ -6359,6 +6362,7 @@ gst_qtdemux_process_adapter (GstQTDemux * demux, gboolean force) ...@@ -6359,6 +6362,7 @@ gst_qtdemux_process_adapter (GstQTDemux * demux, gboolean force)
demux->state = QTDEMUX_STATE_MOVIE; demux->state = QTDEMUX_STATE_MOVIE;
demux->neededbytes = next_entry; demux->neededbytes = next_entry;
demux->mdatleft = size; demux->mdatleft = size;
demux->mdatsize = demux->mdatleft;
} else { } else {
/* no headers yet, try to get them */ /* no headers yet, try to get them */
guint bs; guint bs;
...@@ -6661,6 +6665,7 @@ gst_qtdemux_process_adapter (GstQTDemux * demux, gboolean force) ...@@ -6661,6 +6665,7 @@ gst_qtdemux_process_adapter (GstQTDemux * demux, gboolean force)
demux->neededbytes = next_entry_size (demux); demux->neededbytes = next_entry_size (demux);
demux->state = QTDEMUX_STATE_MOVIE; demux->state = QTDEMUX_STATE_MOVIE;
demux->mdatleft = gst_adapter_available (demux->adapter); demux->mdatleft = gst_adapter_available (demux->adapter);
demux->mdatsize = demux->mdatleft;
} else { } else {
GST_DEBUG_OBJECT (demux, "Carrying on normally"); GST_DEBUG_OBJECT (demux, "Carrying on normally");
gst_adapter_flush (demux->adapter, demux->neededbytes); gst_adapter_flush (demux->adapter, demux->neededbytes);
......
...@@ -165,7 +165,7 @@ struct _GstQTDemux { ...@@ -165,7 +165,7 @@ struct _GstQTDemux {
/* Used to store data if [mdat] is before the headers */ /* Used to store data if [mdat] is before the headers */
GstBuffer *mdatbuffer; GstBuffer *mdatbuffer;
/* Amount of bytes left to read in the current [mdat] */ /* Amount of bytes left to read in the current [mdat] */
guint64 mdatleft; guint64 mdatleft, mdatsize;
/* When restoring the mdat to the adapter, this buffer stores any /* When restoring the mdat to the adapter, this buffer stores any
* trailing data that was after the last atom parsed as it has to be * trailing data that was after the last atom parsed as it has to be
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment