From 1a08335a07adb4a60fc949a749b2dd71f5c11c02 Mon Sep 17 00:00:00 2001
From: Fiona Glaser <fiona@x264.com>
Date: Tue, 18 May 2010 11:53:32 -0700
Subject: [PATCH] Fix rc-lookahead in encoding options SEI in 2-pass with VBV

---
 encoder/ratecontrol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c
index 27975aa7..ce0399d7 100644
--- a/encoder/ratecontrol.c
+++ b/encoder/ratecontrol.c
@@ -674,7 +674,7 @@ int x264_ratecontrol_new( x264_t *h )
                 return -1;
             }
 
-            if( h->param.rc.b_mb_tree && ( p = strstr( opts, "rc_lookahead=" ) ) && sscanf( p, "rc_lookahead=%d", &i ) )
+            if( (h->param.rc.b_mb_tree || h->param.rc.i_vbv_buffer_size) && ( p = strstr( opts, "rc_lookahead=" ) ) && sscanf( p, "rc_lookahead=%d", &i ) )
                 h->param.rc.i_lookahead = i;
         }
 
-- 
2.40.0