Update MpdNotifier due to MpdBuilder change

Change-Id: I7bb391d6f6776c2355d76a90157b1fe9153f5474
This commit is contained in:
Kongqun Yang 2014-05-30 13:01:09 +08:00 committed by KongQun Yang
parent 8951894f13
commit df64029e47
4 changed files with 16 additions and 8 deletions

View File

@ -104,7 +104,8 @@ void MpdNotifyMuxerListener::OnNewSegment(uint64 start_time,
if (mpd_notifier_->dash_profile() != dash_packager::kLiveProfile) if (mpd_notifier_->dash_profile() != dash_packager::kLiveProfile)
return; return;
// TODO(kqyang): Check return result. // 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 } // namespace event

View File

@ -53,11 +53,13 @@ class MpdNotifier {
/// @param start_time is the start time of the new segment, in units of the /// @param start_time is the start time of the new segment, in units of the
/// stream's time scale. /// stream's time scale.
/// @param duration is the duration of the new segment, in units of the /// @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. /// @return true on success, false otherwise.
virtual bool NotifyNewSegment(uint32 container_id, virtual bool NotifyNewSegment(uint32 container_id,
uint64 start_time, uint64 start_time,
uint64 duration) = 0; uint64 duration,
uint64 size) = 0;
/// Adds content protection information to the MPD. /// Adds content protection information to the MPD.
/// @param container_id is the nummeric container ID obtained from calling /// @param container_id is the nummeric container ID obtained from calling

View File

@ -16,6 +16,7 @@ using media::File;
namespace dash_packager { namespace dash_packager {
SimpleMpdNotifier::SimpleMpdNotifier(DashProfile dash_profile, SimpleMpdNotifier::SimpleMpdNotifier(DashProfile dash_profile,
const MpdOptions& mpd_options,
const std::vector<std::string>& base_urls, const std::vector<std::string>& base_urls,
const std::string& output_path) const std::string& output_path)
: MpdNotifier(dash_profile), : MpdNotifier(dash_profile),
@ -23,7 +24,7 @@ SimpleMpdNotifier::SimpleMpdNotifier(DashProfile dash_profile,
mpd_builder_(new MpdBuilder(dash_profile == kLiveProfile mpd_builder_(new MpdBuilder(dash_profile == kLiveProfile
? MpdBuilder::kDynamic ? MpdBuilder::kDynamic
: MpdBuilder::kStatic, : MpdBuilder::kStatic,
MpdOptions())) { mpd_options)) {
DCHECK(dash_profile == kLiveProfile || dash_profile == kOnDemandProfile); DCHECK(dash_profile == kLiveProfile || dash_profile == kOnDemandProfile);
for (size_t i = 0; i < base_urls.size(); ++i) for (size_t i = 0; i < base_urls.size(); ++i)
mpd_builder_->AddBaseUrl(base_urls[i]); mpd_builder_->AddBaseUrl(base_urls[i]);
@ -69,7 +70,8 @@ bool SimpleMpdNotifier::NotifyNewContainer(const MediaInfo& media_info,
bool SimpleMpdNotifier::NotifyNewSegment(uint32 container_id, bool SimpleMpdNotifier::NotifyNewSegment(uint32 container_id,
uint64 start_time, uint64 start_time,
uint64 duration) { uint64 duration,
uint64 size) {
base::AutoLock auto_lock(lock_); base::AutoLock auto_lock(lock_);
RepresentationMap::iterator it = representation_map_.find(container_id); 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; LOG(ERROR) << "Unexpected container_id: " << container_id;
return false; return false;
} }
// TODO(kqyang): AddNewSegment() requires size for the third argument. it->second->AddNewSegment(start_time, duration, size);
// !it->second->AddNewSegment(start_time, duration);
return WriteMpdToFile(); return WriteMpdToFile();
} }

View File

@ -21,11 +21,14 @@ class AdaptationSet;
class MpdBuilder; class MpdBuilder;
class Representation; class Representation;
struct MpdOptions;
/// A simple MpdNotifier implementation which receives muxer listener event and /// A simple MpdNotifier implementation which receives muxer listener event and
/// generates an Mpd file. /// generates an Mpd file.
class SimpleMpdNotifier : public MpdNotifier { class SimpleMpdNotifier : public MpdNotifier {
public: public:
SimpleMpdNotifier(DashProfile dash_profile, SimpleMpdNotifier(DashProfile dash_profile,
const MpdOptions& mpd_options,
const std::vector<std::string>& base_urls, const std::vector<std::string>& base_urls,
const std::string& output_path); const std::string& output_path);
virtual ~SimpleMpdNotifier(); virtual ~SimpleMpdNotifier();
@ -37,7 +40,8 @@ class SimpleMpdNotifier : public MpdNotifier {
uint32* id) OVERRIDE; uint32* id) OVERRIDE;
virtual bool NotifyNewSegment(uint32 id, virtual bool NotifyNewSegment(uint32 id,
uint64 start_time, uint64 start_time,
uint64 duration) OVERRIDE; uint64 duration,
uint64 size) OVERRIDE;
virtual bool AddContentProtectionElement( virtual bool AddContentProtectionElement(
uint32 id, uint32 id,
const ContentProtectionElement& content_protection_element) OVERRIDE; const ContentProtectionElement& content_protection_element) OVERRIDE;