[FFmpeg-devel] [PATCH] avcodec/pthread_frame: update the main avctx from the current, ThreadContext

Michael Niedermayer michael at niedermayer.cc
Mon Jul 18 21:56:32 EEST 2022


On Sat, Jul 09, 2022 at 08:45:31AM +0200, Steve Lhomme wrote:
> Patch attached in the email.
> 
> In some cases, the submit packet can result in configurations changes of the
> hardware decoders. The previous HW context is then freed and a new one
> created. That context is supposed to move up to the main context and the
> other threads.
> 
> It appears that when more than 2 frame threads are involved, the new context
> doesn't move in the right place (or rather at the right time). And it can
> create a crash when reusing the old HW context. This patch fixes the issue I
> could reproduce in VLC with DXVA decoding.
> 
> I have no idea if this is correct or the side effects induced by this. It
> seems the right thing to do. Keeping the previous call exhibits the issue.
> It seems odd the other existing thread context are not updated with the
> current hwaccel_priv_data. But maybe they are updated later from the "main"
> thread context, in which case this patch seems solid.

>  pthread_frame.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 2274e52382008f403c7bf52f76d608d2a56ef859  0001-avcodec-pthread_frame-update-the-main-avctx-from-the.patch
> From e8abeeff92f5d7b3b553acdb7595d40153cbec1e Mon Sep 17 00:00:00 2001
> From: Steve Lhomme <robux4 at ycbcr.xyz>
> Date: Fri, 8 Jul 2022 11:49:27 +0200
> Subject: [PATCH] avcodec/pthread_frame: update the main avctx from the current
>  ThreadContext
> 
> After a submit_decoder() the hwaccel_priv_data may have changed in that avctx.
> 
> Doing it after the "next available frame" loop will likely point to the
> hwaccel_priv_data from another PerThreadContext which had the old value which
> might have been freed, if the submit_decoder() resulting in a format change.
> ---
>  libavcodec/pthread_frame.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

It would be nice if a solution to this would make it in 5.1

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20220718/8e179be5/attachment.sig>


More information about the ffmpeg-devel mailing list