diff --git a/media/event/mpd_notify_muxer_listener.cc b/media/event/mpd_notify_muxer_listener.cc index be4f69f755..28c518aa81 100644 --- a/media/event/mpd_notify_muxer_listener.cc +++ b/media/event/mpd_notify_muxer_listener.cc @@ -104,7 +104,8 @@ void MpdNotifyMuxerListener::OnNewSegment(uint64 start_time, if (mpd_notifier_->dash_profile() != dash_packager::kLiveProfile) return; // TODO(kqyang): Check return result. - mpd_notifier_->NotifyNewSegment(notification_id_, start_time, duration); + mpd_notifier_->NotifyNewSegment( + notification_id_, start_time, duration, segment_file_size); } } // namespace event diff --git a/mpd/base/mpd_notifier.h b/mpd/base/mpd_notifier.h index ec8c635b3d..0131abe505 100644 --- a/mpd/base/mpd_notifier.h +++ b/mpd/base/mpd_notifier.h @@ -53,11 +53,13 @@ class MpdNotifier { /// @param start_time is the start time of the new segment, in units of the /// stream's time scale. /// @param duration is the duration of the new segment, in units of the - /// stream's time scale.. + /// stream's time scale. + /// @param size is the new segment size in bytes. /// @return true on success, false otherwise. virtual bool NotifyNewSegment(uint32 container_id, uint64 start_time, - uint64 duration) = 0; + uint64 duration, + uint64 size) = 0; /// Adds content protection information to the MPD. /// @param container_id is the nummeric container ID obtained from calling diff --git a/mpd/base/simple_mpd_notifier.cc b/mpd/base/simple_mpd_notifier.cc index b96947a4d4..a13299b378 100644 --- a/mpd/base/simple_mpd_notifier.cc +++ b/mpd/base/simple_mpd_notifier.cc @@ -16,6 +16,7 @@ using media::File; namespace dash_packager { SimpleMpdNotifier::SimpleMpdNotifier(DashProfile dash_profile, + const MpdOptions& mpd_options, const std::vector& base_urls, const std::string& output_path) : MpdNotifier(dash_profile), @@ -23,7 +24,7 @@ SimpleMpdNotifier::SimpleMpdNotifier(DashProfile dash_profile, mpd_builder_(new MpdBuilder(dash_profile == kLiveProfile ? MpdBuilder::kDynamic : MpdBuilder::kStatic, - MpdOptions())) { + mpd_options)) { DCHECK(dash_profile == kLiveProfile || dash_profile == kOnDemandProfile); for (size_t i = 0; i < base_urls.size(); ++i) mpd_builder_->AddBaseUrl(base_urls[i]); @@ -69,7 +70,8 @@ bool SimpleMpdNotifier::NotifyNewContainer(const MediaInfo& media_info, bool SimpleMpdNotifier::NotifyNewSegment(uint32 container_id, uint64 start_time, - uint64 duration) { + uint64 duration, + uint64 size) { base::AutoLock auto_lock(lock_); RepresentationMap::iterator it = representation_map_.find(container_id); @@ -77,8 +79,7 @@ bool SimpleMpdNotifier::NotifyNewSegment(uint32 container_id, LOG(ERROR) << "Unexpected container_id: " << container_id; return false; } - // TODO(kqyang): AddNewSegment() requires size for the third argument. - // !it->second->AddNewSegment(start_time, duration); + it->second->AddNewSegment(start_time, duration, size); return WriteMpdToFile(); } diff --git a/mpd/base/simple_mpd_notifier.h b/mpd/base/simple_mpd_notifier.h index d50b66dfdd..16d9597f51 100644 --- a/mpd/base/simple_mpd_notifier.h +++ b/mpd/base/simple_mpd_notifier.h @@ -21,11 +21,14 @@ class AdaptationSet; class MpdBuilder; class Representation; +struct MpdOptions; + /// A simple MpdNotifier implementation which receives muxer listener event and /// generates an Mpd file. class SimpleMpdNotifier : public MpdNotifier { public: SimpleMpdNotifier(DashProfile dash_profile, + const MpdOptions& mpd_options, const std::vector& base_urls, const std::string& output_path); virtual ~SimpleMpdNotifier(); @@ -37,7 +40,8 @@ class SimpleMpdNotifier : public MpdNotifier { uint32* id) OVERRIDE; virtual bool NotifyNewSegment(uint32 id, uint64 start_time, - uint64 duration) OVERRIDE; + uint64 duration, + uint64 size) OVERRIDE; virtual bool AddContentProtectionElement( uint32 id, const ContentProtectionElement& content_protection_element) OVERRIDE;