mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 22:36:33 +00:00
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.
This commit is contained in:
parent
38520a1e12
commit
30b3aa3030
1 changed files with 16 additions and 11 deletions
|
@ -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;
|
||||
} else {
|
||||
/* set up for EOS */
|
||||
if (demux->upstream_format_is_time) {
|
||||
demux->neededbytes = 16;
|
||||
} else {
|
||||
demux->neededbytes = -1;
|
||||
}
|
||||
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 {
|
||||
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;
|
||||
}
|
||||
}
|
||||
exit:
|
||||
gst_event_unref (event);
|
||||
|
|
Loading…
Reference in a new issue