[FFmpeg-devel] [PATCH v3] avformat/matroskaenc: Use random TrackUID

Michael Niedermayer michael at niedermayer.cc
Wed Dec 4 20:58:23 EET 2019

On Tue, Dec 03, 2019 at 04:19:47PM +0100, Andreas Rheinhardt wrote:
> Up until now, the TrackUID of a Matroska track which is supposed to be
> random was not random at all: It always coincided with the TrackNumber
> which is usually the 1-based index of the corresponding stream in the
> array of AVStreams. This has been changed: It is now set via an AVLFG
> if AVFMT_FLAG_BITEXACT is not set. Otherwise it is set like it is set
> now (the only change happens if an explicit track number has been
> chosen via dash_track_number, because the system used in the normal
> situation is now used, too). In particular, no FATE tests need to be
> updated.
> This also fixes a bug in case the dash_track_number option was used:
> In this case the TrackUID was set to the track number, but the tags were
> written with a TagTrackUID simply based upon the index, so that the tags
> didn't apply to the track they ought to apply to.


> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
> ---
> I have updated the patchset to rely on the AVLFG to provide sufficiently
> many distinct values, as you said. I could add a check and a for if we still
> have a collision after (say) 1000 tries in order to avoid the
> potentially infinite loop.

You could replace the LFG if you dont trust it.
But i dont understand why you would use it when you dont trust it and then
add a check


Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20191204/cde4710e/attachment.sig>

More information about the ffmpeg-devel mailing list