Use kf distance to decide frame type

Use the distance from the previous key frame to decide the current
frame type.

Change-Id: Ib8041a2bc77cd89ab590b9573e3def1e825eb6d5
diff --git a/av1/encoder/pass2_strategy.c b/av1/encoder/pass2_strategy.c
index c118a44..4cfa9b7 100644
--- a/av1/encoder/pass2_strategy.c
+++ b/av1/encoder/pass2_strategy.c
@@ -1580,8 +1580,8 @@
 
   int flash_detected;
   int64_t gf_group_bits;
-  const int is_intra_only = frame_params->frame_type == KEY_FRAME ||
-                            frame_params->frame_type == INTRA_ONLY_FRAME;
+  const int is_intra_only =
+      rc->frames_since_key == 0 || frame_params->frame_type == INTRA_ONLY_FRAME;
   const int arf_active_or_kf = is_intra_only || rc->source_alt_ref_active;
 
   cpi->internal_altref_allowed = (gf_cfg->gf_max_pyr_height > 1);