From patchwork Fri Dec 8 08:15:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalev Lember X-Patchwork-Id: 44978 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:1225:b0:181:818d:5e7f with SMTP id v37csp1138283pzf; Fri, 8 Dec 2023 00:16:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IHPlYuFcYGsLj5/7ByItshs2KPa23tUD+mafvaLZ8TJ00LRUd17p4dQp36dpNsc8n2STk5Z X-Received: by 2002:a05:6402:518c:b0:54c:c31d:a808 with SMTP id q12-20020a056402518c00b0054cc31da808mr5074968edd.0.1702023363454; Fri, 08 Dec 2023 00:16:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702023363; cv=none; d=google.com; s=arc-20160816; b=bdzr7zS3s4YFAY1TXFZXOtwwAWI0w3wgzP68dkplZXCKm5xENXVFZdpeCDzIO/pAMl 1chSwnKhBYCSJaNMug8PoHaZW239SjZrJ4AAQ+HgdnoPv9dq21sxBPBoYBCCoPsS8E2y DqwK32E3gLoTKYr+xq9tIQq/06EG/uJSigBWsIOOnWJr1cQCvHLUzjOCNauAANhFzaME kXnhzTic0oZ9Q8zJDJI/TvC5hMKGKJEdNmVjz5oSNhzlVrFWdL509q02TjWrrCXVY7sZ ujV8NQHYa4JRi2YpG/OcVEW7Q7eYwuEFHQJwuc9l2kVwpNqjUJbPrdFb10APSIectPLm gXrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=l50zdowzZecv+UHHQsf/crlZZeMgGPv0E4RZ4XtzFFY=; fh=+rq42RRx4hgnT+vZ8smKdAk9ZcXTF6nl9JXuRNqQChE=; b=Ou/huWmPsR4Y2A8A1/QAfozx+1enGNV9Zj6wA9gKdjLqsZVfpyY/vmCnOoyC1HwyH4 rHCl3H+hZ+glKlndwOAzPkESQlC4ax6jNpF67O9Mnx75neRujX0AdSd6ynvAMHx3hmS0 gdLvlP4SMkqEY0XsBtjFn9VoLYrmrUh5DaaQ6vLxO4Y8SgwKfG4TBWK2JryN3qzoDN/S 3WhLb1g9eKLUfzy9IUD7E4YdADnZfsaniLTNuQ8pqWwla/ozmogHFvH0lIB8URz7qmOU izNe0bTUDvhg5h8GpHPI3SxakEf/ITBME56Rbo+df/gjXe7DNVXx+G8p+Jr1VD+KOIbt WoRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@redhat.com header.s=mimecast20190719 header.b=BklulpPx; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id k12-20020aa7d8cc000000b0054c6396baf7si632295eds.640.2023.12.08.00.16.02; Fri, 08 Dec 2023 00:16:03 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@redhat.com header.s=mimecast20190719 header.b=BklulpPx; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 507DA68CFF8; Fri, 8 Dec 2023 10:15:59 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8788A68CF34 for ; Fri, 8 Dec 2023 10:15:52 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702023351; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DAGxAMOS0GjaJ24C1vBym+i3e8+KYzVwz+fwBmW9Ofs=; b=BklulpPx7ryjny+RXPGaWnCwBLSIEwQ3yhPYeZo570UD5NsQ1gV8XU86VGgVasD5EA46cb /4RveztsJiwhcxZ/lVHq4z61ksnFMFgU2fJGqrDmuRc+91z/DLAxE+vRfwOlOlIbbKPsyU 4GiztpOrE+zISBJKVjH7kkXxBUr+fW4= Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-537--HYzaQO0NhmZuTKiuyoQlw-1; Fri, 08 Dec 2023 03:15:48 -0500 X-MC-Unique: -HYzaQO0NhmZuTKiuyoQlw-1 Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2ca0ab9a5e6so13224761fa.3 for ; Fri, 08 Dec 2023 00:15:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702023346; x=1702628146; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=DAGxAMOS0GjaJ24C1vBym+i3e8+KYzVwz+fwBmW9Ofs=; b=Z3rJjaqwhVpK+PcsUKISOEEANWOcJaTydKc+sl75Rm7IKXYbXA7QYJKy90qaTjbbT6 pZKOg004syvko6jpuJcevAT2sVZ1sW0wr8kgap2v02inAFnIX48L+vGnvAYcylB7CBUi oLAWckD9icBp528DsgTBbCpzivC+d4R17FQTB+8lgDGl4AolK+Sq0fYhuKohsbTIYxGj kOg06srihy+TyWvX21tDH821p2r7aH54tCtp6tKaGSazVxi5mppTYyEyHkP6EQwXfsAK N5dhYBMn+X5z8d9XRES1PM5225Guhhu5mzcF7YtWbS/LPIyo8E4YRUl+0F67poir3cDv noJg== X-Gm-Message-State: AOJu0YyKcZGhoAx7kQ0gMH8B3tqIDqg2nOtMeW+4mgvIoOz551ZMKvZJ g7/0FXK6DvxApwZXXqChiGJ2LNjl+68b9SueL/jWDtMX2tHe+HfaHAbeQas8hcBHCFNZiPYyUyk 0PJHKIB4/QqQ5fSg6fCcH0Rp0OQTUREq67+CI/nWdpLuSRhXVdB/3ibzKGUh0PQ7X5ZU6M2f//k ch X-Received: by 2002:a2e:9f10:0:b0:2c9:f67e:fba0 with SMTP id u16-20020a2e9f10000000b002c9f67efba0mr2187311ljk.37.1702023346498; Fri, 08 Dec 2023 00:15:46 -0800 (PST) X-Received: by 2002:a2e:9f10:0:b0:2c9:f67e:fba0 with SMTP id u16-20020a2e9f10000000b002c9f67efba0mr2187303ljk.37.1702023346127; Fri, 08 Dec 2023 00:15:46 -0800 (PST) Received: from collie.lan (c188-149-247-5.bredband.tele2.se. [188.149.247.5]) by smtp.gmail.com with ESMTPSA id j17-20020a2eb711000000b002c9fda71acesm154499ljo.127.2023.12.08.00.15.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 00:15:45 -0800 (PST) From: Kalev Lember To: ffmpeg-devel@ffmpeg.org Date: Fri, 8 Dec 2023 09:15:36 +0100 Message-ID: <20231208081536.14141-1-klember@redhat.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [FFmpeg-devel] [PATCH] lavc/libopenh264: Drop openh264 runtime version checks X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Kalev Lember Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: U/1kH7LPnGHd Years ago, openh264 releases often changed their ABI without changing the library soname. To avoid running into ABI issues, a version check was added to lavc libopenh264 code to error out at runtime in case the build time and runtime openh264 versions don't match. This should no longer be an issue with newer openh264 releases and we can drop the runtime version check and rely on upstream doing the right thing and bump the library soname if the ABI changes, similar to how other libraries are consumed in ffmpeg. Almost all major distributions now include openh264 and this means there are more eyes on ABI changes and issues are discovered and reported quickly. See e.g. https://github.com/cisco/openh264/issues/3564 where an ABI issue was quickly discovered and fixed. Relaxing the check allows downstream distributions to build ffmpeg against e.g. openh264 2.3.1 and ship an update to ABI-compatible openh264 2.4.0, without needing to coordinate a lock step update between ffmpeg and openh264 (which can be difficult if openh264 is distributed by Cisco and ffmpeg comes from the distro, such as is the case for Fedora). Signed-off-by: Kalev Lember Reviewed-by: Neal Gompa --- libavcodec/libopenh264.c | 15 --------------- libavcodec/libopenh264.h | 2 -- libavcodec/libopenh264dec.c | 4 ---- libavcodec/libopenh264enc.c | 4 ---- 4 files changed, 25 deletions(-) diff --git a/libavcodec/libopenh264.c b/libavcodec/libopenh264.c index 0f6d28ed88..c80c85ea8b 100644 --- a/libavcodec/libopenh264.c +++ b/libavcodec/libopenh264.c @@ -46,18 +46,3 @@ void ff_libopenh264_trace_callback(void *ctx, int level, const char *msg) int equiv_ffmpeg_log_level = libopenh264_to_ffmpeg_log_level(level); av_log(ctx, equiv_ffmpeg_log_level, "%s\n", msg); } - -int ff_libopenh264_check_version(void *logctx) -{ - // Mingw GCC < 4.7 on x86_32 uses an incorrect/buggy ABI for the WelsGetCodecVersion - // function (for functions returning larger structs), thus skip the check in those - // configurations. -#if !defined(_WIN32) || !defined(__GNUC__) || !ARCH_X86_32 || AV_GCC_VERSION_AT_LEAST(4, 7) - OpenH264Version libver = WelsGetCodecVersion(); - if (memcmp(&libver, &g_stCodecVersion, sizeof(libver))) { - av_log(logctx, AV_LOG_ERROR, "Incorrect library version loaded\n"); - return AVERROR(EINVAL); - } -#endif - return 0; -} diff --git a/libavcodec/libopenh264.h b/libavcodec/libopenh264.h index dbb9c5d429..0b462d6fdc 100644 --- a/libavcodec/libopenh264.h +++ b/libavcodec/libopenh264.h @@ -34,6 +34,4 @@ void ff_libopenh264_trace_callback(void *ctx, int level, const char *msg); -int ff_libopenh264_check_version(void *logctx); - #endif /* AVCODEC_LIBOPENH264_H */ diff --git a/libavcodec/libopenh264dec.c b/libavcodec/libopenh264dec.c index 7d650ae03e..b6a9bba2dc 100644 --- a/libavcodec/libopenh264dec.c +++ b/libavcodec/libopenh264dec.c @@ -52,13 +52,9 @@ static av_cold int svc_decode_init(AVCodecContext *avctx) { SVCContext *s = avctx->priv_data; SDecodingParam param = { 0 }; - int err; int log_level; WelsTraceCallback callback_function; - if ((err = ff_libopenh264_check_version(avctx)) < 0) - return AVERROR_DECODER_NOT_FOUND; - if (WelsCreateDecoder(&s->decoder)) { av_log(avctx, AV_LOG_ERROR, "Unable to create decoder\n"); return AVERROR_UNKNOWN; diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c index f518d0894e..6f231d22b2 100644 --- a/libavcodec/libopenh264enc.c +++ b/libavcodec/libopenh264enc.c @@ -110,14 +110,10 @@ static av_cold int svc_encode_init(AVCodecContext *avctx) { SVCContext *s = avctx->priv_data; SEncParamExt param = { 0 }; - int err; int log_level; WelsTraceCallback callback_function; AVCPBProperties *props; - if ((err = ff_libopenh264_check_version(avctx)) < 0) - return AVERROR_ENCODER_NOT_FOUND; - if (WelsCreateSVCEncoder(&s->encoder)) { av_log(avctx, AV_LOG_ERROR, "Unable to create encoder\n"); return AVERROR_UNKNOWN;