mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-22 23:28:16 +00:00
qtdemux: Fix rounding errors in duration update
Make sure we store updated segment stop/duration with the same granularity as the duration timescale. And add more debug
This commit is contained in:
parent
b40cfcfffb
commit
9a903c994f
1 changed files with 13 additions and 4 deletions
|
@ -2461,18 +2461,27 @@ check_update_duration (GstQTDemux * qtdemux, GstClockTime duration)
|
||||||
movdur = gst_util_uint64_scale (duration, qtdemux->timescale, GST_SECOND);
|
movdur = gst_util_uint64_scale (duration, qtdemux->timescale, GST_SECOND);
|
||||||
|
|
||||||
if (movdur > qtdemux->duration) {
|
if (movdur > qtdemux->duration) {
|
||||||
GST_DEBUG_OBJECT (qtdemux, "Updating total duration to %" GST_TIME_FORMAT,
|
|
||||||
GST_TIME_ARGS (duration));
|
|
||||||
prevdur =
|
prevdur =
|
||||||
gst_util_uint64_scale (qtdemux->duration, GST_SECOND,
|
gst_util_uint64_scale (qtdemux->duration, GST_SECOND,
|
||||||
qtdemux->timescale);
|
qtdemux->timescale);
|
||||||
|
GST_DEBUG_OBJECT (qtdemux,
|
||||||
|
"Updating total duration to %" GST_TIME_FORMAT " was %" GST_TIME_FORMAT,
|
||||||
|
GST_TIME_ARGS (duration), GST_TIME_ARGS (prevdur));
|
||||||
qtdemux->duration = movdur;
|
qtdemux->duration = movdur;
|
||||||
|
GST_DEBUG_OBJECT (qtdemux,
|
||||||
|
"qtdemux->segment.duration: %" GST_TIME_FORMAT " .stop: %"
|
||||||
|
GST_TIME_FORMAT, GST_TIME_ARGS (qtdemux->segment.duration),
|
||||||
|
GST_TIME_ARGS (qtdemux->segment.stop));
|
||||||
if (qtdemux->segment.duration == prevdur) {
|
if (qtdemux->segment.duration == prevdur) {
|
||||||
/* If the current segment has duration/stop identical to previous duration
|
/* If the current segment has duration/stop identical to previous duration
|
||||||
* update them also (because they were set at that point in time with
|
* update them also (because they were set at that point in time with
|
||||||
* the wrong duration */
|
* the wrong duration */
|
||||||
qtdemux->segment.duration = duration;
|
/* We convert the value *from* the timescale version to avoid rounding errors */
|
||||||
qtdemux->segment.stop = duration;
|
GstClockTime fixeddur =
|
||||||
|
gst_util_uint64_scale (movdur, GST_SECOND, qtdemux->timescale);
|
||||||
|
GST_DEBUG_OBJECT (qtdemux, "Updated segment.duration and segment.stop");
|
||||||
|
qtdemux->segment.duration = fixeddur;
|
||||||
|
qtdemux->segment.stop = fixeddur;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = 0; i < qtdemux->n_streams; i++) {
|
for (i = 0; i < qtdemux->n_streams; i++) {
|
||||||
|
|
Loading…
Reference in a new issue