qtdemux: fix buggy duration in edits with duration=0 in fragmented files without a mehd

https://bugzilla.gnome.org/show_bug.cgi?id=794858
This commit is contained in:
Alicia Boya García 2018-03-31 17:19:03 +02:00 committed by Thibault Saunier
parent db688c5504
commit ee78825eae

View file

@ -9476,21 +9476,20 @@ qtdemux_parse_segments (GstQTDemux * qtdemux, QtDemuxStream * stream,
/* time and duration expressed in global timescale */
segment->time = stime;
/* add non scaled values so we don't cause roundoff errors */
if (duration || media_start == GST_CLOCK_TIME_NONE) {
if (duration != 0 || empty_edit) {
/* edge case: empty edits with duration=zero are treated here.
* (files should not have these anyway). */
/* add non scaled values so we don't cause roundoff errors */
time += duration;
stime = QTTIME_TO_GSTTIME (qtdemux, time);
segment->duration = stime - segment->time;
} else {
/* zero duration does not imply media_start == media_stop
* but, only specify media_start.*/
stime = QTTIME_TO_GSTTIME (qtdemux, qtdemux->duration);
if (GST_CLOCK_TIME_IS_VALID (stime) && !empty_edit
&& stime >= media_start) {
segment->duration = stime - media_start;
} else {
segment->duration = GST_CLOCK_TIME_NONE;
}
* but, only specify media_start. The edit ends with the track. */
stime = segment->duration = GST_CLOCK_TIME_NONE;
/* Don't allow more edits after this one. */
n_segments = segment_number + 1;
}
segment->stop_time = stime;
@ -9498,7 +9497,8 @@ qtdemux_parse_segments (GstQTDemux * qtdemux, QtDemuxStream * stream,
/* media_time expressed in stream timescale */
if (!empty_edit) {
segment->media_start = media_start;
segment->media_stop = segment->media_start + segment->duration;
segment->media_stop = GST_CLOCK_TIME_IS_VALID (segment->duration)
? segment->media_start + segment->duration : GST_CLOCK_TIME_NONE;
media_segments_count++;
} else {
segment->media_start = GST_CLOCK_TIME_NONE;