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

Git pushed a commit to branch master
in repository ffmpeg.

The following commit(s) were added to refs/heads/master by this push:
     new 5f998e304d avcodec/nvenc: fix b_ref_mode capability check
5f998e304d is described below

commit 5f998e304dfd3fd6c0455447bffba45145ba027d
Author:     Timo Rothenpieler <[email protected]>
AuthorDate: Mon May 25 17:48:42 2026 +0200
Commit:     Timo Rothenpieler <[email protected]>
CommitDate: Wed Jun 10 20:17:44 2026 +0200

    avcodec/nvenc: fix b_ref_mode capability check
    
    Turns out it's a bitfield, not straight values.
    
    Fixes #23061
---
 libavcodec/nvenc.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 4c59034af7..6c948f2de8 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -591,12 +591,24 @@ static int nvenc_check_capabilities(AVCodecContext *avctx)
 #ifdef NVENC_HAVE_BFRAME_REF_MODE
     tmp = (ctx->b_ref_mode >= 0) ? ctx->b_ref_mode : 
NV_ENC_BFRAME_REF_MODE_DISABLED;
     ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_BFRAME_REF_MODE);
-    if (tmp == NV_ENC_BFRAME_REF_MODE_EACH && ret != 1 && ret != 3) {
-        av_log(avctx, AV_LOG_WARNING, "Each B frame as reference is not 
supported\n");
-        return AVERROR(ENOSYS);
-    } else if (tmp != NV_ENC_BFRAME_REF_MODE_DISABLED && ret == 0) {
-        av_log(avctx, AV_LOG_WARNING, "B frames as references are not 
supported\n");
-        return AVERROR(ENOSYS);
+    switch (tmp) {
+    case NV_ENC_BFRAME_REF_MODE_DISABLED:
+        break;
+    case NV_ENC_BFRAME_REF_MODE_EACH:
+        if (!(ret & 1)) {
+            av_log(avctx, AV_LOG_WARNING, "Each B frame reference mode is not 
supported\n");
+            return AVERROR(ENOSYS);
+        }
+        break;
+    case NV_ENC_BFRAME_REF_MODE_MIDDLE:
+        if (!(ret & 2)) {
+            av_log(avctx, AV_LOG_WARNING, "Middle B frame reference mode is 
not supported\n");
+            return AVERROR(ENOSYS);
+        }
+        break;
+    default:
+        av_log(avctx, AV_LOG_ERROR, "Unknown B frame reference mode!\n");
+        return AVERROR_BUG;
     }
 #else
     tmp = (ctx->b_ref_mode >= 0) ? ctx->b_ref_mode : 0;

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to