Bug 1380118 - Fix stream info peeking. draft
authorSebastien Alaiwan <sebastien.alaiwan@allegrodvt.com>
Mon, 07 Aug 2017 09:37:52 +0200
changeset 643642 a43942589979fdb9f9bf16a0f7a438280a7fd6e7
parent 643641 d9b57538e3aa62bcbbd8b32988f1228e2a065692
child 643643 2399ab47ecfca471a31870f480cfec9a0307a641
push id73163
push userbmo:giles@thaumas.net
push dateThu, 10 Aug 2017 00:19:36 +0000
bugs1380118
milestone57.0a1
Bug 1380118 - Fix stream info peeking. Backport upstream patch by Sebastian Alaiwan fixing aom_peek_stream_info after changes to the superblock location. BUG=aomedia:681 Change-Id: Iefce035d633d1533c8400d85b3257971757160bc MozReview-Commit-ID: 7QEnDrpVFkC
third_party/aom/av1/av1_dx_iface.c
--- a/third_party/aom/av1/av1_dx_iface.c
+++ b/third_party/aom/av1/av1_dx_iface.c
@@ -213,16 +213,29 @@ static aom_codec_err_t decoder_peek_si_i
   si->w = si->h = 0;
 
   if (decrypt_cb) {
     data_sz = AOMMIN(sizeof(clear_buffer), data_sz);
     decrypt_cb(decrypt_state, data, clear_buffer, data_sz);
     data = clear_buffer;
   }
 
+  // skip a potential superframe index
+  {
+    uint32_t frame_sizes[8];
+    int frame_count;
+    int index_size = 0;
+    aom_codec_err_t res = av1_parse_superframe_index(
+        data, data_sz, frame_sizes, &frame_count, &index_size, NULL, NULL);
+    if (res != AOM_CODEC_OK) return res;
+
+    data += index_size;
+    data_sz -= index_size;
+  }
+
   {
     int show_frame;
     int error_resilient;
     struct aom_read_bit_buffer rb = { data, data + data_sz, 0, NULL, NULL };
     const int frame_marker = aom_rb_read_literal(&rb, 2);
     const BITSTREAM_PROFILE profile = av1_read_profile(&rb);
 #if CONFIG_EXT_TILE
     unsigned int large_scale_tile;