James Almer
2018-09-12 18:24:40 UTC
This reverts commit 662558f985f50834eebe82d6b6854c66f33ab320.
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.
Revert until a better solution is found to internally propagate the filtered
extradata back into the decoder context.
Signed-off-by: James Almer <***@gmail.com>
---
See https://bugzilla.mozilla.org/show_bug.cgi?id=1486080
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 d10a2c8b5..2dab7f2a7 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -221,10 +221,6 @@ int ff_decode_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);
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.
Revert until a better solution is found to internally propagate the filtered
extradata back into the decoder context.
Signed-off-by: James Almer <***@gmail.com>
---
See https://bugzilla.mozilla.org/show_bug.cgi?id=1486080
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 d10a2c8b5..2dab7f2a7 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -221,10 +221,6 @@ int ff_decode_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.19.0
2.19.0