Commit 30b3aa30 authored by Thiago Santos's avatar Thiago Santos

qtdemux: rework segment event handling for adaptive streaming

When a new time segment is received upstream is going to restart
with a new atom. Make the neededbytes and todrop variables
reflect that to avoid waiting too much or dropping the
initial bytes that contain the header.
parent 38520a1e
......@@ -2029,20 +2029,25 @@ gst_qtdemux_handle_sink_event (GstPad * sinkpad, GstObject * parent,
/* clear leftover in current segment, if any */
gst_adapter_clear (demux->adapter);
/* set up streaming thread */
gst_qtdemux_find_sample (demux, offset, TRUE, TRUE, &stream, &idx, NULL);
demux->offset = offset;
if (stream) {
demux->todrop = stream->samples[idx].offset - offset;
demux->neededbytes = demux->todrop + stream->samples[idx].size;
if (demux->upstream_format_is_time) {
GST_DEBUG_OBJECT (demux, "Upstream is driving in time format, "
"set values to restart reading from a new atom");
demux->neededbytes = 16;
demux->todrop = 0;
} else {
/* set up for EOS */
if (demux->upstream_format_is_time) {
demux->neededbytes = 16;
gst_qtdemux_find_sample (demux, offset, TRUE, TRUE, &stream, &idx,
NULL);
if (stream) {
demux->todrop = stream->samples[idx].offset - offset;
demux->neededbytes = demux->todrop + stream->samples[idx].size;
} else {
/* set up for EOS */
demux->neededbytes = -1;
demux->todrop = 0;
}
demux->todrop = 0;
}
exit:
gst_event_unref (event);
......
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