summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorllyyr <llyyr.public@gmail.com>2023-08-31 15:20:32 +0530
committerDudemanguy <random342@airmail.cc>2023-09-02 19:02:21 +0000
commite6afc53e7cabf7d36aab4a8b25a6e2688e4449c8 (patch)
tree1f8e36de1605abd9cd98ef152032fd6d64c1380c /video
parent1bf6abc62d2ac09745c0764328de22335cd93ec0 (diff)
downloadmpv-e6afc53e7cabf7d36aab4a8b25a6e2688e4449c8.tar.bz2
mpv-e6afc53e7cabf7d36aab4a8b25a6e2688e4449c8.tar.xz
demux_lavf: get total duration from track durations
Before this change, mpv used to get the total duration from `avformat_find_stream_info` and used the per-track duration as a fallback. This change reverses this order of preference. The timestamps returned by `avformat_find_stream_info` are truncated or rounded or floored (depending on the decoder) at the 6th decimal place. For e.g. `avformat_find_stream_info` may return us a duration like 44.138667, whereas the duration we get from the per-track struct has a higher degree of precision like 44.13866666666... and so on. This caused various problems such as the playback_pts being a bigger value than the duration, which would cause time-remaining to be a negative value in some cases. Or cause you to reach a negative starting timestamp when looping on an audio file with `gapless-audio`. Moreover, we already skipped calling `avformat_find_stream_info` for mp4, so we had already been utilizing this per-track fallback method for finding the duration for mp4 files. It should be noted that while this change is only required for audio-only formats, there is no harm in doing this for videos as well.
Diffstat (limited to 'video')
0 files changed, 0 insertions, 0 deletions