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

Michael Niedermayer michael at niedermayer.cc
Fri Jul 22 19:22:56 EEST 2022


On Mon, Jul 18, 2022 at 08:56:32PM +0200, Michael Niedermayer wrote:
> 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

noone ?
i guess the fix will then be in 5.1.1

is there any note / warning that should be included in the release notes or
something about this open issue ?

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

What does censorship reveal? It reveals fear. -- Julian Assange
-------------- 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/20220722/427d198e/attachment.sig>


More information about the ffmpeg-devel mailing list