From 2d3927e7cb2c4ed4de7c1c47fc186a34caab63f7 Mon Sep 17 00:00:00 2001 From: Thomas Inskip Date: Wed, 3 Dec 2014 15:33:16 -0800 Subject: [PATCH] Support WVM indexes which span multiple PES packets. Change-Id: Iffb68e97f2613ebbc4e12d4226bed388bc444e76 --- packager/media/formats/wvm/wvm_media_parser.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packager/media/formats/wvm/wvm_media_parser.cc b/packager/media/formats/wvm/wvm_media_parser.cc index 746ba6d0f6..7c59c054dc 100644 --- a/packager/media/formats/wvm/wvm_media_parser.cc +++ b/packager/media/formats/wvm/wvm_media_parser.cc @@ -429,8 +429,6 @@ bool WvmMediaParser::Parse(const uint8_t* buf, int size) { if (!ParseIndexEntry()) { return false; } - index_program_id_++; - index_data_.clear(); } } read_ptr += num_bytes; @@ -553,7 +551,8 @@ bool WvmMediaParser::ParseIndexEntry() { if (version == kVersion4) { index_size = kIndexVersion4HeaderSize + ntohlFromBuffer(read_ptr_index); if (index_data_.size() < index_size) { - return false; + // We do not yet have the full index. Keep accumulating index data. + return true; } read_ptr_index += sizeof(uint32_t); @@ -722,7 +721,10 @@ bool WvmMediaParser::ParseIndexEntry() { base::UintToString(audio_pes_stream_id)] = stream_id_count_++; } - } + } + + index_program_id_++; + index_data_.clear(); return true; }