[FFmpeg-devel] [PATCH] videotoolbox: allow to enable the async decoding.

Zhang Rui bbcallen at gmail.com
Thu Aug 13 07:15:01 CEST 2015


2015-08-09 19:19 GMT+08:00 Hendrik Leppkes <h.leppkes at gmail.com>:
> On Sun, Aug 9, 2015 at 1:11 PM, Sebastien Zwickert <dilaroga at gmail.com> wrote:
>> This patch allows to use the Videotoolbox API in asynchonous mode.
>> Note that when using async decoding the user is responsible for
>> releasing the async frame.
>> Moreover, an option called videotoolbox_async was added to enable
>> async decoding with ffmpeg CLI.
>>
>
> I'm not sure about your approach. I can already see you getting loads
> of problems with frame order. pts is not guaranteed to be present or
> reliable, and using it for re-ordering your async frames is probably
> unreliable at best.
> avcodec does proper re-ordering, and the only reliable way would be to
> somehow manage to associate the AVFrame avcodec is going to output
> with your async frame, so that you can trust avcodecs re-ordering.

There is a trick used in VLC and XBMC.

if (newFrame->pts != AV_NOPTS_VALUE) {
    newFrame->sort = newFrame->pts;
} else {
    newFrame->sort = newFrame->dts;
}

avcodec API is better if any exists

> Isnt there a way to put a "handle" to the async frame into the AVFrame
> somehow, which can then be used by the user code to get it from VT?

The fourth parameter ''sourceFrameRefCon" of VTDecompressionSessionDecodeFrame
 is passed to callback.


More information about the ffmpeg-devel mailing list