]> git.sesse.net Git - ffmpeg/commit
lavc/videotoolbox: fix threaded decoding
authorRodger Combs <rodger.combs@gmail.com>
Sat, 3 Feb 2018 02:50:13 +0000 (20:50 -0600)
committerAman Gupta <aman@tmm1.net>
Thu, 8 Mar 2018 22:04:25 +0000 (14:04 -0800)
commit63d875772d265a885808532889f094f80afaac7a
tree6ab1253b1566169f149cf3c04aec8b430ba5ce05
parent9fe61b61074b013bc0a9289a207efce2107bfbcf
lavc/videotoolbox: fix threaded decoding

AVHWAccel.end_frame can run on a worker thread. The assumption of the
frame threading code is that the worker thread will change the AVFrame
image data, not the AVFrame fields. So the AVFrame fields are not synced
back to the main thread. But this breaks videotoolbox due to its special
requirements (everything else is fine). It actually wants to update
AVFrame fields.

The actual videotoolbox frame is now stored in the dummy AVBufferRef, so
it mimics what happens in non-videotoolbox cases. (Changing the
AVBufferRef contents is a bit like changing the image data.) The
post_process callback copies that reference to the proper AVFrame field.

Based on a patch by wm4.

Signed-off-by: Aman Gupta <aman@tmm1.net>
libavcodec/h264dec.c
libavcodec/videotoolbox.c
libavcodec/vt_internal.h