Cleanup av1_decode_frame_headers_and_setup

This function is only called from aom_decode_frame_from_obus,
and takes in two parameters that are unrelated and should be
in obu.c.

Change-Id: Ic5c578670f21f9c85f581053b5e763f0814ac646
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index 2aa7c84..41114d7 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -5124,8 +5124,6 @@
 
 uint32_t av1_decode_frame_headers_and_setup(AV1Decoder *pbi,
                                             struct aom_read_bit_buffer *rb,
-                                            const uint8_t *data,
-                                            const uint8_t **p_data_end,
                                             int trailing_bits_present) {
   AV1_COMMON *const cm = &pbi->common;
   const int num_planes = av1_num_planes(cm);
@@ -5165,9 +5163,8 @@
         xd->cur_buf->y_crop_width, xd->cur_buf->y_crop_height);
   }
 
+  // Showing a frame directly.
   if (cm->show_existing_frame) {
-    // showing a frame directly
-    *p_data_end = data + uncomp_hdr_size;
     if (pbi->reset_decoder_state) {
       // Use the default frame context values.
       *cm->fc = *cm->default_frame_context;
diff --git a/av1/decoder/decodeframe.h b/av1/decoder/decodeframe.h
index 95b3c9f..46ae475 100644
--- a/av1/decoder/decodeframe.h
+++ b/av1/decoder/decodeframe.h
@@ -37,11 +37,8 @@
 
 // On success, returns the frame header size. On failure, calls
 // aom_internal_error and does not return.
-// TODO(wtc): Figure out and document the p_data_end parameter.
 uint32_t av1_decode_frame_headers_and_setup(struct AV1Decoder *pbi,
                                             struct aom_read_bit_buffer *rb,
-                                            const uint8_t *data,
-                                            const uint8_t **p_data_end,
                                             int trailing_bits_present);
 
 void av1_decode_tg_tiles_and_wrapup(struct AV1Decoder *pbi, const uint8_t *data,
diff --git a/av1/decoder/obu.c b/av1/decoder/obu.c
index de24adc..d3d1f0e 100644
--- a/av1/decoder/obu.c
+++ b/av1/decoder/obu.c
@@ -271,14 +271,20 @@
 }
 
 // On success, returns the frame header size. On failure, calls
-// aom_internal_error and does not return.
+// aom_internal_error and does not return. If show existing frame,
+// also marks the data processing to end after the frame header.
 static uint32_t read_frame_header_obu(AV1Decoder *pbi,
                                       struct aom_read_bit_buffer *rb,
                                       const uint8_t *data,
                                       const uint8_t **p_data_end,
                                       int trailing_bits_present) {
-  return av1_decode_frame_headers_and_setup(pbi, rb, data, p_data_end,
-                                            trailing_bits_present);
+  const uint32_t hdr_size =
+      av1_decode_frame_headers_and_setup(pbi, rb, trailing_bits_present);
+  const AV1_COMMON *cm = &pbi->common;
+  if (cm->show_existing_frame) {
+    *p_data_end = data + hdr_size;
+  }
+  return hdr_size;
 }
 
 // On success, returns the tile group header size. On failure, calls