From patchwork Sat Feb 12 06:41:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 34253 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6838:14aa:0:0:0:0 with SMTP id bz10csp3856048nkb; Fri, 11 Feb 2022 22:43:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJyz16LGR30j402hhO+BzVWOPhViXwlqHfHs7sORXzkKL2XPYGF1EhTKyFc4ivC/FpbNvmcg X-Received: by 2002:a17:907:6088:: with SMTP id ht8mr4050255ejc.528.1644648222303; Fri, 11 Feb 2022 22:43:42 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id s1si20201539ejn.293.2022.02.11.22.43.42; Fri, 11 Feb 2022 22:43:42 -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=@outlook.com header.s=selector1 header.b=nD4iSzi3; arc=fail (body hash mismatch); 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=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8643868B2C4; Sat, 12 Feb 2022 08:42:12 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-oln040092074018.outbound.protection.outlook.com [40.92.74.18]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BC28B68B256 for ; Sat, 12 Feb 2022 08:42:03 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cP7NeoTMDxGJs9wPEraCQy+WNP3FM5HUxRu5o8tk4ykbxqPFflh1ONaiWYiDjcb+wg7pSxRweHFYN3eTHsfClUr32ePEUqO+zG24j+JewUGnYCZfljwdco9duGuUnTX8KVYZ86yo7fw7dKFaAdTm1uXtUNIj6omctWWhAwM6H/nmU6qRhZ1lytoTKtc4EInWolqHVHW0/x7GRRnIZQr6jPe9SES4VeCQs16Vh43sPkBosTuc0zbwC9Z6zSjR2iF6KVGVDW3LguOzdZtD7WswjajEK1SRdc/7nwIrny8NSSZYYnAecmsdnwThiEpuwxAUk3TSFuS717/DOEzaRENvpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+wHsVja1VbUKxNUWXneX81w7t0asnv8mcq2U0cUnLF8=; b=Mncv6H5DDoijufkNRih0YpcyCH2WoYOSTB1pJToel0pSm6ECIHonh1JMxGIqCuvnbEH6jsW8DltZuR70o832vS469QWyVhwUbb/DwUe2qD2KTIqVuo9NS+z7mWLhxxj1MbD+cLnI9P/AWEpgF8KmcVK4u/iY4bd8o15NOi2hLidKeofH/PIN3drMDIHr0TcSy4jB8QbUw9Z6OKRISsZSUaA7mqYo6x0wUPNPI+J9QOFsC8Y0LbEO+P7KV/kviFRabWnESQxG0qnRzD7RHVEJ9Id01+AGgilzk+oTSnTPgcvDLWVMoEh/N3HTZ9cpsdvO/5Gx4mzw9Morm9KuEB43MA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+wHsVja1VbUKxNUWXneX81w7t0asnv8mcq2U0cUnLF8=; b=nD4iSzi3lAKazNZdCE/kNevQfCqNyHp0h/B5Ren6cH4rhn19Gf8KmCqsZOkgpDatvhnHIzHiTEeK1Ni/DY72aUQ202f143KzduHzHLzcCH8n2QJOUpgWD2R2hwbqjWxRd89jyLJygpfLMHrFAPaP7IFEURnHiUICGRwCyks8RZchSuaeaWVPZb9VQkzxsnTwBb2Ows7rCPJDCzCDFnuYGlHbp492USvRdfxufRVR988pvQHntFM8uiul6Qp4MH6O74KugF2ugn6e6ebvgm1KUNmP0rjJ9KOs6f7eDfXOkor0GrlYXgewYSR9zU2CnDIbZkJNp+CDUlx+K8F+NN8eTg== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM9PR03MB6723.eurprd03.prod.outlook.com (2603:10a6:20b:2d8::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11; Sat, 12 Feb 2022 06:41:58 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::ac56:2ff4:d304:ab22]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::ac56:2ff4:d304:ab22%5]) with mapi id 15.20.4975.011; Sat, 12 Feb 2022 06:41:58 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 12 Feb 2022 07:41:30 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [WB23qR/nAR98xFDHc0sM3ZNOk9YQCMTb] X-ClientProxiedBy: AM7PR03CA0008.eurprd03.prod.outlook.com (2603:10a6:20b:130::18) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20220212064131.2265452-15-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fb47535b-2703-4c1b-dc46-08d9edf2c47f X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiSJybpSSbCo57WJd93pOqVlothMRrWkmAIJDF5vIc0A0lLkWIL+mqVZJ157OJFVJvU1kCb8+DQOvDjJ3OYLXxuE7lqn6AOmY8zIwBobi/08T+Q/FHDR1kyKJDJetGPUrBH2PQDkHgL6E1XLkUKJBAYUJK1pjGOR5IlEjhiktHOBLoffiVrhzSOr5pcRInwsmQuwy25z96T+gAabQH/HcDULU1dB4MOpqCnZGTfcfaLrgcNly7pceyn188+WxPMIk0mHUEF0XOmyB4ClY1GtVpc30I/gWAJMU8EoslCLdszartIaEzDEoxN2B6ujHeIzA2wEsyQL+0Xy++o3R5wSiFXV+xTnQG2/6AbeFcIp/HGPJYv+ZssWOp2GIVrV+SulDjQPXOgLe4Hz457y/DmTk2u2Q8HGpyYyqwYuR7fd3r7FP63zllGN+cNQhONI3Z5QEgb1aZGCwiJ2F27Jp79wrmDP2f8knzkMxERGE2S0bfYOFKLfAVbkOrXOpmHi3OLry2dbHFqSE1qhe9RSMY9QxyeME7hzgU5ZAIyCX4Y9RwpG/z+wdtMne5CRUHgOuM5+4LxsQaEWrQ51Aoj9ELwSrqTvgSKGk8Z4I5Wc0G9KpNdKLiERlrT4h3IXeV2/mjbEyxxFjR7xjqktNk40l/qwPwRgdQFBWBdfIz5hDzhYusIkFEJD/UVNmcAcDlxlZJJNujV6/uLCdAM/N99TkcGH4qPjT7zdTK4Ut1QrKs1EvxZPg51tSgt+rPVUa97JWsatje4= X-MS-TrafficTypeDiagnostic: AM9PR03MB6723:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2UuswtvpGzE1PMn4OeSPNo7HQTrwryw7przOAvkCurRIvBLha3Y8KlxWuS/Pii3wS1XaAjn+1aFY0BjbPZulhbxgHcd35dQeE5RpHyM84RaHut1H8NsHdcqAE8PZ6PzNlZGr9DHNdLM9iFNyeVDKBTJb52EJtkekiN/T3bF/OvFt1oo+/MFwJ3blpmrgd8GCQCJw/uaiCUKS8+kX/VHy7AK80KJ26D8DpM12T2yY7F6KwLn8PLg79tf8UxMEtRds2CGKVQ72rUeGs68w9G2z+hba8VzURJp6Gh2DE9oJDrP8EecR935SMaRH8mezzkTPCmOpDKh8O8dsqAR55NkaxBmiPVldpNtys1eHawznMq0M8MEPRsPxnIRPGtj2tB2dyrTYZ5uWRtHbLmCUYJk7xKne+slYBkQR8scbK0g4f3gpYaqkcaOzQII7qJkwzPk6mfUmf/rmByVshT68It3aGlx06XNrPTVpzNrnw+qv/pxIJ1QkNgXku9hvJoKpLZSZa9cphACly8i9Nr2VQYglp4iUm8FNv79bK1YnkBG0oAKVKpXs0BoBC/TEd6UAv7Nf17+2nysJkEXroyFzNzf31g== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BsPCbhAp6s85f60POjDWA1024iIqVNto089Z78YX2dQTcMIRaX2I6EBP+OR8z+w1BCAd3z2BKfLD+aAmISoSUTNmEpREJJ10bPwEU4wUlwh91kMMTBeWXyWF9V+wmDjovBA36jfFuuYkOXSZgEeNoi6Nl9+rDfs88diFma7iMAgXPua7ii1bDGGDb0c1L22RuagKTr941/x/M1IZ7Bc5fE54I/dleENUcj96UQwtT7FTgVAI8ZCy7e84qRt85Ul/SGzuHSN1VIWhAfHm2MwO73NflMYCZqQPeoujeepTMWwBm+nMrmidFw73njbnZoOX/fSiwwserp24lsdCbRg9twb36OBim9KsL9mDyj2ZVXHL7xdtoV0S43OqJWLoxwsE2I0cNa7D13JAN5XIaa6+7XUDrs88eUyKtpcZhRUvEy7BLBRNH+5BVDZEJQsx9SvqNAHnuKwUSLrUK/RE1iaeIv2w31IL0lonmHdSyyol77JyLMGMu0LXv5Ty4wKM9gKxntvty8zHVRs43366VA8wlrTnTSOz30au124F7x6KwNTwvODB0zL634VymunpWnwPMHUxJe9bZkUEF6uN96Y6PrfXT8KU3GZRBdL20Q3kxbp8ZQ/cpGYZkDk4Z3tTMB+bP1msTrbRivHWUbmpIN7LypOg2nVR8RoUzUNixf2Rj4VaN56C9k/NG2QLEXppADWqKvr7VVY/+l6iGn4Zs1j8pjV2FJN8Jy/0TjIh525atD0lXgV48tDhok27YqYMNu5DQJlQjdXbQKyQ4I7rX8aXFjUjM755ZBYrWo/KaH9K+LExhbrWksD6UUFNA0h4MajWee/RbhTFiCjgiEnsi+BGbWAGQHwDtOl1RDPZB4BKFP7TvXAWfItNMfFI07DK6tSJgYETeT5lkmV8SZTT7fJnfNCZB7r03yMLeksaY6GtSE4HjcN41MMVTICX6tTlItWjcn3AGr3/7ckdAlLF8kMQPg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fb47535b-2703-4c1b-dc46-08d9edf2c47f X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2022 06:41:58.6249 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR03MB6723 Subject: [FFmpeg-devel] [PATCH 16/17] avcodec/msmpeg4dec: Make initializing VLCs thread-safe 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: WX7ARKZ+PhYL This automatically makes the remaining mpegvideo-decoders (namely msmpeg4v[1-3], mss2, VC-1, VC-1 Image, WMV-[1-3] and WMV-3 Image) init-threadsafe. These were the last native codecs that were not init-threadsafe; only wrappers for external libraries and for hardware accelerations are now not init-threadsafe. Signed-off-by: Andreas Rheinhardt --- The above is based around the assumption that my other patches marking the VP56 and 8bps decoders as init-threadsafe are already applied. Here is an incomplete list of non-native codecs that are not init-threadsafe yet even after all these patches have been applied (this list is incomplete because it only contains codecs that I include in a fairly, but not completely extensive build of mine; the threading flags stand for frame-slice-other; if all frame-threaded decoders were init-threadsafe, one could avoid locking around ff_thread_init() in avcodec_open2(). This only affects libopenjpeg and I guess that it is init-threadsafe (as are probably most of the following entries): Encoder libaom-av1 is not init-threadsafe yet. Codec supports threading: 0, 0, 1 Encoder libcodec2 is not init-threadsafe yet. Encoder libfdk_aac is not init-threadsafe yet. Encoder libgsm is not init-threadsafe yet. Encoder libgsm_ms is not init-threadsafe yet. Encoder libilbc is not init-threadsafe yet. Encoder libmp3lame is not init-threadsafe yet. Encoder libopencore_amrnb is not init-threadsafe yet. Encoder libopenjpeg is not init-threadsafe yet. Codec supports threading: 1, 0, 0 Encoder libopus is not init-threadsafe yet. Encoder libshine is not init-threadsafe yet. Encoder libspeex is not init-threadsafe yet. Encoder libtheora is not init-threadsafe yet. Encoder libtwolame is not init-threadsafe yet. Encoder libvorbis is not init-threadsafe yet. Encoder libvpx is not init-threadsafe yet. Codec supports threading: 0, 0, 1 Encoder libvpx-vp9 is not init-threadsafe yet. Codec supports threading: 0, 0, 1 Encoder libwebp_anim is not init-threadsafe yet. Encoder libwebp is not init-threadsafe yet. Encoder libx265 is not init-threadsafe yet. Codec supports threading: 0, 0, 1 Encoder libxavs is not init-threadsafe yet. Codec supports threading: 0, 0, 1 Encoder libxavs2 is not init-threadsafe yet. Codec supports threading: 0, 0, 1 Encoder h263_v4l2m2m is not init-threadsafe yet. Encoder h264_nvenc is not init-threadsafe yet. Encoder h264_qsv is not init-threadsafe yet. Encoder h264_v4l2m2m is not init-threadsafe yet. Encoder h264_vaapi is not init-threadsafe yet. Encoder hevc_nvenc is not init-threadsafe yet. Encoder hevc_qsv is not init-threadsafe yet. Encoder hevc_v4l2m2m is not init-threadsafe yet. Encoder hevc_vaapi is not init-threadsafe yet. Encoder mjpeg_qsv is not init-threadsafe yet. Encoder mjpeg_vaapi is not init-threadsafe yet. Encoder mpeg2_qsv is not init-threadsafe yet. Encoder mpeg2_vaapi is not init-threadsafe yet. Encoder mpeg4_v4l2m2m is not init-threadsafe yet. Encoder vp8_v4l2m2m is not init-threadsafe yet. Encoder vp8_vaapi is not init-threadsafe yet. Encoder vp9_vaapi is not init-threadsafe yet. Encoder vp9_qsv is not init-threadsafe yet. Decoder h263_v4l2m2m is not init-threadsafe yet. Decoder h264_crystalhd is not init-threadsafe yet. Decoder h264_v4l2m2m is not init-threadsafe yet. Decoder h264_qsv is not init-threadsafe yet. Decoder h264_rkmpp is not init-threadsafe yet. Decoder hevc_qsv is not init-threadsafe yet. Decoder hevc_rkmpp is not init-threadsafe yet. Decoder hevc_v4l2m2m is not init-threadsafe yet. Decoder mpeg4_crystalhd is not init-threadsafe yet. Decoder mpeg4_v4l2m2m is not init-threadsafe yet. Decoder mpeg1_v4l2m2m is not init-threadsafe yet. Decoder mpeg2_crystalhd is not init-threadsafe yet. Decoder mpeg2_v4l2m2m is not init-threadsafe yet. Decoder mpeg2_qsv is not init-threadsafe yet. Decoder msmpeg4_crystalhd is not init-threadsafe yet. Decoder vc1_crystalhd is not init-threadsafe yet. Decoder vc1_qsv is not init-threadsafe yet. Decoder vc1_v4l2m2m is not init-threadsafe yet. Decoder vp8_rkmpp is not init-threadsafe yet. Decoder vp8_v4l2m2m is not init-threadsafe yet. Decoder vp9_rkmpp is not init-threadsafe yet. Decoder vp9_v4l2m2m is not init-threadsafe yet. Decoder wmv3_crystalhd is not init-threadsafe yet. Decoder libaribb24 is not init-threadsafe yet. Decoder libcelt is not init-threadsafe yet. Decoder libcodec2 is not init-threadsafe yet. Decoder libdavs2 is not init-threadsafe yet. Codec supports threading: 0, 0, 1 Decoder libgsm is not init-threadsafe yet. Decoder libgsm_ms is not init-threadsafe yet. Decoder libilbc is not init-threadsafe yet. Decoder libopencore_amrnb is not init-threadsafe yet. Decoder libopencore_amrwb is not init-threadsafe yet. Decoder libopenjpeg is not init-threadsafe yet. Codec supports threading: 1, 0, 0 Decoder libopus is not init-threadsafe yet. Decoder libspeex is not init-threadsafe yet. Decoder libuavs3d is not init-threadsafe yet. Codec supports threading: 0, 0, 1 Decoder libvorbis is not init-threadsafe yet. Decoder libvpx is not init-threadsafe yet. Codec supports threading: 0, 0, 1 Decoder libvpx-vp9 is not init-threadsafe yet. Codec supports threading: 0, 0, 1 Decoder libzvbi_teletextdec is not init-threadsafe yet. Decoder libaom-av1 is not init-threadsafe yet. Codec supports threading: 0, 0, 1 Decoder av1_cuvid is not init-threadsafe yet. Decoder av1_qsv is not init-threadsafe yet. Decoder h264_cuvid is not init-threadsafe yet. Decoder hevc_cuvid is not init-threadsafe yet. Decoder mjpeg_cuvid is not init-threadsafe yet. Decoder mjpeg_qsv is not init-threadsafe yet. Decoder mpeg1_cuvid is not init-threadsafe yet. Decoder mpeg2_cuvid is not init-threadsafe yet. Decoder mpeg4_cuvid is not init-threadsafe yet. Decoder vc1_cuvid is not init-threadsafe yet. Decoder vp8_cuvid is not init-threadsafe yet. Decoder vp8_qsv is not init-threadsafe yet. Decoder vp9_cuvid is not init-threadsafe yet. Decoder vp9_qsv is not init-threadsafe yet. libavcodec/msmpeg4dec.c | 47 ++++++++++++++++++++++++----------------- libavcodec/mss2.c | 1 + libavcodec/vc1dec.c | 4 ++++ libavcodec/wmv2dec.c | 2 +- 4 files changed, 34 insertions(+), 20 deletions(-) diff --git a/libavcodec/msmpeg4dec.c b/libavcodec/msmpeg4dec.c index 3d2dcb9429..ba72c7ee50 100644 --- a/libavcodec/msmpeg4dec.c +++ b/libavcodec/msmpeg4dec.c @@ -22,6 +22,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/thread.h" + #include "avcodec.h" #include "internal.h" #include "mpegutils.h" @@ -292,22 +294,10 @@ static int msmpeg4v34_decode_mb(MpegEncContext *s, int16_t block[6][64]) } /* init all vlc decoding tables */ -av_cold int ff_msmpeg4_decode_init(AVCodecContext *avctx) +static av_cold void msmpeg4_decode_init_static(void) { - MpegEncContext *s = avctx->priv_data; - static volatile int done = 0; - int ret; MVTable *mv; - if ((ret = av_image_check_size(avctx->width, avctx->height, 0, avctx)) < 0) - return ret; - - if (ff_h263_decode_init(avctx) < 0) - return -1; - - ff_msmpeg4_common_init(s); - - if (!done) { INIT_FIRST_VLC_RL(ff_rl_table[0], 642); INIT_FIRST_VLC_RL(ff_rl_table[1], 1104); INIT_FIRST_VLC_RL(ff_rl_table[2], 554); @@ -372,8 +362,21 @@ av_cold int ff_msmpeg4_decode_init(AVCodecContext *avctx) INIT_VLC_STATIC(&ff_inter_intra_vlc, INTER_INTRA_VLC_BITS, 4, &ff_table_inter_intra[0][1], 2, 1, &ff_table_inter_intra[0][0], 2, 1, 8); - done = 1; - } +} + +av_cold int ff_msmpeg4_decode_init(AVCodecContext *avctx) +{ + static AVOnce init_static_once = AV_ONCE_INIT; + MpegEncContext *s = avctx->priv_data; + int ret; + + if ((ret = av_image_check_size(avctx->width, avctx->height, 0, avctx)) < 0) + return ret; + + if (ff_h263_decode_init(avctx) < 0) + return -1; + + ff_msmpeg4_common_init(s); switch(s->msmpeg4_version){ case 1: @@ -394,6 +397,8 @@ av_cold int ff_msmpeg4_decode_init(AVCodecContext *avctx) s->slice_height= s->mb_height; //to avoid 1/0 if the first frame is not a keyframe + ff_thread_once(&init_static_once, msmpeg4_decode_init_static); + return 0; } @@ -866,7 +871,8 @@ const AVCodec ff_msmpeg4v1_decoder = { .close = ff_h263_decode_end, .decode = ff_h263_decode_frame, .capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1, - .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, + .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | + FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, .max_lowres = 3, .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, @@ -884,7 +890,8 @@ const AVCodec ff_msmpeg4v2_decoder = { .close = ff_h263_decode_end, .decode = ff_h263_decode_frame, .capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1, - .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, + .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | + FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, .max_lowres = 3, .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, @@ -902,7 +909,8 @@ const AVCodec ff_msmpeg4v3_decoder = { .close = ff_h263_decode_end, .decode = ff_h263_decode_frame, .capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1, - .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, + .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | + FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, .max_lowres = 3, .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, @@ -920,7 +928,8 @@ const AVCodec ff_wmv1_decoder = { .close = ff_h263_decode_end, .decode = ff_h263_decode_frame, .capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1, - .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, + .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | + FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, .max_lowres = 3, .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, diff --git a/libavcodec/mss2.c b/libavcodec/mss2.c index d7a19f6ad2..3b756c9399 100644 --- a/libavcodec/mss2.c +++ b/libavcodec/mss2.c @@ -855,4 +855,5 @@ const AVCodec ff_mss2_decoder = { .close = mss2_decode_end, .decode = mss2_decode_frame, .capabilities = AV_CODEC_CAP_DR1, + .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, }; diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 7ed5133cfa..7568dfc332 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -1209,6 +1209,7 @@ const AVCodec ff_vc1_decoder = { .decode = vc1_decode_frame, .flush = ff_mpeg_flush, .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY, + .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, .pix_fmts = vc1_hwaccel_pixfmt_list_420, .hw_configs = (const AVCodecHWConfigInternal *const []) { #if CONFIG_VC1_DXVA2_HWACCEL @@ -1246,6 +1247,7 @@ const AVCodec ff_wmv3_decoder = { .decode = vc1_decode_frame, .flush = ff_mpeg_flush, .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY, + .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, .pix_fmts = vc1_hwaccel_pixfmt_list_420, .hw_configs = (const AVCodecHWConfigInternal *const []) { #if CONFIG_WMV3_DXVA2_HWACCEL @@ -1283,6 +1285,7 @@ const AVCodec ff_wmv3image_decoder = { .close = ff_vc1_decode_end, .decode = vc1_decode_frame, .capabilities = AV_CODEC_CAP_DR1, + .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, .flush = vc1_sprite_flush, .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, @@ -1302,6 +1305,7 @@ const AVCodec ff_vc1image_decoder = { .close = ff_vc1_decode_end, .decode = vc1_decode_frame, .capabilities = AV_CODEC_CAP_DR1, + .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, .flush = vc1_sprite_flush, .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c index 7518088b6a..71c948df23 100644 --- a/libavcodec/wmv2dec.c +++ b/libavcodec/wmv2dec.c @@ -567,7 +567,7 @@ const AVCodec ff_wmv2_decoder = { .close = wmv2_decode_end, .decode = ff_h263_decode_frame, .capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1, - .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, + .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE }, };