Refresh LAST_FRAME with error_resilient show_existing_frame

When error_resilient mode is disabled, the encoder side reference buffer
update for show_existing internal altref frames is handled as a special case,
where the ALTREF2_FRAME buffer is copied to the LAST_FRAME buffer. In
error_resilient mode, the show_existing_frame is re-encoded to avoid
producing an error_resilient frame with a dependency on previously
encoded frames. In this case, we still want to update LAST_FRAME, but
we want to do it from the current frame buffer rather than the
ALTREF2 buffer.

BUG=aomedia:2202, aomedia:2203

Change-Id: I99a7223ebbf145e1db0ae50a149584421f46c15f
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index 93b0bcf..ee8ba12 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -3491,7 +3491,10 @@
   // to decoder. Any change in the reference frame buffer can be done by
   // switching the virtual indices.
   if (cm->show_existing_frame) {
-    cpi->refresh_last_frame = 0;
+    // If we are not indicating to the decoder that this frame is
+    // a show_existing_frame, which occurs in error_resilient mode,
+    // we still want to refresh the LAST_FRAME.
+    cpi->refresh_last_frame = encode_show_existing_frame(cm) ? 0 : 1;
     cpi->refresh_golden_frame = 0;
     cpi->refresh_bwd_ref_frame = 0;
     cpi->refresh_alt2_ref_frame = 0;
@@ -3680,7 +3683,7 @@
     shift_last_ref_frames(cpi);
     cpi->ref_fb_idx[0] = tmp;
 
-    assert(cm->show_existing_frame == 0);
+    assert(encode_show_existing_frame(cm) == 0);
     memcpy(cpi->interp_filter_selected[LAST_FRAME],
            cpi->interp_filter_selected[0],
            sizeof(cpi->interp_filter_selected[0]));