On 6/1/2020 2:17 PM, Andreas Rheinhardt wrote:
> James Almer:
>> Signed-off-by: James Almer <jamr...@gmail.com>
>> ---
>> As mentioned in Patch 1/2, this is an example for the complex structure
>> handling in AVBufferRef.
>> It doesn't need to be applied, even if it could (Despite being public, it's 
>> new
>> enough that we can change it if we do it now).
>>
>>  libavutil/video_enc_params.c | 37 ++++++++++++++++++--
>>  libavutil/video_enc_params.h | 67 ++++++++++++++++++------------------
>>  2 files changed, 68 insertions(+), 36 deletions(-)
>>
>> diff --git a/libavutil/video_enc_params.c b/libavutil/video_enc_params.c
>> index c46c0f1dc6..9e64ad4d59 100644
>> --- a/libavutil/video_enc_params.c
>> +++ b/libavutil/video_enc_params.c
>> @@ -32,6 +32,9 @@ AVVideoEncParams *av_video_enc_params_alloc(enum 
>> AVVideoEncParamsType type,
>>      AVVideoEncParams *par;
>>      size_t size;
>>  
>> +    // Ensure blocks is the last field in the struct
>> +    av_assert0(offsetof(AVVideoEncParams, blocks) == sizeof(*par) - 
>> sizeof(AVVideoBlockParams*));
>> +
> This check only works if blocks is the last field in the struct and if
> there is no padding after blocks (e.g. if AVVideoEncParams contained any
> [u]int64_t, then one could run into this assert even when blocks were
> the last element (namely when one is on a 32bit system)).

There are no [u]int64_t fields in the struct, but i guess it's better to
be safe than sorry, so a notice in the header might just be enough instead.
It's after all aimed at libav* developers rather than users.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to