Chromium Code Reviews| Index: media/formats/mp4/mp4_stream_parser.cc |
| diff --git a/media/formats/mp4/mp4_stream_parser.cc b/media/formats/mp4/mp4_stream_parser.cc |
| index 23f2d2401636e4634fbbe9afec29c335848f6d02..60a8e7eb04dd493aa3ca35f578bc5817fdadad35 100644 |
| --- a/media/formats/mp4/mp4_stream_parser.cc |
| +++ b/media/formats/mp4/mp4_stream_parser.cc |
| @@ -33,6 +33,10 @@ |
| namespace media { |
| namespace mp4 { |
| +namespace { |
| +const int kMaxEmptySampleLogs = 20; |
| +} |
|
wolenetz
2016/09/23 19:14:54
nit: // namespace
|
| + |
| MP4StreamParser::MP4StreamParser(const std::set<int>& audio_object_types, |
| bool has_sbr) |
| : state_(kWaitingForInit), |
| @@ -43,8 +47,8 @@ MP4StreamParser::MP4StreamParser(const std::set<int>& audio_object_types, |
| has_video_(false), |
| audio_object_types_(audio_object_types), |
| has_sbr_(has_sbr), |
| - num_top_level_box_skipped_(0) { |
| -} |
| + num_top_level_box_skipped_(0), |
|
wolenetz
2016/09/23 19:14:54
aside: this other counter is no longer used. we sh
|
| + num_emtpy_samples_skipped_(0) {} |
| MP4StreamParser::~MP4StreamParser() {} |
| @@ -557,6 +561,16 @@ bool MP4StreamParser::EnqueueSample(BufferQueueMap* buffers, bool* err) { |
| queue_.PeekAt(runs_->sample_offset() + moof_head_, &buf, &buf_size); |
| if (buf_size < runs_->sample_size()) return false; |
| + if (runs_->sample_size() == 0) { |
| + // Generally not expected, but spec allows it. Code below this block assumes |
| + // the current sample is not empty. |
| + LIMITED_MEDIA_LOG(DEBUG, media_log_, num_emtpy_samples_skipped_, |
| + kMaxEmptySampleLogs) |
| + << " Skipping 'trun' sample with size of 0."; |
| + runs_->AdvanceSample(); |
| + return true; |
| + } |
| + |
| std::unique_ptr<DecryptConfig> decrypt_config; |
| std::vector<SubsampleEntry> subsamples; |
| if (runs_->is_encrypted()) { |