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 <ouchu...@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)
-- 
2.27.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to