ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinha...@outlook.com> | Mon Mar 10 16:14:26 2025 +0100| [3e19e5062c42c6edc901b36fb68ef89c0cb93d9d] | committer: Andreas Rheinhardt
avcodec/decode: Move is_open check to avcodec_receive_frame() It also applies to scenarios where ff_encode_receive_frame() is used. Also remove the redundant av_codec_is_decoder(). Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3e19e5062c42c6edc901b36fb68ef89c0cb93d9d --- libavcodec/avcodec.c | 3 +++ libavcodec/decode.c | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c index e7e2c09222..64c1788c57 100644 --- a/libavcodec/avcodec.c +++ b/libavcodec/avcodec.c @@ -718,6 +718,9 @@ int attribute_align_arg avcodec_receive_frame(AVCodecContext *avctx, AVFrame *fr { av_frame_unref(frame); + if (!avcodec_is_open(avctx)) + return AVERROR(EINVAL); + if (av_codec_is_decoder(avctx->codec)) return ff_decode_receive_frame(avctx, frame); return ff_encode_receive_frame(avctx, frame); diff --git a/libavcodec/decode.c b/libavcodec/decode.c index c5a577f4f1..3a1c35a55f 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -817,9 +817,6 @@ int ff_decode_receive_frame(AVCodecContext *avctx, AVFrame *frame) AVCodecInternal *avci = avctx->internal; int ret; - if (!avcodec_is_open(avctx) || !av_codec_is_decoder(avctx->codec)) - return AVERROR(EINVAL); - if (avci->buffer_frame->buf[0]) { av_frame_move_ref(frame, avci->buffer_frame); } else { _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".