• Rodger Combs's avatar
    lavc/videotoolbox: fix threaded decoding · 63d87577
    Rodger Combs authored
    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: 's avatarAman Gupta <aman@tmm1.net>
    63d87577
h264dec.c 35.7 KB