diff options
author | James Almer <jamrial@gmail.com> | 2018-07-27 02:42:27 +0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2018-08-17 05:43:12 +0300 |
commit | 94fe138de0ba5892a7051f5b47c191a41b78805a (patch) | |
tree | 93760c3bab76f3630feebf71085277479eaa0b6a /libavcodec/utils.c | |
parent | 2954e513930f9b1bc2cfba49eed3fc1911e76892 (diff) |
avcodec/decode: flush the internal bsfs instead of constantly reinitalizing them
Initialize the bsfs once when opening the codec and uninitialize them once when
closing it, instead of at every codec flush/seek.
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 4f9a2b76ef..285bfdbc63 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -727,6 +727,12 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code goto free_and_end; } + if (av_codec_is_decoder(avctx->codec)) { + ret = ff_decode_bsfs_init(avctx); + if (ret < 0) + goto free_and_end; + } + if (HAVE_THREADS && !(avctx->internal->frame_thread_encoder && (avctx->active_thread_type&FF_THREAD_FRAME))) { ret = ff_thread_init(avctx); @@ -1032,6 +1038,7 @@ FF_ENABLE_DEPRECATION_WARNINGS av_packet_free(&avctx->internal->last_pkt_props); av_packet_free(&avctx->internal->ds.in_pkt); + ff_decode_bsfs_uninit(avctx); av_freep(&avctx->internal->pool); } |