qtmux: handle overlapping subtitle buffers properly
@Knopp
Submitted by Matej Link to original bug (#741306)
Description
Overlapping subtitle buffers (buffers that start before previous buffer ends) are legal in many containers (i.e. MKV), but can not be represented in MP4. Trying to remux such file currently results in invalid file, because timestamp delta between buffer end time and next buffer start time is negative
In order to handle this well, the muxer should split and combine buffers in a way so that no information is lost. I.e. Two overlapping input buffers should be muxed as three separate buffers, with second buffer combining content from both input buffers.
[=======Buffer In 1========]
[=======Buffer In 2========]
[Buffer Out 1][Buffer Out 2][Buffer Out 3]
Sample MKV file with overlapped subtitles
https://s3.amazonaws.com/MatejK/Samples/OverlappedSubtitles.mkv
Remuxed file without the patch
https://s3.amazonaws.com/MatejK/Samples/OverlappedSubtitlesWithoutPatch.mp4
Remuxed file with the patch
https://s3.amazonaws.com/MatejK/Samples/OverlappedSubtitlesWithPatch.mp4