This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 1a4f09b4592ce52acfc8e9db7c6dcd542ac9ceb0
Author:     James Almer <[email protected]>
AuthorDate: Thu Sep 10 00:14:12 2026 -0300
Commit:     James Almer <[email protected]>
CommitDate: Fri Sep 11 13:22:28 2026 -0300

    avcodec/libxevd: fix draining code when unexpected codes are returned
    
    libxevd appears to return positive values other than XEVD_OK in some 
circumstances,
    which resulted in an endless loop of the decoder returning AVERROR_EXTERNAL 
until
    stopped.
    
    Signed-off-by: James Almer <[email protected]>
---
 libavcodec/libxevd.c | 36 ++++++++++++++++++++----------------
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/libavcodec/libxevd.c b/libavcodec/libxevd.c
index ab7a2ebee2..5810f6676c 100644
--- a/libavcodec/libxevd.c
+++ b/libavcodec/libxevd.c
@@ -435,28 +435,32 @@ static int libxevd_receive_frame(AVCodecContext *avctx, 
AVFrame *frame)
         }
     } else { // decoder draining mode handling
 
-        xevd_ret = xevd_pull(xectx->id, &imgb);
+        while (1) {
+            xevd_ret = xevd_pull(xectx->id, &imgb);
 
-        if (xevd_ret == XEVD_ERR_UNEXPECTED) { // draining process completed
-            av_log(avctx, AV_LOG_DEBUG, "Draining process completed\n");
+            if (xevd_ret == XEVD_ERR_UNEXPECTED) { // draining process 
completed
+                av_log(avctx, AV_LOG_DEBUG, "Draining process completed\n");
 
-            return AVERROR_EOF;
-        } else if (XEVD_FAILED(xevd_ret)) { // handle all other errors
-            av_log(avctx, AV_LOG_ERROR, "Failed to pull the decoded image 
(xevd error code: %d)\n", xevd_ret);
-
-            return AVERROR_EXTERNAL;
-        } else { // XEVD_OK
-            if (!imgb) {
-                av_log(avctx, AV_LOG_ERROR, "Invalid decoded image data\n");
+                return AVERROR_EOF;
+            } else if (XEVD_FAILED(xevd_ret)) { // handle all other errors
+                av_log(avctx, AV_LOG_ERROR, "Failed to pull the decoded image 
(xevd error code: %d)\n", xevd_ret);
 
                 return AVERROR_EXTERNAL;
-            }
+            } else if (xevd_ret == XEVD_OK) {
+                if (!imgb) {
+                    av_log(avctx, AV_LOG_ERROR, "Invalid decoded image 
data\n");
 
-            if (*(int*)imgb->pdata[1] == XEVD_ST_I) {
-                frame->pict_type = AV_PICTURE_TYPE_I;
-                frame->flags |= AV_FRAME_FLAG_KEY;
+                    continue;
+                }
+
+                if (*(int*)imgb->pdata[1] == XEVD_ST_I) {
+                    frame->pict_type = AV_PICTURE_TYPE_I;
+                    frame->flags |= AV_FRAME_FLAG_KEY;
+                }
+                return libxevd_return_frame(avctx, frame, imgb, NULL);
             }
-            return libxevd_return_frame(avctx, frame, imgb, NULL);
+            av_log(avctx, AV_LOG_WARNING, "Unexpected return code while 
draining (xevd error code: %d)\n", xevd_ret);
+            return AVERROR_EOF;
         }
     }
 

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to