From d49ea243eb949861d36bd0a936aa665a6798d422 Mon Sep 17 00:00:00 2001
From: John Stebbins <jstebbins.hb@gmail.com>
Date: Sun, 26 Feb 2017 12:42:01 -0700
Subject: [PATCH] vfr: fix invalid read/write

Probably the cause of crash seen in nightly builds

fixes https://github.com/HandBrake/HandBrake/issues/597
---
 libhb/vfr.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libhb/vfr.c b/libhb/vfr.c
index 81ab4183e..9f0e48263 100644
--- a/libhb/vfr.c
+++ b/libhb/vfr.c
@@ -349,9 +349,8 @@ static int hb_vfr_init(hb_filter_object_t *filter, hb_filter_init_t *init)
     hb_dict_extract_int(&pv->cfr, filter->settings, "mode");
     hb_dict_extract_rational(&pv->vrate, filter->settings, "rate");
 
-    // By default, we need at least 4 delay frames in order to smooth
-    // timestamp values
-    pv->frame_analysis_depth = 1;
+    // frame-drop analysis always looks at at least 2 buffers
+    pv->frame_analysis_depth = 2;
 
     // Calculate the number of frames we need to keep in order to
     // detect "best" candidate frames to drop.
-- 
2.40.0