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

James Almer jamrial at gmail.com
Wed Sep 12 21:14:43 EEST 2018


This reverts commit f631c328e680a3dd491936b92f69970c20cdcfc7.

The avcodec_parameters_to_context() call was freeing and reallocating
AVCodecContext->extradata, essentially taking ownership of it, which according
to the doxy is user owned. This is an API break and has produces crashes in
some library users like Firefox[1].
Revert until a better solution is found to internally propagate the filtered
extradata back into the decoder context.

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1486080

Signed-off-by: James Almer <jamrial at gmail.com>
---
Also reported in
http://ffmpeg.org/pipermail/ffmpeg-devel/2018-August/233584.html

Commit 0c71c6d66f9ae8265158181e5b1cbc5c63525fde may have to be reverted as
well. It is also an API change to require av_malloc() to be used when users
have probably been using other allocators for years now, as was the case with
Firefox.

Suggestions to work around it are very welcome, of course. While no bitstream
filter currently autoinserted by a decoder requires the filtered extradata to
be propagated to work properly, we don't know what may be needed in the future,
and without this the usability of bsfs in decoders is potentially limited.

 libavcodec/decode.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 4607e9f318..2e82f6b506 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -281,10 +281,6 @@ int ff_decode_bsfs_init(AVCodecContext *avctx)
             bsfs_str++;
     }
 
-    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.19.0



More information about the ffmpeg-devel mailing list