And not just those with the old decode() API.

Signed-off-by: James Almer <jamr...@gmail.com>
---
 libavcodec/decode.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index d1aa183b78..b8c1862ad8 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -556,6 +556,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);
 
-- 
2.41.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to