From patchwork Fri Nov 27 01:02:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 24092 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 5885144A448 for ; Fri, 27 Nov 2020 03:13:18 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 163A068BB71; Fri, 27 Nov 2020 03:07:41 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1EA8B68BBC1 for ; Fri, 27 Nov 2020 03:07:26 +0200 (EET) Received: by mail-wm1-f50.google.com with SMTP id 1so4470378wme.3 for ; Thu, 26 Nov 2020 17:07:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Oz+40czVp3M8J7nuvOQik9iwcSAM2gyPYN2W4pS1OyI=; b=NNhxFRlLhU9b/qsRyuArtEtrHPMYzjEGjxTFINyyUrKajZeGqdz96ijUafIfgTAnlc l/2AG7zkuSQvTLCpLRyi2SFgEvgiT3JKjVqrGRPcsl2lFCcXlP86510JtfPHGeO4Yr5G JAP/Va0XxCOQnNSeShdGz+TH7dVnHIB1FSACsvhH15D0PAU8P3n/U/5F/BnLSAZkzGcm ZVKmXjogRXkqE4gszimGji/EGaGi5ERsZr6dA4cm3D2SDZeeXNV2o0Q/lejt2A6BsOc6 SkWwVKROZ05HiP1V/sbEY1DQGcgKVnHspErvPPK8qjhq5OTo9/MpIS968fJPHM8fyKcU ASyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Oz+40czVp3M8J7nuvOQik9iwcSAM2gyPYN2W4pS1OyI=; b=mCKyBdCOmkJzhct6fecU1/+L2iNq7dXZpQIBht9HOIyz6wqHFqPwLANJBnsUXTgSyP 7uPJ+8bAJ//h/4+QN7L/2OTSd9ap++Felo6hAmOOi8I9CeVRDXYuNBT0+bcspSuU2teY 4HrFpIDNLXMEjXkKwCyylr/slXAr3VzI2r30znTXYIrFt30/PpdufunmrPthDurc9t7h D8HWeHroL57EltEoMNKWTnuDlcuvAo6vr/sz2mvdL2OIo1/m2vuPJS1cM5C+L1NL0/la TnRmJ99rpcJsT7anpFMq0PpkKC5V/GYOit9iezsL5UHwSnRq4m92Ig3Mow7zJKgNtsHp sv7w== X-Gm-Message-State: AOAM5328qe/2daSG/lPrL6WVu+BSHbbTi3zYziYWe2q7XZST3BXsEePU KXVWmDaCwzUKiCQw9jqekJ+UP2Q33ksm9g== X-Google-Smtp-Source: ABdhPJzAAINlTgL7lXZYKeUKGNDK2T+gtwWSxibr7OzKSKCP2vAAzp5cUgEhqirozHIGhBS2+mR7rA== X-Received: by 2002:a1c:c2d6:: with SMTP id s205mr5956520wmf.25.1606439246233; Thu, 26 Nov 2020 17:07:26 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id l8sm10504450wro.46.2020.11.26.17.07.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Nov 2020 17:07:25 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 27 Nov 2020 02:02:49 +0100 Message-Id: <20201127010249.2724610-45-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201127010249.2724610-1-andreas.rheinhardt@gmail.com> References: <20201127010249.2724610-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 45/45] avcodec/utils: Remove ff_codec_open2_recursive() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This function existed to enable codecs with non-threadsafe init functions to initialize other codecs despite the fact that normally no two codecs with non-threadsafe init functions can be initialized at the same time (there is a mutex guarding this). Yet there are no users of this function any more as all users have been made thread-safe (switching away from ff_codec_open2_recursive() was required for this as said function requires the caller to hold the lock to the mutex guarding the initializations and this is only true for codecs with the FF_CODEC_CAP_INIT_THREADSAFE flag unset); so remove it. Signed-off-by: Andreas Rheinhardt --- libavcodec/internal.h | 7 ------- libavcodec/utils.c | 12 ------------ 2 files changed, 19 deletions(-) diff --git a/libavcodec/internal.h b/libavcodec/internal.h index 17defb9b50..141f3fb88e 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -306,13 +306,6 @@ int ff_thread_can_start_frame(AVCodecContext *avctx); int avpriv_h264_has_num_reorder_frames(AVCodecContext *avctx); -/** - * Call avcodec_open2 recursively by decrementing counter, unlocking mutex, - * calling the function and then restoring again. Assumes the mutex is - * already locked - */ -int ff_codec_open2_recursive(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options); - const uint8_t *avpriv_find_start_code(const uint8_t *p, const uint8_t *end, uint32_t *state); diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 9b074e2dda..b720d0b6cd 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -535,18 +535,6 @@ static void ff_unlock_avcodec(const AVCodec *codec) ff_mutex_unlock(&codec_mutex); } -int attribute_align_arg ff_codec_open2_recursive(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options) -{ - int ret = 0; - - ff_unlock_avcodec(codec); - - ret = avcodec_open2(avctx, codec, options); - - ff_lock_avcodec(avctx, codec); - return ret; -} - int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options) { int ret = 0;