]> git.sesse.net Git - ffmpeg/commit
avformat/matroskaenc: Make output more deterministic
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sun, 29 Dec 2019 09:20:42 +0000 (10:20 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 13 Apr 2020 06:43:14 +0000 (08:43 +0200)
commitccadd00a4a720979c6d4cedb52713c2585dd5b03
treef979aea0664a60412fc10ed2dc7d665d5af0225d
parent358b58cb290defe706dd2f5bae96b29321059dfe
avformat/matroskaenc: Make output more deterministic

Using random values for TrackUID and FileUID (as happens when the
AVFMT_FLAG_BITEXACT flag is not set) has the obvious downside of making
the output indeterministic. This commit mitigates this by writing the
potentially random values with a fixed size of eight byte, even if their
actual values would fit into less than eight bytes. This ensures that
even in non-bitexact mode, the differences between two files generated
with the same settings are restricted to a few bytes in the header.
(Namely the SegmentUID, the TrackUIDs (in Tracks as well as when
referencing them via TagTrackUID), the FileUIDs (in Attachments as
well as in TagAttachmentUID) as well as the CRC-32 checksums of the
Info, Tracks, Attachments and Tags level-1-elements.) Without this
patch, there might be an offset/a size difference between two such
files.

The FATE-tests had to be updated because the fixed-sized UIDs are also
used in bitexact mode.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
12 files changed:
libavformat/matroskaenc.c
tests/fate/matroska.mak
tests/fate/wavpack.mak
tests/ref/fate/aac-autobsf-adtstoasc
tests/ref/fate/binsub-mksenc
tests/ref/fate/matroska-flac-extradata-update
tests/ref/fate/rgb24-mkv
tests/ref/lavf-fate/av1.mkv
tests/ref/lavf/mka
tests/ref/lavf/mkv
tests/ref/lavf/mkv_attachment
tests/ref/seek/lavf-mkv