[FFmpeg-devel] [PATCH 1/3] avformat/matroskaenc: Don't use stream side-data size

James Almer jamrial at gmail.com
Fri May 22 06:35:37 EEST 2020


On 5/22/2020 12:31 AM, James Almer wrote:
> On 5/21/2020 10:24 PM, Andreas Rheinhardt wrote:
>> 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.
> 
> Sounds like something that should be fixed instead.
> av_packet_get_side_data() sets the size argument to 0 if it doesn't find
> the requested side data type. This function should do the same.

Right, you did as much in patch 3/3.

This patch is worth applying either way seeing it removes things like
the API violating usage of sizeof(AVMasteringDisplayMetadata), so LGTM.


More information about the ffmpeg-devel mailing list