]> git.sesse.net Git - ffmpeg/commit
avformat/matroskaenc: Don't use stream side-data size
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Thu, 21 May 2020 21:10:51 +0000 (23:10 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Fri, 22 May 2020 04:30:56 +0000 (06:30 +0200)
commit68dd1e6a57c8645656278b70f870a85e3789ec27
treedd121ce26cefa1b641bdcd4cc02a1cf51adb814f
parentd29c42974487d5fa0a5c1b05a09da5c5818ab63e
avformat/matroskaenc: Don't use stream side-data size

av_stream_get_side_data() tells the caller whether a stream has side
data of a specific type; if present it can also tell the caller the size
of the side data via an optional argument. The Matroska muxer always
used this optional argument, although it doesn't really need the size,
as the relevant side-data are not buffers, but structures. So change
this.

Furthermore, relying on the size also made the code susceptible to
a quirk of av_stream_get_side_data(): It only sets the size argument if
it found side data of the desired type. mkv_write_video_color() checks
for side-data twice with the same variable for the size without resetting
the size in between; if the second type of side-data isn't present, the
size will still be what it was after the first call. This was not
dangerous in practice, as the check for the existence of the second
side-data compared the size with the expected size, so it would only be
problematic if lots of elements were to be added to AVContentLightMetadata.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavformat/matroskaenc.c