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