]> git.sesse.net Git - ffmpeg/commit
avformat/matroskaenc: Don't fail if reserved Cues space doesn't suffice
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 30 Dec 2019 15:28:39 +0000 (16:28 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Thu, 2 Apr 2020 17:22:51 +0000 (19:22 +0200)
commit06f108907d75bae89a568eda02e188a91deb4ec9
tree09975a06e79ede6ba7ff350f856cce1cc7f011d0
parent8e1354c95d05a64bf5b99317387fca0ebdb4cd41
avformat/matroskaenc: Don't fail if reserved Cues space doesn't suffice

When the user opted to write the Cues at the beginning, the Cues were
simply written without checking in advance whether enough space has been
reserved for them. If it wasn't enough, the data following the space
reserved for the Cues was simply overwritten, corrupting the file.

This commit changes this by checking whether enough space has been
reserved for the Cues before outputting anything. If it isn't enough,
no Cues will be output at all and the file will be finalized normally,
yet writing the trailer will nevertheless return an error to notify
the user that his wish of having Cues at the front of the file hasn't
been fulfilled.

This change opens new usecases for this option: It is now safe to use
this option to e.g. record live streams or to use it when muxing the
output of an expensive encoding, because when the reserved space turns
out to be insufficient, one ends up with a file that just lacks Cues
but is otherwise fine.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
doc/muxers.texi
libavformat/matroskaenc.c