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

Git pushed a commit to branch master
in repository ffmpeg.

commit 51538457af06fc390f19720465c05ba9663aaa69
Author:     Wassim Lalaoui <[email protected]>
AuthorDate: Fri Jul 10 16:07:26 2026 +0200
Commit:     Kacper Michajłow <[email protected]>
CommitDate: Tue Sep 22 07:46:17 2026 +0000

    avcodec/av1dec: renegotiate the hwaccel when the pixel format changes
    
    get_pixel_format() kept the negotiated hwaccel whenever avctx->pix_fmt
    was still among the candidate formats of the new sequence header, even
    if the underlying sw pixel format changed. The existing decoder surfaces
    then have the wrong format, so only keep the current hwaccel when the sw
    pixel format matches the one it was negotiated for and do a full
    renegotiation otherwise.
---
 libavcodec/av1dec.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
index e08dbddc48..800e882d72 100644
--- a/libavcodec/av1dec.c
+++ b/libavcodec/av1dec.c
@@ -677,11 +677,14 @@ static int get_pixel_format(AVCodecContext *avctx)
     *fmtp++ = pix_fmt;
     *fmtp = AV_PIX_FMT_NONE;
 
-    for (int i = 0; pix_fmts[i] != pix_fmt; i++)
-        if (pix_fmts[i] == avctx->pix_fmt) {
-            s->pix_fmt = pix_fmt;
-            return 1;
-        }
+    /* the negotiated hwaccel can only be kept if the underlying pixel
+     * format did not change, otherwise its surfaces have the wrong format */
+    if (pix_fmt == avctx->sw_pix_fmt)
+        for (int i = 0; pix_fmts[i] != pix_fmt; i++)
+            if (pix_fmts[i] == avctx->pix_fmt) {
+                s->pix_fmt = pix_fmt;
+                return 1;
+            }
 
     ret = ff_get_format(avctx, pix_fmts);
 

-- 
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