VideoToolbox doesn't allow us to specify an exact number of ref frames,
but it does allow an upper limit to be specified which is better than
nothing.

Signed-off-by: Cameron Gutman <aicomman...@gmail.com>
---
 libavcodec/videotoolboxenc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index da7b291b03..9605657712 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -1588,11 +1588,12 @@ static int vtenc_create_encoder(AVCodecContext   *avctx,
                                     vtctx->power_efficient ? kCFBooleanTrue : 
kCFBooleanFalse);
     }
 
-    if (vtctx->max_ref_frames > 0) {
+    if (vtctx->max_ref_frames > 0 || avctx->refs > 0) {
+        int max_ref_frames = avctx->refs > 0 ? avctx->refs : 
vtctx->max_ref_frames;
         status = set_encoder_int_property_or_log(avctx,
                                                  
compat_keys.kVTCompressionPropertyKey_ReferenceBufferCount,
                                                  "max_ref_frames",
-                                                 vtctx->max_ref_frames);
+                                                 max_ref_frames);
 
         if (status != 0) {
             return status;
@@ -2940,6 +2941,7 @@ static const FFCodecDefault vt_defaults[] = {
         {"b",    "0"},
         {"qmin", "-1"},
         {"qmax", "-1"},
+        {"refs", "0"},
         {NULL},
 };
 
-- 
2.43.0.windows.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to