With the way the runtime checks are currently set up, every single openh264 release, no matter how minor, is considered an ABI break and requires ffmpeg recompilation. This is unnecessarily strict because it doesn't allow downstream distributions to ship any openh264 bug fix version updates without breaking ffmpeg's openh264 support. Years ago, at the time when ffmpeg's openh264 support was merged, openh264 releases were done without a versioned soname (the library was just libopenh264.so, unversioned). Since then, starting with version 1.3.0, openh264 has started using versioned sonames and the intent has been to bump the soname every time there's a new release with an ABI change. This patch drops the exact version check and instead adds a minimum requirement on 1.3.0 to the configure script.
Showing the changes to libavcodec (4 of 5 files). Show all
Unified · Split
| @@ -46,18 +46,3 @@ void ff_libopenh264_trace_callback(void *ctx, int level, const char *msg) · 45 unmodified lines | |||
| 46 | int equiv_ffmpeg_log_level = libopenh264_to_ffmpeg_log_level(level); | 46 | int equiv_ffmpeg_log_level = libopenh264_to_ffmpeg_log_level(level); |
| 47 | av_log(ctx, equiv_ffmpeg_log_level, "%s\n", msg); | 47 | av_log(ctx, equiv_ffmpeg_log_level, "%s\n", msg); |
| 48 | } | 48 | } |
| 49 | |||
| 50 | int ff_libopenh264_check_version(void *logctx) | ||
| 51 | { | ||
| 52 | // Mingw GCC < 4.7 on x86_32 uses an incorrect/buggy ABI for the WelsGetCodecVersion | ||
| 53 | // function (for functions returning larger structs), thus skip the check in those | ||
| 54 | // configurations. | ||
| 55 | #if !defined(_WIN32) || !defined(__GNUC__) || !ARCH_X86_32 || AV_GCC_VERSION_AT_LEAST(4, 7) | ||
| 56 | OpenH264Version libver = WelsGetCodecVersion(); | ||
| 57 | if (memcmp(&libver, &g_stCodecVersion, sizeof(libver))) { | ||
| 58 | av_log(logctx, AV_LOG_ERROR, "Incorrect library version loaded\n"); | ||
| 59 | return AVERROR(EINVAL); | ||
| 60 | } | ||
| 61 | #endif | ||
| 62 | return 0; | ||
| 63 | } | ||
| @@ -34,6 +34,4 @@ · 33 unmodified lines | |||
| 34 | 34 | ||
| 35 | void ff_libopenh264_trace_callback(void *ctx, int level, const char *msg); | 35 | void ff_libopenh264_trace_callback(void *ctx, int level, const char *msg); |
| 36 | 36 | ||
| 37 | int ff_libopenh264_check_version(void *logctx); | ||
| 38 | |||
| 39 | #endif /* AVCODEC_LIBOPENH264_H */ | 37 | #endif /* AVCODEC_LIBOPENH264_H */ |
| @@ -52,13 +52,9 @@ static av_cold int svc_decode_init(AVCodecContext *avctx) · 51 unmodified lines | |||
| 52 | { | 52 | { |
| 53 | SVCContext *s = avctx->priv_data; | 53 | SVCContext *s = avctx->priv_data; |
| 54 | SDecodingParam param = { 0 }; | 54 | SDecodingParam param = { 0 }; |
| 55 | int err; | ||
| 56 | int log_level; | 55 | int log_level; |
| 57 | WelsTraceCallback callback_function; | 56 | WelsTraceCallback callback_function; |
| 58 | 57 | ||
| 59 | if ((err = ff_libopenh264_check_version(avctx)) < 0) | ||
| 60 | return AVERROR_DECODER_NOT_FOUND; | ||
| 61 | |||
| 62 | if (WelsCreateDecoder(&s->decoder)) { | 58 | if (WelsCreateDecoder(&s->decoder)) { |
| 63 | av_log(avctx, AV_LOG_ERROR, "Unable to create decoder\n"); | 59 | av_log(avctx, AV_LOG_ERROR, "Unable to create decoder\n"); |
| 64 | return AVERROR_UNKNOWN; | 60 | return AVERROR_UNKNOWN; |
| @@ -110,14 +110,10 @@ static av_cold int svc_encode_init(AVCodecContext *avctx) · 109 unmodified lines | |||
| 110 | { | 110 | { |
| 111 | SVCContext *s = avctx->priv_data; | 111 | SVCContext *s = avctx->priv_data; |
| 112 | SEncParamExt param = { 0 }; | 112 | SEncParamExt param = { 0 }; |
| 113 | int err; | ||
| 114 | int log_level; | 113 | int log_level; |
| 115 | WelsTraceCallback callback_function; | 114 | WelsTraceCallback callback_function; |
| 116 | AVCPBProperties *props; | 115 | AVCPBProperties *props; |
| 117 | 116 | ||
| 118 | if ((err = ff_libopenh264_check_version(avctx)) < 0) | ||
| 119 | return AVERROR_ENCODER_NOT_FOUND; | ||
| 120 | |||
| 121 | if (WelsCreateSVCEncoder(&s->encoder)) { | 117 | if (WelsCreateSVCEncoder(&s->encoder)) { |
| 122 | av_log(avctx, AV_LOG_ERROR, "Unable to create encoder\n"); | 118 | av_log(avctx, AV_LOG_ERROR, "Unable to create encoder\n"); |
| 123 | return AVERROR_UNKNOWN; | 119 | return AVERROR_UNKNOWN; |