qtdemux: Use the timestamp of the moof as the base fragment start

In SmoothStreaming fragmented scenario, the timestamps are calculated
starting from the fragment buffer timestamp. When there is a not-linked
return from downstream, qtdemux will return upstream and will keep the
non-pushed data into its adapter.

On a new fragment buffer pushed to qtdemux, the new buffer timestamp
would overwrite the previous one that should be used on the still
to be pushed buffers. Because of this, this patch will also
update the fragment_start timestamp from the adapter last pts
to make sure the moof and timestamps are in sync and will result
in correct timestamps for all fragments.
This commit is contained in:
Thiago Santos 2013-11-29 11:26:05 -03:00
parent 45c16599ff
commit 079dde49ed

View file

@ -4787,6 +4787,10 @@ gst_qtdemux_chain (GstPad * sinkpad, GstObject * parent, GstBuffer * inbuf)
} else if (fourcc == FOURCC_moof) {
if ((demux->got_moov || demux->media_caps) && demux->fragmented) {
GST_DEBUG_OBJECT (demux, "Parsing [moof]");
/* the timestamp of the moof buffer is relevant as some scenarios
* won't have the initial timestamp in the atoms */
demux->fragment_start = gst_adapter_prev_pts (demux->adapter, NULL);
if (!qtdemux_parse_moof (demux, data, demux->neededbytes,
demux->offset, NULL)) {
gst_adapter_unmap (demux->adapter);