[FFmpeg-devel] [PATCH 2/2] avcodec/decode: don't discard the buffered packet if the underlying bsf can't take it

James Almer jamrial at gmail.com
Wed Jul 12 05:06:44 EEST 2023


Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavcodec/decode.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 239ad70b41..cd49cca7c2 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -242,7 +242,8 @@ int ff_decode_get_packet(AVCodecContext *avctx, AVPacket *pkt)
             (!AVPACKET_IS_EMPTY(avci->buffer_pkt) || dc->draining_started)) {
             ret = av_bsf_send_packet(avci->bsf, avci->buffer_pkt);
             if (ret < 0) {
-                av_packet_unref(avci->buffer_pkt);
+                if (ret != AVERROR(EAGAIN))
+                    av_packet_unref(avci->buffer_pkt);
                 return ret;
             }
 
-- 
2.41.0



More information about the ffmpeg-devel mailing list