diff mbox

[FFmpeg-devel,1/5] avcodec/cbs_av1: support one byte long OBUs when the size is not set in the bitstream

Message ID 20191111133615.543-2-jamrial@gmail.com
State Accepted
Commit 245cbab556b88e5bd900da6708e7fe196b7ad8e5
Headers show

Commit Message

James Almer Nov. 11, 2019, 1:36 p.m. UTC
This was missed in 96717a42715fdcc2f93558206e24d6dfd26b8d58, and will be needed
by the next commit, where packets with a single Temporal Delimiter OBU with no
size need to be parsed.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/cbs_av1.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
diff mbox

Patch

diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
index c027933218..cca112ecf8 100644
--- a/libavcodec/cbs_av1.c
+++ b/libavcodec/cbs_av1.c
@@ -768,14 +768,13 @@  static int cbs_av1_split_fragment(CodedBitstreamContext *ctx,
         if (err < 0)
             goto fail;
 
-        if (get_bits_left(&gbc) < 8) {
-            av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid OBU: fragment "
-                   "too short (%"SIZE_SPECIFIER" bytes).\n", size);
-            err = AVERROR_INVALIDDATA;
-            goto fail;
-        }
-
         if (header.obu_has_size_field) {
+            if (get_bits_left(&gbc) < 8) {
+                av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid OBU: fragment "
+                       "too short (%"SIZE_SPECIFIER" bytes).\n", size);
+                err = AVERROR_INVALIDDATA;
+                goto fail;
+            }
             err = cbs_av1_read_leb128(ctx, &gbc, "obu_size", &obu_size);
             if (err < 0)
                 goto fail;