Assert that frame_to_show has a positive ref_count

frame_to_show is an entry in the cm->ref_frame_map array. If
frame_to_show is not NULL, then it should point to a RefCntBuffer with a
positive ref_count.

Change-Id: If5dac3b63a9fac72d14444b95b1e7e8ec2840986
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index a06857c..ef1b17b 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -4827,6 +4827,10 @@
       // Show an existing frame directly.
       const int existing_frame_idx = aom_rb_read_literal(rb, 3);
       RefCntBuffer *const frame_to_show = cm->ref_frame_map[existing_frame_idx];
+      if (frame_to_show == NULL) {
+        aom_internal_error(&cm->error, AOM_CODEC_UNSUP_BITSTREAM,
+                           "Buffer does not contain a decoded frame");
+      }
       if (seq_params->decoder_model_info_present_flag &&
           cm->timing_info.equal_picture_interval == 0) {
         av1_read_temporal_point_info(cm, rb);
@@ -4842,11 +4846,7 @@
                              "Reference buffer frame ID mismatch");
       }
       lock_buffer_pool(pool);
-      if (frame_to_show == NULL || frame_to_show->ref_count < 1) {
-        unlock_buffer_pool(pool);
-        aom_internal_error(&cm->error, AOM_CODEC_UNSUP_BITSTREAM,
-                           "Buffer does not contain a decoded frame");
-      }
+      assert(frame_to_show->ref_count > 0);
       // cm->cur_frame should be the buffer referenced by the return value
       // of the get_free_fb() call in av1_receive_compressed_data(), and
       // generate_next_ref_frame_map() has not been called, so ref_count
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index b9d1124..4fc26d9 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -4608,10 +4608,11 @@
     RefCntBuffer *const frame_to_show =
         cm->ref_frame_map[cpi->existing_fb_idx_to_show];
 
-    if (frame_to_show == NULL || frame_to_show->ref_count < 1) {
+    if (frame_to_show == NULL) {
       aom_internal_error(&cm->error, AOM_CODEC_UNSUP_BITSTREAM,
                          "Buffer does not contain a reconstructed frame");
     }
+    assert(frame_to_show->ref_count > 0);
     assign_frame_buffer_p(&cm->cur_frame, frame_to_show);
     if (cm->reset_decoder_state && frame_to_show->frame_type != KEY_FRAME) {
       aom_internal_error(