diff --git a/packager/media/base/buffer_writer.cc b/packager/media/base/buffer_writer.cc index 31570770cf..6194d4f900 100644 --- a/packager/media/base/buffer_writer.cc +++ b/packager/media/base/buffer_writer.cc @@ -64,6 +64,7 @@ void BufferWriter::AppendBuffer(const BufferWriter& buffer) { Status BufferWriter::WriteToFile(File* file) { DCHECK(file); + DCHECK(!buf_.empty()); size_t remaining_size = buf_.size(); const uint8_t* buf = &buf_[0]; diff --git a/packager/media/base/offset_byte_queue.cc b/packager/media/base/offset_byte_queue.cc index b05a300b20..3e45dedcaa 100644 --- a/packager/media/base/offset_byte_queue.cc +++ b/packager/media/base/offset_byte_queue.cc @@ -39,7 +39,7 @@ void OffsetByteQueue::Pop(int count) { } void OffsetByteQueue::PeekAt(int64_t offset, const uint8_t** buf, int* size) { - DCHECK(offset >= head()); + DCHECK_GE(offset, head()); if (offset < head() || offset >= tail()) { *buf = NULL; *size = 0; diff --git a/packager/media/formats/mp4/multi_segment_segmenter.cc b/packager/media/formats/mp4/multi_segment_segmenter.cc index 1c2b2a2d45..89a3e16f41 100644 --- a/packager/media/formats/mp4/multi_segment_segmenter.cc +++ b/packager/media/formats/mp4/multi_segment_segmenter.cc @@ -159,9 +159,8 @@ Status MultiSegmentSegmenter::WriteSegment() { styp_->Write(buffer.get()); } - // 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) + // If num_subsegments_per_sidx is negative, no SIDX box is generated. + if (options().num_subsegments_per_sidx >= 0) sidx()->Write(buffer.get()); const size_t segment_size = buffer->Size() + fragment_buffer()->Size(); diff --git a/packager/mpd/base/mpd_builder.cc b/packager/mpd/base/mpd_builder.cc index a78b5f9c08..96a161aa71 100644 --- a/packager/mpd/base/mpd_builder.cc +++ b/packager/mpd/base/mpd_builder.cc @@ -183,16 +183,6 @@ bool WriteXmlCharArrayToOutput(xmlChar* doc, } // namespace -MpdOptions::MpdOptions() - : availability_time_offset(0), - minimum_update_period(0), - // TODO(tinskip): Set min_buffer_time in unit tests rather than here. - min_buffer_time(2.0), - time_shift_buffer_depth(0), - suggested_presentation_delay(0) {} - -MpdOptions::~MpdOptions() {} - MpdBuilder::MpdBuilder(MpdType type, const MpdOptions& mpd_options) : type_(type), mpd_options_(mpd_options), diff --git a/packager/mpd/base/mpd_builder.h b/packager/mpd/base/mpd_builder.h index 6df66d89b4..440b4f81ed 100644 --- a/packager/mpd/base/mpd_builder.h +++ b/packager/mpd/base/mpd_builder.h @@ -22,6 +22,7 @@ #include "packager/mpd/base/bandwidth_estimator.h" #include "packager/mpd/base/content_protection_element.h" #include "packager/mpd/base/media_info.pb.h" +#include "packager/mpd/base/mpd_options.h" #include "packager/mpd/base/mpd_utils.h" #include "packager/mpd/base/segment_info.h" #include "packager/mpd/base/xml/scoped_xml_ptr.h" @@ -45,17 +46,6 @@ class RepresentationXmlNode; } // namespace xml -struct MpdOptions { - MpdOptions(); - ~MpdOptions(); - - double availability_time_offset; - double minimum_update_period; - double min_buffer_time; - double time_shift_buffer_depth; - double suggested_presentation_delay; -}; - /// This class generates DASH MPDs (Media Presentation Descriptions). class MpdBuilder { public: diff --git a/packager/mpd/base/mpd_options.h b/packager/mpd/base/mpd_options.h new file mode 100644 index 0000000000..9b4c83fddc --- /dev/null +++ b/packager/mpd/base/mpd_options.h @@ -0,0 +1,34 @@ +// Copyright 2014 Google Inc. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + +#ifndef MPD_BASE_MPD_OPTIONS_H_ +#define MPD_BASE_MPD_OPTIONS_H_ + +namespace edash_packager { + +/// Defines Mpd Options. +struct MpdOptions { + MpdOptions() + : availability_time_offset(0), + minimum_update_period(0), + // TODO(tinskip): Set min_buffer_time in unit tests rather than here. + min_buffer_time(2.0), + time_shift_buffer_depth(0), + suggested_presentation_delay(0) {} + + ~MpdOptions() {}; + + double availability_time_offset; + double minimum_update_period; + double min_buffer_time; + double time_shift_buffer_depth; + double suggested_presentation_delay; +}; + +} // namespace edash_packager + +#endif // MPD_BASE_MPD_OPTIONS_H_ + diff --git a/packager/mpd/mpd.gyp b/packager/mpd/mpd.gyp index 5af2ccfb38..9c6d93dd19 100644 --- a/packager/mpd/mpd.gyp +++ b/packager/mpd/mpd.gyp @@ -40,6 +40,7 @@ 'base/mpd_builder.cc', 'base/mpd_builder.h', 'base/mpd_notifier.h', + 'base/mpd_options.h', 'base/mpd_utils.cc', 'base/mpd_utils.h', 'base/segment_info.h',