diff mbox series

[FFmpeg-devel,2/3] avcodec/decode: check the output frame for discard samples with all decoders

Message ID 20230708190038.24324-2-jamrial@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/3] avcodec/decode: move processing discard samples to its own function | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

James Almer July 8, 2023, 7 p.m. UTC
And not just those with the old decode() API.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/decode.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 793ab975f6..49c8b7e0f4 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -594,8 +594,11 @@  static int decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
     av_assert0(!frame->buf[0]);
 
     if (codec->cb_type == FF_CODEC_CB_TYPE_RECEIVE_FRAME) {
+        int64_t discarded_samples = 0;
         ret = codec->cb.receive_frame(avctx, frame);
         emms_c();
+        if (!ret)
+            ret = discard_samples(avctx, frame, &discarded_samples);
     } else
         ret = decode_simple_receive_frame(avctx, frame);