[FFmpeg-devel] ABI break in 4.3

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Sun Jul 5 02:38:09 EEST 2020


Michael Niedermayer:
> On Sun, Jul 05, 2020 at 12:54:53AM +0200, Jan Engelhardt wrote:
>> Greetings.
>>
>>
>> Between ffmpeg-4.2.3 and ffmpeg-4.3, struct AVCodecContext,
>> publicly exposed through /usr/include, has been changed thus:
>>
>> --- avcodec.h 2020-06-11 11:45:16.000000000 +0200
>> +++ avcodec.h 2020-07-01 03:45:24.000000000 +0200
>> @@ -3370,6 +2334,24 @@ typedef struct AVCodecContext {
>>       * - encoding: unused
>>       */
>>      int discard_damaged_percentage;
>> +
>> +    /**
>> +     * The number of samples per frame to maximally accept.
>> +     *
>> +     * - decoding: set by user
>> +     * - encoding: set by user
>> +     */
>> +    int64_t max_samples;
>> +
>> +    /**
>> +     * Bit set of AV_CODEC_EXPORT_DATA_* flags, which affects the kind of
>> +     * metadata exported in frame, packet, or coded stream side data by
>> +     * decoders and encoders.
>> +     *
>> +     * - decoding: set by user
>> +     * - encoding: set by user
>> +     */
>> +    int export_side_data;
>>  } AVCodecContext;
>>  
>>  #if FF_API_CODEC_GET_SET
>>
>>
>> Second, struct AVDCT, which is publicly exposed through /usr/include, has been
>> changed:
>>
>> --- avdct.h   2020-06-11 11:45:16.000000000 +0200
>> +++ avdct.h   2020-07-01 03:45:24.000000000 +0200
>> @@ -67,6 +67,10 @@ typedef struct AVDCT {
>>                         ptrdiff_t line_size);
>>  
>>      int bits_per_sample;
>> +
>> +    void (*get_pixels_unaligned)(int16_t *block /* align 16 */,
>> +                       const uint8_t *pixels,
>> +                       ptrdiff_t line_size);
>>  } AVDCT;
>>  
>>  /**
>>
>>
>> The abidiff(1) utility confirms this situation such:
>>
>> $ abidiff b42/usr/lib/debug/usr/lib64/libavcodec.so.58.54.100-4.2.3-1.1.x86_64.debug \
>>           b43/usr/lib/debug/usr/lib64/libavcodec.so.58.91.100-4.3-136.2.x86_64.debug
>>
>>   [...] in pointed to type 'struct AVCodecContext' at avcodec.h:526:1:
>>                      type size changed from 8448 to 8576 (in bits)
>>   [...]
>>         underlying type 'struct AVDCT' at avdct.h:29:1 changed:
>>           type size changed from 896 to 960 (in bits)
>>
>>
>> These struct changes constitute an ABI break, and ABI breaks require SO version
>> bumps, but which was not done for 4.3. This is bad.
> 
> Quoting the AVCodecContext documentation from FFmpeg 4.2.3
> 
> /**
>  * main external API structure.
>  * New fields can be added to the end with minor version bumps.
>  * Removal, reordering and changes to existing fields require a major
>  * version bump.
>  * You can use AVOptions (av_opt* / av_set/get*()) to access these fields from user
>  * applications.
>  * The name string for AVOptions options matches the associated command line
>  * parameter name and can be found in libavcodec/options_table.h
>  * The AVOption/command line parameter names differ in some cases from the C
>  * structure field names for historic reasons or brevity.
>  * sizeof(AVCodecContext) must not be used outside libav*.
>  */
> typedef struct AVCodecContext {
> 
> 
>>
>> A user has summarily reported crashes through {not a proper bug reporting
>> medium} already.
>> https://build.opensuse.org/package/show/multimedia:libs/ffmpeg-4
> 
> have you identified what exactly causes the crashes ?
> 
This is the user report:

"Unfortunately, this version is binary incompatible to 4.2.3 in some
aspects. Chromium crashes when accessing some sites, e.g.
https://www.xometry.com/ and push the quote button. Blender cannot
export PNG files anymore."

This crash is due to Chromium using av_max_alloc in an undocumented way;
more exactly, the Chromium FFmpeg fork changes the allocation functions
so that if max_alloc_size is zero, the limit is completely disabled; and
of course it also sets the limit to zero. Up until 4.2, this worked with
a normal FFmpeg, because FFmpeg didn't max_alloc_size as is, but instead
max_alloc_size - 32. But since 731c77589841c02e014aa7f8285dcfc8b20f2ee5
this is no longer so. The relevant chromium bug is at
https://bugs.chromium.org/p/chromium/issues/detail?id=1095962

I don't know what the issue with Blender is.

- Andreas


More information about the ffmpeg-devel mailing list