mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-08-11 17:46:39 +00:00
If streams are badly interleaved, then the readrate logic can end up accumulating an ever-growing lag. Rather than looping over each stream and sleeping for each stream individually based on the local DTS and lag logic, pull the sleep out of the loop and only sleep once based on the furthest-behind stream (i.e. the stream contributing the lowest sleep duration). To reproduce: $ ./ffmpeg -re -i fallbeatcaptiontest.mp4 -c copy -f null -t 10 - Before this commit, this would run at ~0.7x and accumulate an infinitely growing lag in one stream. After this commit, both streams run at ~1x as expected, after an initial burst period due to the bad (1s granularity) interleaving. Signed-off-by: Niklas Haas <git@haasn.dev>