mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-12 01:40:04 +01:00
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>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user