aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2018-11-15 01:07:49 -0300
committerJames Almer <jamrial@gmail.com>2018-11-18 16:16:02 -0300
commit96717a42715fdcc2f93558206e24d6dfd26b8d58 (patch)
tree152886eb73a166de973e3fe848f991eb411228ca
parent31b79e0210c4184627b5971ce1e909e6de7df976 (diff)
downloadffmpeg-96717a42715fdcc2f93558206e24d6dfd26b8d58.tar.gz
avcodec/cbs_av1: don't abort when splitting Temporal Units containing OBUs with no obu_size field
The ISOBMFF and Matroska specs allow the last OBU in a Sample/Block to have obu_has_size_field equal to 0. Reviewed-by: Mark Thompson <sw@jkqxz.net> Signed-off-by: James Almer <jamrial@gmail.com>
-rw-r--r--libavcodec/cbs_av1.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
index ed5211be19..e02bc7027a 100644
--- a/libavcodec/cbs_av1.c
+++ b/libavcodec/cbs_av1.c
@@ -788,13 +788,6 @@ static int cbs_av1_split_fragment(CodedBitstreamContext *ctx,
if (err < 0)
goto fail;
- if (!header.obu_has_size_field) {
- av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid OBU for raw "
- "stream: size field must be present.\n");
- err = AVERROR_INVALIDDATA;
- goto fail;
- }
-
if (get_bits_left(&gbc) < 8) {
av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid OBU: fragment "
"too short (%zu bytes).\n", size);
@@ -802,9 +795,12 @@ static int cbs_av1_split_fragment(CodedBitstreamContext *ctx,
goto fail;
}
- err = cbs_av1_read_leb128(ctx, &gbc, "obu_size", &obu_size);
- if (err < 0)
- goto fail;
+ if (header.obu_has_size_field) {
+ err = cbs_av1_read_leb128(ctx, &gbc, "obu_size", &obu_size);
+ if (err < 0)
+ goto fail;
+ } else
+ obu_size = size - 1 - header.obu_extension_flag;
pos = get_bits_count(&gbc);
av_assert0(pos % 8 == 0 && pos / 8 <= size);