From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 450524112B for ; Tue, 13 Jun 2023 02:11:46 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 84E5768C038; Tue, 13 Jun 2023 05:11:43 +0300 (EEST) Received: from w4.tutanota.de (w4.tutanota.de [81.3.6.165]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 28EE768C116 for ; Tue, 13 Jun 2023 05:11:36 +0300 (EEST) Received: from tutadb.w10.tutanota.de (unknown [192.168.1.10]) by w4.tutanota.de (Postfix) with ESMTP id A554110601E3 for ; Tue, 13 Jun 2023 02:11:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1686622295; s=s1; d=lynne.ee; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Cc:Date:Date:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:Sender; bh=Z/K2Lp4thnEO8BpBYKmmiiX6hhazbVAauDMVp1xD0P8=; b=UoFSYw/KXpSzQQYQ6bGI/KZhmamQVr+Zx/GT15U/zMtDdEd43JpFtlEieYs9zgrJ dm4DlRtTIQLB5F+HNzTZORkXbNv7vqNFHkFTlWrmjQOGYF5M98xDe0LI3yHD7LGagMV xg2Tqj2NlJQIXt1jPo7+VBwqVIfu00hdBwJvF8lbiaZVtwMcBAEoedWaF4jnztuFa5w P2TRq59T1/j08BlSfZRzOff6qDtb/8PWKZnlR93BCs1DrcSHpZbMgfJrpKyawki9b5H 5xaPlLh7rcgjKiCcffr2qYima99+v1zcoOsBPJurwbQzAVqVHTtyvcuGVUF9TAL6Gu6 nhbioHSCQw== Date: Tue, 13 Jun 2023 04:11:35 +0200 (CEST) From: Lynne To: Ffmpeg Devel Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_225006_1366412034.1686622295729" Subject: [FFmpeg-devel] [PATCH] pthread_frame: uninit the hwaccel of each frame thread 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: ------=_Part_225006_1366412034.1686622295729 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable The issue is that with a threadsafe hwaccel and multiple enabled frame threads, hwaccel->uninit() is never called. Previously, the function was guaranteed to never have any threads with hwaccel contexts, so it never bothered to uninit it. Patch attached. --- diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c index 28335231fd..bdc1718ab3 100644 --- a/libavcodec/pthread_frame.c +++ b/libavcodec/pthread_frame.c @@ -751,6 +751,8 @@ void ff_frame_thread_free(AVCodecContext *avctx, int th= read_count) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if= (codec->close && p->thread_init !=3D UNINITIALIZED) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 codec->close(ctx); =C2=A0 +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ff_hwac= cel_uninit(ctx); + =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if= (ctx->priv_data) { =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 if (codec->p.priv_class) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 av_opt_free(ctx->priv_data); --=C2=A0 ------=_Part_225006_1366412034.1686622295729 Content-Type: text/x-diff; charset=us-ascii; name=0001-pthread_frame-uninit-the-hwaccel-of-each-frame-threa.patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0001-pthread_frame-uninit-the-hwaccel-of-each-frame-threa.patch >From 64efcc4c78a6ef388b038955147946eb0fe8bd3c Mon Sep 17 00:00:00 2001 From: Lynne Date: Tue, 13 Jun 2023 04:04:28 +0200 Subject: [PATCH] pthread_frame: uninit the hwaccel of each frame thread The issue is that with a threadsafe hwaccel and multiple enabled frame threads, hwaccel->uninit() is never called. Previously, the function was guaranteed to never have any threads with hwaccel contexts, so it never bothered to uninit it. --- libavcodec/pthread_frame.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c index 28335231fd..bdc1718ab3 100644 --- a/libavcodec/pthread_frame.c +++ b/libavcodec/pthread_frame.c @@ -751,6 +751,8 @@ void ff_frame_thread_free(AVCodecContext *avctx, int thread_count) if (codec->close && p->thread_init != UNINITIALIZED) codec->close(ctx); + ff_hwaccel_uninit(ctx); + if (ctx->priv_data) { if (codec->p.priv_class) av_opt_free(ctx->priv_data); -- 2.40.1 ------=_Part_225006_1366412034.1686622295729 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ------=_Part_225006_1366412034.1686622295729--