Assert the ref_cnt_fb() call won't leak raw buffer

The decoder always calls decrease_ref_count() to decrement a frame
buffer's ref_count. The only exception is this ref_cnt_fb() call, which
decrements the ref_count directly.

decrease_ref_count() takes care of calling release_fb_cb(), so this
ref_cnt_fb() call may potentially leak a raw frame buffer. There are two
ways to address this.

1. Replace the ref_cnt_fb() call with equivalent code that calls
decrease_ref_count().

2. Verify that this ref_cnt_fb() call won't leak reference.

This CL does the latter. It adds assertions to verify that the current
cm->new_fb_idx has not yet allocated a raw frame buffer and therfore the
ref_cnt_fb() call won't leak a raw frame buffer.

BUG=aomedia:2179

Change-Id: I538b2344c8f964d057f913c73a357af8cc3a4c82
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index 2c8389d..2e96b60 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -4841,6 +4841,14 @@
                            "Buffer %d does not contain a decoded frame",
                            frame_to_show);
       }
+      // cm->new_fb_idx should be 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 should still be 1.
+      assert(frame_bufs[cm->new_fb_idx].ref_count == 1);
+      // ref_cnt_fb() decrements ref_count directly rather than call
+      // decrease_ref_count(). If frame_bufs[cm->new_fb_idx].raw_frame_buffer
+      // has already been allocated, it will not be released by ref_cnt_fb()!
+      assert(!frame_bufs[cm->new_fb_idx].raw_frame_buffer.data);
       ref_cnt_fb(frame_bufs, &cm->new_fb_idx, frame_to_show);
       cm->reset_decoder_state =
           frame_bufs[frame_to_show].frame_type == KEY_FRAME;