tsdemux: ignore sparse stream when checking for initial timestamp

Unless we only have sparse streams. In this case we will consider them.
It fixes a bug happening when first observed timestamp comes from a
sparse stream and other streams don't have a valid timestamp, yet. Thus
leading the timestamp from sparse stream to be the start of the
following segment. In this case, if the timestamp is really bigger than
non-sparse stream (audio/video), it will lead the pipeline to clip
samples from the non-parse stream.

https://bugzilla.gnome.org/show_bug.cgi?id=744469
This commit is contained in:
Aurélien Zanelli 2015-03-16 16:20:44 +01:00 committed by Jan Schmidt
parent 1b6cc98aa5
commit 89a85732d4

View file

@ -2119,15 +2119,28 @@ check_pending_buffers (GstTSDemux * demux)
/* The biggest offset */
guint64 offset = 0;
GList *tmp;
gboolean have_only_sparse = TRUE;
/* 0. Do we only have sparse stream */
for (tmp = demux->program->stream_list; tmp; tmp = tmp->next) {
TSDemuxStream *tmpstream = (TSDemuxStream *) tmp->data;
if (!tmpstream->sparse) {
have_only_sparse = FALSE;
break;
}
}
/* 1. Go over all streams */
for (tmp = demux->program->stream_list; tmp; tmp = tmp->next) {
TSDemuxStream *tmpstream = (TSDemuxStream *) tmp->data;
/* 1.1 check if at least one stream got a valid DTS */
if ((tmpstream->raw_dts != -1 && tmpstream->dts != GST_CLOCK_TIME_NONE) ||
(tmpstream->raw_pts != -1 && tmpstream->pts != GST_CLOCK_TIME_NONE)) {
have_observation = TRUE;
break;
if (have_only_sparse || !tmpstream->sparse) {
if ((tmpstream->raw_dts != -1 && tmpstream->dts != GST_CLOCK_TIME_NONE) ||
(tmpstream->raw_pts != -1 && tmpstream->pts != GST_CLOCK_TIME_NONE)) {
have_observation = TRUE;
break;
}
}
}