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

Zhang Rui bbcallen at gmail.com
Thu Aug 13 09:57:17 CEST 2015

2015-08-13 14:26 GMT+08:00 Clément Bœsch <u at pkh.me>:
> On Thu, Aug 13, 2015 at 01:07:38PM +0800, Zhang Rui wrote:
>> >      status = VTDecompressionSessionDecodeFrame(videotoolbox->session,
>> >                                                 sample_buf,
>> > -                                               0,       // decodeFlags
>> > +                                               decodeFlags,
>> >                                                 NULL,    // sourceFrameRefCon
>> >                                                 0);      // infoFlagsOut
>> Better keep tracking how many decoding samples,
>> that are passed in and not yet received in callback.
>> VideoToolbox doesn't limit the number of frames in callback thread in
>> async mode.
> doc used to say that VTDecompressionSessionDecodeFrame will block when the
> internal queue is full in async mode. I haven't check if this is verified
> in practice though.

I was wrong. After a real test, I found out that
VTDecompressionSessionDecodeFrame does block when
there are several frames in VideoToolbox's internal queue.

But when I enter background by pressing home button while async-decoding.
VTB hangs for a while and returns kVTVideoDecoderMalfunctionErr.
So I have to track the number of frames in VTB's queue,
and limit it to 3 frames as a workaround in my own player.

I guess this problem may related to the app state.
But neither doc nor demo says anything about it.

More information about the ffmpeg-devel mailing list