From cf3fc61fbe9d2331e631b0171bb66322782e0a70 Mon Sep 17 00:00:00 2001 From: Aaron Vaage Date: Fri, 25 May 2018 09:04:46 -0700 Subject: [PATCH] Fix incorrect data_reference_index in TextSampleEntry In the text sample box (for mp4) there was a value called "data_reference_index" that was never initialized. This meant that it took on various values can caused different results between runs. Change-Id: I4b18ac97ec4700f6e651b14898ef250713a4253c --- packager/media/formats/mp4/box_definitions.cc | 5 ++++- packager/media/formats/mp4/box_definitions.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packager/media/formats/mp4/box_definitions.cc b/packager/media/formats/mp4/box_definitions.cc index f28e287244..87a236d2b1 100644 --- a/packager/media/formats/mp4/box_definitions.cc +++ b/packager/media/formats/mp4/box_definitions.cc @@ -1895,7 +1895,10 @@ size_t WebVTTSourceLabelBox::ComputeSizeInternal() { return HeaderSize() + source_label.size(); } -TextSampleEntry::TextSampleEntry() : format(FOURCC_NULL) {} +// data_reference_index is 1-based and "dref" box is mandatory so it is +// always present. +TextSampleEntry::TextSampleEntry() + : format(FOURCC_NULL), data_reference_index(1u) {} TextSampleEntry::~TextSampleEntry() {} FourCC TextSampleEntry::BoxType() const { diff --git a/packager/media/formats/mp4/box_definitions.h b/packager/media/formats/mp4/box_definitions.h index 2c208594b0..a264eee185 100644 --- a/packager/media/formats/mp4/box_definitions.h +++ b/packager/media/formats/mp4/box_definitions.h @@ -377,6 +377,7 @@ struct TextSampleEntry : Box { // set to 'wvtt' to write WVTTSampleEntry; On read, it is recovered from box // header. FourCC format; + uint16_t data_reference_index; // Sub boxes for wvtt text sample entry.