[FFmpeg-devel] [PATCH] avcodec/decode: copy the output parameters from the last bsf in the chain back to the AVCodecContext

James Almer jamrial at gmail.com
Fri Jul 20 04:54:23 EEST 2018


Certain AVCodecParameters, like the contents of the extradata, may be changed
by the init() function of any of the bitstream filters in the chain.

Signed-off-by: James Almer <jamrial at gmail.com>
---
Things worked fine without this until now by pure chance. vp9_superframe_split
doesn't use extradata, and those hardware decoders inserting h264_mp4toannexb
and hevc_mp4toannexb passed the extradata to functions that could handle it
unfiltered.

 libavcodec/decode.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 6a3a4df179..0c8cdd5bd2 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -246,6 +246,10 @@ static int bsfs_init(AVCodecContext *avctx)
             goto fail;
     }
 
+    ret = avcodec_parameters_to_context(avctx, s->bsfs[s->nb_bsfs - 1]->par_out);
+    if (ret < 0)
+        return ret;
+
     return 0;
 fail:
     ff_decode_bsfs_uninit(avctx);
-- 
2.18.0



More information about the ffmpeg-devel mailing list