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

Git pushed a commit to branch master
in repository ffmpeg.

commit 387a522106a72efa6d83a2b6061265d451db6896
Author:     Marton Balint <[email protected]>
AuthorDate: Sun Jan 11 22:15:27 2026 +0100
Commit:     Marton Balint <[email protected]>
CommitDate: Mon Jan 19 21:32:00 2026 +0000

    avcodec/libvpxdec: use codec capabilities to determine if external frame 
buffer can be used
    
    Previously we used the codec or at the time of decoding fb_priv for this, 
but
    fb_priv can be nonzero even if an external frame buffer is not set, so it's
    cleaner to use the capability flag directly.
    
    Also check the result of vpx_codec_set_frame_buffer_functions.
    
    Signed-off-by: Marton Balint <[email protected]>
---
 libavcodec/libvpxdec.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c
index b5898c6951..1257a3607c 100644
--- a/libavcodec/libvpxdec.c
+++ b/libavcodec/libvpxdec.c
@@ -102,8 +102,13 @@ static av_cold int vpx_init(AVCodecContext *avctx,
         return AVERROR(EINVAL);
     }
 
-    if (avctx->codec_id == AV_CODEC_ID_VP9)
-        vpx_codec_set_frame_buffer_functions(decoder, get_frame_buffer, 
release_frame_buffer, avctx->priv_data);
+    if (vpx_codec_get_caps(ctx->iface) & VPX_CODEC_CAP_EXTERNAL_FRAME_BUFFER) {
+        if (vpx_codec_set_frame_buffer_functions(decoder, get_frame_buffer, 
release_frame_buffer, avctx->priv_data)) {
+            vpx_codec_destroy(decoder);
+            av_log(avctx, AV_LOG_ERROR, "Failed to set frame buffer.\n");
+            return AVERROR_EXTERNAL;
+        }
+    }
 
     return 0;
 }
@@ -299,7 +304,7 @@ static int vpx_decode(AVCodecContext *avctx, AVFrame 
*picture,
         linesizes[3] =
             ctx->has_alpha_channel ? img_alpha->stride[VPX_PLANE_Y] : 0;
 
-        if (img->fb_priv && (!ctx->has_alpha_channel || img_alpha->fb_priv)) {
+        if (vpx_codec_get_caps(ctx->iface) & 
VPX_CODEC_CAP_EXTERNAL_FRAME_BUFFER) {
             ret = ff_decode_frame_props(avctx, picture);
             if (ret < 0)
                 return ret;

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

Reply via email to