[FFmpeg-devel] ABI break in 4.3

James Almer jamrial at gmail.com
Sun Jul 5 02:04:02 EEST 2020


On 7/4/2020 7:54 PM, 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.
> 
> A user has summarily reported crashes through {not a proper bug reporting
> medium} already.
> https://build.opensuse.org/package/show/multimedia:libs/ffmpeg-4

Neither of these are breaks as sizeof(AVCodecContext) and sizeof(AVDCT)
are not part of the ABI. Both structs are meant to be allocated using
avcodec_alloc_context3() and avcodec_dct_alloc() respectively, and not
stored on stack or allocated with av_malloc(sizeof()).

Fields can be added at the end of such structs without the need for a
soname bump and remain backwards compatible. A break would be adding a
field in the middle of such structs, moving the offset of other fields,
and that's not what happened here.


More information about the ffmpeg-devel mailing list