diff options
author | James Almer <jamrial@gmail.com> | 2023-07-09 10:39:16 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2023-07-14 13:58:10 -0300 |
commit | 94ac6475597ea4b5bf93d2072f518aaf25ef32b7 (patch) | |
tree | 6d31a1c2530a63f91e4aa1a5bd675c7b9312c7f3 /libavcodec/decode.c | |
parent | 7db4c3eaa656e8ddbde793da45697a1074a033fe (diff) | |
download | ffmpeg-94ac6475597ea4b5bf93d2072f518aaf25ef32b7.tar.gz |
avcodec/decode: check the output frame for discard samples with all decoders
And not just those with the old decode() API.
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/decode.c')
-rw-r--r-- | libavcodec/decode.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 7bf54b95d1..e2aebbbde4 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -597,6 +597,14 @@ static int decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame) if (codec->cb_type == FF_CODEC_CB_TYPE_RECEIVE_FRAME) { ret = codec->cb.receive_frame(avctx, frame); emms_c(); + if (!ret) { + if (avctx->codec->type == AVMEDIA_TYPE_VIDEO) + ret = (frame->flags & AV_FRAME_FLAG_DISCARD) ? AVERROR(EAGAIN) : 0; + else if (avctx->codec->type == AVMEDIA_TYPE_AUDIO) { + int64_t discarded_samples = 0; + ret = discard_samples(avctx, frame, &discarded_samples); + } + } } else ret = decode_simple_receive_frame(avctx, frame); |