qtdemux: avoid crashing on dash streams

DASH/fragmented moov might have no samples as those are carried
in moof fragments. Avoid crashing or failing the stream because
of that.
This commit is contained in:
Thiago Santos 2014-08-18 14:05:52 -03:00
parent 67255c6b49
commit fa103ca5ad

View file

@ -9053,14 +9053,16 @@ qtdemux_prepare_streams (GstQTDemux * qtdemux)
}
/* parse the initial sample for use in setting the frame rate cap */
while (sample_num == 0) {
while (sample_num == 0 && sample_num < stream->n_samples) {
if (!qtdemux_parse_samples (qtdemux, stream, sample_num))
break;
++sample_num;
}
stream->first_duration = stream->samples[0].duration;
GST_LOG_OBJECT (qtdemux, "stream %d first duration %u",
stream->track_id, stream->first_duration);
if (stream->n_samples > 0 && stream->stbl_index > 0) {
stream->first_duration = stream->samples[0].duration;
GST_LOG_OBJECT (qtdemux, "stream %d first duration %u",
stream->track_id, stream->first_duration);
}
}
return ret;