Skip to content

qtdemux: Always use `tfdt` if available in BYTE segments

Sebastian Dröge requested to merge slomo/gstreamer:qtdemux-always-use-tfdt into main

This reverts the decision from where it was decided that we rather play safe and only use the tfdt if it is "significantly different" to the sum of sample durations.

As the specification says

If the time expressed in the track fragment decode time (‘tfdt’) box
exceeds the sum of the durations of the samples in the preceding
movie and movie fragments, then the duration of the last sample
preceding this track fragment is extended such that the sum now
equals the time given in this box.

we have to use the tfdt in general to allow for it to signal gaps in the stream.

A muxer producing fragments might not yet know the full duration of the last sample of a previous fragment if the next fragment starts with a gap, and knowing the actual start of the next fragment would potentially require to violate latency requirements.

Additionally, the existence of tfdt allows to avoid accumulating rounding errors from summing up the durations.

Or in short, @eocanha was absolutely right back then in the Bugzilla discussion :)

CC @thiblahute @thaytan @calvaris @eocanha

Merge request reports