[FFmpeg-devel] [PATCH] avformat/utils: only call h264 decoder private function if h264 decoder is in use

Timo Rothenpieler timo at rothenpieler.org
Sun Sep 18 14:46:07 EEST 2016


Fixes a crash when decoding with for example h264_cuvid, as
avpriv_h264_has_num_reorder_frames assumes the AVCodecContext->priv_data
to be a H264Context.
---
 libavformat/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index d605a96..06003dd 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -935,7 +935,7 @@ static int has_decode_delay_been_guessed(AVStream *st)
     if (!st->info) // if we have left find_stream_info then nb_decoded_frames won't increase anymore for stream copy
         return 1;
 #if CONFIG_H264_DECODER
-    if (st->internal->avctx->has_b_frames &&
+    if (st->internal->avctx->has_b_frames && !strcmp(st->internal->avctx->codec->name, "h264") &&
        avpriv_h264_has_num_reorder_frames(st->internal->avctx) == st->internal->avctx->has_b_frames)
         return 1;
 #endif
-- 
2.10.0



More information about the ffmpeg-devel mailing list