You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
lavc/avcodec: only allocate decoding packets for decoders
This commit is contained in:
@@ -155,12 +155,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
|
||||
|
||||
avci->buffer_frame = av_frame_alloc();
|
||||
avci->buffer_pkt = av_packet_alloc();
|
||||
avci->in_pkt = av_packet_alloc();
|
||||
avci->last_pkt_props = av_packet_alloc();
|
||||
avci->pkt_props = av_fifo_alloc2(1, sizeof(*avci->last_pkt_props),
|
||||
AV_FIFO_FLAG_AUTO_GROW);
|
||||
if (!avci->buffer_frame || !avci->buffer_pkt ||
|
||||
!avci->in_pkt || !avci->last_pkt_props || !avci->pkt_props) {
|
||||
if (!avci->buffer_frame || !avci->buffer_pkt) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto free_and_end;
|
||||
}
|
||||
|
@@ -1527,6 +1527,7 @@ int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
|
||||
|
||||
int ff_decode_preinit(AVCodecContext *avctx)
|
||||
{
|
||||
AVCodecInternal *avci = avctx->internal;
|
||||
int ret = 0;
|
||||
|
||||
/* if the decoder init function was already called previously,
|
||||
@@ -1605,6 +1606,13 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
avctx->export_side_data |= AV_CODEC_EXPORT_DATA_MVS;
|
||||
}
|
||||
|
||||
avci->in_pkt = av_packet_alloc();
|
||||
avci->last_pkt_props = av_packet_alloc();
|
||||
avci->pkt_props = av_fifo_alloc2(1, sizeof(*avci->last_pkt_props),
|
||||
AV_FIFO_FLAG_AUTO_GROW);
|
||||
if (!avci->in_pkt || !avci->last_pkt_props || !avci->pkt_props)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
ret = decode_bsfs_init(avctx);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
Reference in New Issue
Block a user