obu: Remove trailing_bits for OBU_FRAME

It is sufficient to have byte_alignment after the frame_header_obu
in an OBU_FRAME per the spec and as per the discussion in the bug.

BUG=aomedia:1712

Change-Id: I29e6d1b2513d1f1ad7cd86aec6dc5667af73217e
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index 7fba606..9649056 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -3250,7 +3250,8 @@
 int av1_decode_frame_headers_and_setup(AV1Decoder *pbi,
                                        struct aom_read_bit_buffer *rb,
                                        const uint8_t *data,
-                                       const uint8_t **p_data_end) {
+                                       const uint8_t **p_data_end,
+                                       int trailing_bits_present) {
   AV1_COMMON *const cm = &pbi->common;
   const int num_planes = av1_num_planes(cm);
   MACROBLOCKD *const xd = &pbi->mb;
@@ -3270,7 +3271,7 @@
 
   read_uncompressed_header(pbi, rb);
 
-  av1_check_trailing_bits(pbi, rb);
+  if (trailing_bits_present) av1_check_trailing_bits(pbi, rb);
 
   // If cm->single_tile_decoding = 0, the independent decoding of a single tile
   // or a section of a frame is not allowed.
diff --git a/av1/decoder/decodeframe.h b/av1/decoder/decodeframe.h
index d1e682c..e537f27 100644
--- a/av1/decoder/decodeframe.h
+++ b/av1/decoder/decodeframe.h
@@ -35,7 +35,8 @@
 int 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);
+                                       const uint8_t **p_data_end,
+                                       int trailing_bits_present);
 
 void av1_decode_tg_tiles_and_wrapup(struct AV1Decoder *pbi, const uint8_t *data,
                                     const uint8_t *data_end,
diff --git a/av1/decoder/obu.c b/av1/decoder/obu.c
index e84fa85..f376775 100644
--- a/av1/decoder/obu.c
+++ b/av1/decoder/obu.c
@@ -248,8 +248,10 @@
 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) {
-  av1_decode_frame_headers_and_setup(pbi, rb, data, p_data_end);
+                                      const uint8_t **p_data_end,
+                                      int trailing_bits_present) {
+  av1_decode_frame_headers_and_setup(pbi, rb, data, p_data_end,
+                                     trailing_bits_present);
   return (uint32_t)(pbi->uncomp_hdr_size);
 }
 
@@ -512,7 +514,8 @@
         // Only decode first frame header received
         if (!frame_header_received) {
           av1_init_read_bit_buffer(pbi, &rb, data, data_end);
-          frame_header_size = read_frame_header_obu(pbi, &rb, data, p_data_end);
+          frame_header_size = read_frame_header_obu(
+              pbi, &rb, data, p_data_end, obu_header.type != OBU_FRAME);
           frame_header_received = 1;
         }
         decoded_payload_size = frame_header_size;