On 7/12/2023 6:08 AM, Anton Khirnov wrote:
Quoting James Almer (2023-07-12 04:06:44)
Signed-off-by: James Almer <[email protected]>
---
  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);

It seems very wrong for ff_decode_get_packet() to return EAGAIN when
we have a buffered packet.

The idea is preventing dropping a packet in the hypothetical case the bsf can't take it. Is this scenario possible, or is the call to av_bsf_receive_packet() within the loop ensuring it wont?
_______________________________________________
ffmpeg-devel mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to