[FFmpeg-devel] [PATCH] avcodec: add new Videotoolbox hwaccel.

Sebastien Zwickert dilaroga at gmail.com
Sun Jul 5 16:21:05 CEST 2015

> On 01 Jul 2015, at 05:57, Zhang Rui <bbcallen at gmail.com> wrote:
>> +static void videotoolbox_default_free(AVCodecContext *avctx)
>> +{
>> +    AVVideotoolboxContext *videotoolbox = avctx->hwaccel_context;
>> +
>> +    if (videotoolbox) {
>> +        if (videotoolbox->cm_fmt_desc)
>> +            CFRelease(videotoolbox->cm_fmt_desc);
>> +
>> +        if (videotoolbox->session)
> Better add VTDecompressionSessionWaitForAsynchronousFrames() here,
> in case it is removed from videotoolbox_session_decode_frame() in
> future by chance.
> Callback could be called even after VTDecompressionSessionInvalidate()
> when I try to work with flag kVTDecodeFrame_EnableAsynchronousDecompression
> and without VTDecompressionSessionWaitForAsynchronousFrames() per sample
> in my own player.

Thanks for the information.

In asynchronous decoding the VTDecompressionSessionWaitForAsynchronousFrames() function
should be called before invalidating the decompression session in order to flush delayed frames
(this function automatically calls the VTDecompressionSessionFinishDelayedFrames() function).

In the current implementation the kVTDecodeFrame_EnableAsynchronousDecompression
flag is not set and the user is not able to change the parameters passed to the videotoolbox
decode function. So the decoding is synchronous and the current place for flushing the delayed
frames is a good one :)

>> [...]

Best Regards,
Sebastien Zwickert

More information about the ffmpeg-devel mailing list