[FFmpeg-devel] [PATCH 7/9] pthread_frame: do not run hwaccel decoding asynchronously unless it's safe
wm4
nfxjfg at googlemail.com
Sun Mar 26 13:25:28 EEST 2017
On Sat, 25 Mar 2017 21:33:50 -0300
James Almer <jamrial at gmail.com> wrote:
> On 3/25/2017 9:23 PM, Michael Niedermayer wrote:
> > On Sat, Mar 18, 2017 at 09:56:04AM +0100, wm4 wrote:
> >> From: Anton Khirnov <anton at khirnov.net>
> >>
> >> Certain hardware decoding APIs are not guaranteed to be thread-safe, so
> >> having the user access decoded hardware surfaces while the decoder is
> >> running in another thread can cause failures (this is mainly known to
> >> happen with DXVA2).
> >>
> >> For such hwaccels, only allow the decoding thread to run while the user
> >> is inside a lavc decode call (avcodec_send_packet/receive_frame).
> >>
> >> Merges Libav commit d4a91e65.
> >>
> >> Signed-off-by: wm4 <nfxjfg at googlemail.com>
> >> ---
> >> libavcodec/avcodec.h | 5 +++++
> >> libavcodec/hwaccel.h | 24 +++++++++++++++++++++
> >> libavcodec/pthread_frame.c | 52 ++++++++++++++++++++++++++++++++++++++++------
> >> libavcodec/vaapi_h264.c | 2 ++
> >> libavcodec/vaapi_mpeg2.c | 2 ++
> >> libavcodec/vaapi_mpeg4.c | 3 +++
> >> libavcodec/vaapi_vc1.c | 3 +++
> >> libavcodec/vdpau_h264.c | 2 ++
> >> libavcodec/vdpau_hevc.c | 2 ++
> >> libavcodec/vdpau_mpeg12.c | 3 +++
> >> libavcodec/vdpau_mpeg4.c | 2 ++
> >> libavcodec/vdpau_vc1.c | 3 +++
> >> libavcodec/version.h | 2 +-
> >> 13 files changed, 98 insertions(+), 7 deletions(-)
> >> create mode 100644 libavcodec/hwaccel.h
> >>
> >> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> >> index 1923c9648d..dbbe4febcd 100644
> >> --- a/libavcodec/avcodec.h
> >> +++ b/libavcodec/avcodec.h
> >> @@ -3904,6 +3904,11 @@ typedef struct AVHWAccel {
> >> * AVCodecInternal.hwaccel_priv_data.
> >> */
> >> int priv_data_size;
> >> +
> >> + /**
> >> + * Internal hwaccel capabilities.
> >> + */
> >> + int caps_internal;
> >> } AVHWAccel;
> >>
> >> /**
> >> diff --git a/libavcodec/hwaccel.h b/libavcodec/hwaccel.h
> >> new file mode 100644
> >> index 0000000000..17af43707c
> >> --- /dev/null
> >> +++ b/libavcodec/hwaccel.h
> >> @@ -0,0 +1,24 @@
> >> +/*
> >
> >> + * This file is part of FFmpeg and was stolen from Libav.
> >
> > hmm
>
> See 6476bb84bca36b4af5427c5e733fd7b33a985700
>
> IMO, better not do silly things like this if they can make it to
> the tree by accident.
Yes it was accidental. There are still some points to be had:
- it took you this long to spot? I thought you reviewed the patch
- cehoyos, who essentially owns the bug tracker, and thus is a FFmpeg
person much of the public interacts with, is calling Libav "thieves"
up to this day
- there is a FATE "test" with the expressive purpose of catching
instances where the copyright header says "Libav" instead of
"FFmpeg" after new files are added from Libav merges. One has to
wonder why this is done. (Changing the header isn't an offense, but
one can still "hmm" at why so much effort is done just for this.)
So please keep your "hmm" for yourself.
More information about the ffmpeg-devel
mailing list