[FFmpeg-devel] [PATCH] libavcodec/videotoolbox: let VideoToolbox choose a decoder for us

王 氚 ouchuanm at outlook.com
Sat Aug 1 19:09:40 EEST 2020


I’m just looking at the bug https://trac.ffmpeg.org/ticket/8789
And I found that in this case, VTDecompressionSessionCreate will fail and return  kVTVideoDecoderNotAvailableNowErr

While according to the document of [VTDecompressionSessionCreate], it is possible to give a null
And let videotoolbox to choose a decoder.
https://developer.apple.com/documentation/videotoolbox/1536134-vtdecompressionsessioncreate?language=occ

So I think it is worth to have a second try(if we fail to create decode session in the first time).
On Aug 1, 2020, 11:50 PM +0800, Mark Thompson <sw at jkqxz.net>, wrote:
> On 01/08/2020 16:25, Wang Chuan wrote:
> > If we fail to create a decoder specified by ourself, then try to
> > let VideoToolbox pick a proper one for us.
> >
> > Signed-off-by: Wang Chuan <ouchuanm at outlook.com>
> > ---
> > libavcodec/videotoolbox.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
> > index 8773de3393..9077647e25 100644
> > --- a/libavcodec/videotoolbox.c
> > +++ b/libavcodec/videotoolbox.c
> > @@ -837,6 +837,10 @@ static int videotoolbox_start(AVCodecContext *avctx)
> > &decoder_cb, // outputCallback
> > &videotoolbox->session); // decompressionSessionOut
> >
> > + // if we cannot create a decode session specified by ourself, then that videotoolbox pick one for us
> > + if (status == kVTVideoDecoderNotAvailableNowErr)
> > + status = VTDecompressionSessionCreate(NULL, videotoolbox->cm_fmt_desc, NULL, buf_attr, &decoder_cb, &videotoolbox->session);
> > +
> > if (decoder_spec)
> > CFRelease(decoder_spec);
> > if (buf_attr)
> >
>
> Can you explain why?
>
> Looking at the code, it seems like the main consequence of this is to allow decoders to be created which have not been given the extradata header, and that isn't obviously a positive change. (Does
> decoding a stream with a global header still work if this path is taken?)
>
> - Mark
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list