diff options
author | Thiago Santos <thiagoss@osg.samsung.com> | 2015-07-08 21:02:24 +0300 |
---|---|---|
committer | Thiago Santos <thiagoss@osg.samsung.com> | 2015-07-09 05:23:53 +0300 |
commit | 30b3aa30300403f0f64df505d9c368c2e212e046 (patch) | |
tree | cef315151cebbfd6c878116742f9ea2f4494dbe1 | |
parent | 38520a1e122928030b69374b88b8888cc556bab3 (diff) |
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.
-rw-r--r-- | gst/isomp4/qtdemux.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c index 920fc644a..8153abb7f 100644 --- a/gst/isomp4/qtdemux.c +++ b/gst/isomp4/qtdemux.c @@ -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); |