[FFmpeg-devel] [PATCH 7/9] pthread_frame: do not run hwaccel decoding asynchronously unless it's safe

Michael Niedermayer michael at niedermayer.cc
Tue Mar 21 16:54:18 EET 2017


On Mon, Mar 20, 2017 at 06:43:50AM +0100, wm4 wrote:
> On Sun, 19 Mar 2017 02:30:11 +0100
> Michael Niedermayer <michael at niedermayer.cc> 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  
> > 
> > breaks:
> > ./ffmpeg -i tickets//4583/ffvp9_corruption.webm -f null -
> > https://trac.ffmpeg.org/raw-attachment/ticket/4583/ffvp9_corruption.webm
> > 
> > ...
> > frame=  215 fps=0.0 q=-0.0 Lsize=N/A time=00:00:08.00 bitrate=N/A speed= 165x
> > video:104kB audio:1500kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
> > pthread_mutex_unlock failed with error: Operation not permitted
> > Aborted
> 

> Fixed with this patch: http://sprunge.us/dNcA

patches should be sent to the mailing list

Ive just noticed now that this was already pushed before i could even
test this.

It doesnt work

./ffplay /home/michael/tickets/5275/k10.avi

https://trac.ffmpeg.org/attachment/ticket/5275/k10.avi

Aborts with:
...
    best_distance 1
[h264 @ 0x7f3518001fe0] No start code is found.
    Last message repeated 1 times
Input #0, avi, from '/home/michael/tickets/5275/k10.avi':0B f=0/0
  Duration: 00:00:02.59, start: 0.000000, bitrate: 791 kb/s
    Stream #0:0: Video: h264 (Baseline) (DAVC / 0x43564144), yuv420p(progressive), 320x240, 773 kb/s, 23.97 fps, 23.98 tbr, 23.97 tbn, 47.94 tbc
[h264 @ 0x7f3518029680] No start code is found.
pthread_mutex_unlock failed with error: Operation not permitted
Aborted

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you think the mosad wants you dead since a long time then you are either
wrong or dead since a long time.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170321/a0a815f7/attachment.sig>


More information about the ffmpeg-devel mailing list