[FFmpeg-cvslog] avcodec/decode: Return EAGAIN instead of discarding unused packet

Andreas Rheinhardt git at videolan.org
Mon Jul 10 17:42:53 EEST 2023


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Mon Jul 10 01:26:31 2023 +0200| [a92dbeb9ae520d39069381be528c5e8d4756da5f] | committer: Andreas Rheinhardt

avcodec/decode: Return EAGAIN instead of discarding unused packet

Should fix #10457, a regression caused by
69516ab3e917a6e91d26e38d04183c60fd71cbab.

Reviewed-by: Anton Khirnov <anton at khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a92dbeb9ae520d39069381be528c5e8d4756da5f
---

 libavcodec/decode.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 269633ce10..a47abeca06 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -666,7 +666,9 @@ int attribute_align_arg avcodec_send_packet(AVCodecContext *avctx, const AVPacke
     if (avpkt && !avpkt->size && avpkt->data)
         return AVERROR(EINVAL);
 
-    av_packet_unref(avci->buffer_pkt);
+    if (!AVPACKET_IS_EMPTY(avci->buffer_pkt))
+        return AVERROR(EAGAIN);
+
     if (avpkt && (avpkt->data || avpkt->side_data_elems)) {
         ret = av_packet_ref(avci->buffer_pkt, avpkt);
         if (ret < 0)



More information about the ffmpeg-cvslog mailing list