Fix mp4 parsing failure if CTTS table is empty.

The original code assumes CompositionOffset is always valid and
has the same number of samples as other table, which is not true
if CTTS table is empty for non-fragmented mp4.

Change-Id: If4ecc1159de33202db4ab36df8e32c2a6900daf8
This commit is contained in:
Kongqun Yang 2014-01-10 16:27:58 -08:00
parent 0ccae0d0c9
commit a725f3fd02
1 changed files with 8 additions and 8 deletions

View File

@ -176,17 +176,17 @@ bool TrackRunIterator::Init() {
uint32 num_chunks = chunk_offset_vector.size();
// Check that total number of samples match.
DCHECK(num_samples == decoding_time.NumSamples() &&
num_samples == composition_offset.NumSamples() &&
(num_chunks == 0 ||
num_samples == chunk_info.NumSamples(1, num_chunks)) &&
num_chunks >= chunk_info.LastFirstChunk());
DCHECK_EQ(num_samples, decoding_time.NumSamples());
if (has_composition_offset)
DCHECK_EQ(num_samples, composition_offset.NumSamples());
if (num_chunks > 0)
DCHECK_EQ(num_samples, chunk_info.NumSamples(1, num_chunks));
DCHECK_GE(num_chunks, chunk_info.LastFirstChunk());
if (num_samples > 0) {
// Verify relevant tables are not empty.
RCHECK(decoding_time.IsValid() &&
composition_offset.IsValid() &&
chunk_info.IsValid());
RCHECK(decoding_time.IsValid());
RCHECK(chunk_info.IsValid());
}
uint32 sample_index = 0;