From 05db9e02b94aebb88801d74b52fe1953a7c24c46 Mon Sep 17 00:00:00 2001 From: KongQun Yang Date: Thu, 17 Jul 2014 17:27:05 -0700 Subject: [PATCH] Generate sidx box only if there are more than one entries Change-Id: If7d7440f18e8b50a3261e18138b1a40bd754aba7 --- media/formats/mp4/multi_segment_segmenter.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/media/formats/mp4/multi_segment_segmenter.cc b/media/formats/mp4/multi_segment_segmenter.cc index 8744a18c4c..76fbb06b81 100644 --- a/media/formats/mp4/multi_segment_segmenter.cc +++ b/media/formats/mp4/multi_segment_segmenter.cc @@ -158,8 +158,9 @@ Status MultiSegmentSegmenter::WriteSegment() { styp_->Write(buffer.get()); } - // If num_subsegments_per_sidx is negative, no SIDX box is generated. - if (options().num_subsegments_per_sidx >= 0) + // Generate sidx box only if |num_subsegments_per_sidx| is non-negative and + // the box contains multiple entries. + if (options().num_subsegments_per_sidx >= 0 && sidx()->references.size() > 1) sidx()->Write(buffer.get()); const size_t segment_size = buffer->Size() + fragment_buffer()->Size();