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)
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

View File

@ -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

View File

@ -16,6 +16,7 @@ using media::File;
namespace dash_packager {
SimpleMpdNotifier::SimpleMpdNotifier(DashProfile dash_profile,
const MpdOptions& mpd_options,
const std::vector<std::string>& 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();
}

View File

@ -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<std::string>& 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;