[FFmpeg-cvslog] avcodec/libdav1d: clear the buffered Dav1dData on decoding failure

James Almer git at videolan.org
Tue Dec 31 01:38:50 EET 2024


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Fri Dec 27 19:11:47 2024 -0300| [d1d9b0813a2a7e304cc29dba3b1380857d0f9816] | committer: James Almer

avcodec/libdav1d: clear the buffered Dav1dData on decoding failure

Should ensure avcodec_send_packet() doesn't return EAGAIN in scenarios where it's not
meant to (e.g., ffmpeg_dec.c where avcodec_receive_frame() is called in a loop to drain
all produced frames before trying to submit more packets).

Fixes ticket #11377.

Reviewed-by: Ronald S. Bultje <rsbultje at gmail.com>
Signed-off-by: James Almer <jamrial at gmail.com>

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

 libavcodec/libdav1d.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
index 546b42e9c6..ff67f44bd3 100644
--- a/libavcodec/libdav1d.c
+++ b/libavcodec/libdav1d.c
@@ -372,9 +372,10 @@ static int libdav1d_receive_frame_internal(AVCodecContext *c, Dav1dPicture *p)
 
     res = dav1d_get_picture(dav1d->c, p);
     if (res < 0) {
-        if (res == AVERROR(EINVAL))
+        if (res == AVERROR(EINVAL)) {
+            dav1d_data_unref(data);
             res = AVERROR_INVALIDDATA;
-        else if (res == AVERROR(EAGAIN))
+        } else if (res == AVERROR(EAGAIN))
             res = c->internal->draining ? AVERROR_EOF : 1;
     }
 



More information about the ffmpeg-cvslog mailing list