shithub: dav1d

Download patch

ref: 18335a4da039c59cd6bcbddc43faa54c6667069e
parent: 5f8b6d0cb95fd466cde010b45354b6dda519f221
author: James Almer <jamrial@gmail.com>
date: Wed Oct 24 10:07:09 EDT 2018

obu: don't abort OBU_REDUNDANT_FRAME_HDR if no frame header has been parsed

Parse and use it instead.

Signed-off-by: James Almer <jamrial@gmail.com>

--- a/src/obu.c
+++ b/src/obu.c
@@ -1049,10 +1049,13 @@
         c->have_seq_hdr = 1;
         c->have_frame_hdr = 0;
         break;
+    case OBU_REDUNDANT_FRAME_HDR:
+        if (c->have_frame_hdr) break;
+        // fall-through
     case OBU_FRAME:
     case OBU_FRAME_HDR:
         if (!c->have_seq_hdr) goto error;
-        if ((res = parse_frame_hdr(c, &gb, type == OBU_FRAME_HDR)) < 0)
+        if ((res = parse_frame_hdr(c, &gb, type != OBU_FRAME)) < 0)
             return res;
         c->have_frame_hdr = 1;
         for (int n = 0; n < c->n_tile_data; n++)
@@ -1059,7 +1062,7 @@
             dav1d_data_unref(&c->tile[n].data);
         c->n_tile_data = 0;
         c->n_tiles = 0;
-        if (type == OBU_FRAME_HDR) break;
+        if (type != OBU_FRAME) break;
         if (c->frame_hdr.show_existing_frame) goto error;
         off += res;
         // fall-through
@@ -1088,9 +1091,6 @@
         c->n_tiles += 1 + c->tile[c->n_tile_data].end -
                           c->tile[c->n_tile_data].start;
         c->n_tile_data++;
-        break;
-    case OBU_REDUNDANT_FRAME_HDR:
-        if (!c->have_frame_hdr) goto error;
         break;
     case OBU_PADDING:
     case OBU_TD: