[NORMATIVE] Fix av1_set_frame_refs()

Fix an issue where, if we ran out of "useful" forward references
and went into the fallback path (selecting the earliest reference
slot available), we would sometimes overwrite valid references
with the (less useful) fallback choice.

BUG=aomedia:1642

Change-Id: Ic2fccaebf0c4fb0db68c28f16eb353c6d3bd18cf
diff --git a/av1/common/mvref_common.c b/av1/common/mvref_common.c
index 1e2c73e..e8bd56f 100644
--- a/av1/common/mvref_common.c
+++ b/av1/common/mvref_common.c
@@ -1788,6 +1788,7 @@
   // Assign all the remaining frame(s), if any, to the earliest reference frame.
   for (; ref_idx < (INTER_REFS_PER_FRAME - 2); ref_idx++) {
     const MV_REFERENCE_FRAME ref_frame = ref_frame_list[ref_idx];
+    if (ref_flag_list[ref_frame - LAST_FRAME] == 1) continue;
     set_ref_frame_info(cm, ref_frame - LAST_FRAME,
                        &ref_frame_info[fwd_start_idx]);
     ref_flag_list[ref_frame - LAST_FRAME] = 1;