diff --git a/libavcodec/d3d12va_vp9.c b/libavcodec/d3d12va_vp9.c
index bb94e18781..2ec6264121 100644
--- a/libavcodec/d3d12va_vp9.c
+++ b/libavcodec/d3d12va_vp9.c
@@ -148,7 +148,7 @@ static int d3d12va_vp9_decode_init(AVCodecContext *avctx)
         break;
     };
 
-    ctx->max_num_ref = FF_ARRAY_ELEMS(pp.frame_refs) + 1;
+    ctx->max_num_ref = FF_ARRAY_ELEMS(pp.frame_refs) + 3;
 
     return ff_d3d12va_decode_init(avctx);
 }
