Fix build
- Use list of raw pointers instead of scoped_ptrs. - Use base::is_same instead of std::is_same. Change-Id: I0eea539584acf1f34da2b1ba069ba94e53bfa785
This commit is contained in:
parent
1d74988159
commit
ce55fbcae2
|
@ -123,7 +123,8 @@ HlsEntry::~HlsEntry() {}
|
||||||
MediaPlaylist::MediaPlaylist(const std::string& file_name,
|
MediaPlaylist::MediaPlaylist(const std::string& file_name,
|
||||||
const std::string& name,
|
const std::string& name,
|
||||||
const std::string& group_id)
|
const std::string& group_id)
|
||||||
: file_name_(file_name), name_(name), group_id_(group_id) {}
|
: file_name_(file_name), name_(name), group_id_(group_id),
|
||||||
|
entries_deleter_(&entries_) {}
|
||||||
MediaPlaylist::~MediaPlaylist() {}
|
MediaPlaylist::~MediaPlaylist() {}
|
||||||
|
|
||||||
void MediaPlaylist::SetTypeForTesting(MediaPlaylistType type) {
|
void MediaPlaylist::SetTypeForTesting(MediaPlaylistType type) {
|
||||||
|
@ -164,8 +165,7 @@ void MediaPlaylist::AddSegment(const std::string& file_name,
|
||||||
LOG(WARNING) << "Timescale is not set and the duration for " << duration
|
LOG(WARNING) << "Timescale is not set and the duration for " << duration
|
||||||
<< " cannot be calculated. The output will be wrong.";
|
<< " cannot be calculated. The output will be wrong.";
|
||||||
|
|
||||||
scoped_ptr<SegmentInfoEntry> info(new SegmentInfoEntry(file_name, 0.0));
|
entries_.push_back(new SegmentInfoEntry(file_name, 0.0));
|
||||||
entries_.push_back(info.Pass());
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,9 +177,7 @@ void MediaPlaylist::AddSegment(const std::string& file_name,
|
||||||
total_segments_size_ += size;
|
total_segments_size_ += size;
|
||||||
++total_num_segments_;
|
++total_num_segments_;
|
||||||
|
|
||||||
scoped_ptr<SegmentInfoEntry> info(
|
entries_.push_back(new SegmentInfoEntry(file_name, segment_duration));
|
||||||
new SegmentInfoEntry(file_name, segment_duration));
|
|
||||||
entries_.push_back(info.Pass());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(rkuroiwa): This works for single key format but won't work for multiple
|
// TODO(rkuroiwa): This works for single key format but won't work for multiple
|
||||||
|
@ -194,11 +192,12 @@ void MediaPlaylist::AddSegment(const std::string& file_name,
|
||||||
// invalidated.
|
// invalidated.
|
||||||
void MediaPlaylist::RemoveOldestSegment() {
|
void MediaPlaylist::RemoveOldestSegment() {
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<decltype(entries_), std::list<scoped_ptr<HlsEntry>>>::value,
|
base::is_same<decltype(entries_), std::list<HlsEntry*>>::value,
|
||||||
"This algorithm assumes std::list.");
|
"This algorithm assumes std::list.");
|
||||||
if (entries_.empty())
|
if (entries_.empty())
|
||||||
return;
|
return;
|
||||||
if (entries_.front()->type() == HlsEntry::EntryType::kExtInf) {
|
if (entries_.front()->type() == HlsEntry::EntryType::kExtInf) {
|
||||||
|
delete entries_.front();
|
||||||
entries_.pop_front();
|
entries_.pop_front();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -216,8 +215,10 @@ void MediaPlaylist::RemoveOldestSegment() {
|
||||||
auto entries_itr = entries_.begin();
|
auto entries_itr = entries_.begin();
|
||||||
++entries_itr;
|
++entries_itr;
|
||||||
if ((*entries_itr)->type() == HlsEntry::EntryType::kExtKey) {
|
if ((*entries_itr)->type() == HlsEntry::EntryType::kExtKey) {
|
||||||
|
delete entries_.front();
|
||||||
entries_.pop_front();
|
entries_.pop_front();
|
||||||
} else {
|
} else {
|
||||||
|
delete *entries_itr;
|
||||||
entries_.erase(entries_itr);
|
entries_.erase(entries_itr);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -227,6 +228,7 @@ void MediaPlaylist::RemoveOldestSegment() {
|
||||||
++entries_itr;
|
++entries_itr;
|
||||||
if ((*entries_itr)->type() == HlsEntry::EntryType::kExtInf) {
|
if ((*entries_itr)->type() == HlsEntry::EntryType::kExtInf) {
|
||||||
DCHECK((*entries_itr)->type() == HlsEntry::EntryType::kExtInf);
|
DCHECK((*entries_itr)->type() == HlsEntry::EntryType::kExtInf);
|
||||||
|
delete *entries_itr;
|
||||||
entries_.erase(entries_itr);
|
entries_.erase(entries_itr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -235,7 +237,9 @@ void MediaPlaylist::RemoveOldestSegment() {
|
||||||
// This assumes that there is a segment between 2 EXT-X-KEY entries.
|
// This assumes that there is a segment between 2 EXT-X-KEY entries.
|
||||||
// Which should be the case due to logic in AddEncryptionInfo().
|
// Which should be the case due to logic in AddEncryptionInfo().
|
||||||
DCHECK((*entries_itr)->type() == HlsEntry::EntryType::kExtInf);
|
DCHECK((*entries_itr)->type() == HlsEntry::EntryType::kExtInf);
|
||||||
|
delete *entries_itr;
|
||||||
entries_.erase(entries_itr);
|
entries_.erase(entries_itr);
|
||||||
|
delete entries_.front();
|
||||||
entries_.pop_front();
|
entries_.pop_front();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,9 +254,9 @@ void MediaPlaylist::AddEncryptionInfo(MediaPlaylist::EncryptionMethod method,
|
||||||
if (entries_.back()->type() == HlsEntry::EntryType::kExtKey)
|
if (entries_.back()->type() == HlsEntry::EntryType::kExtKey)
|
||||||
entries_.pop_back();
|
entries_.pop_back();
|
||||||
}
|
}
|
||||||
scoped_ptr<EncryptionInfoEntry> info(new EncryptionInfoEntry(
|
entries_.push_back(
|
||||||
method, url, iv, key_format, key_format_versions));
|
new EncryptionInfoEntry(
|
||||||
entries_.push_back(info.Pass());
|
method, url, iv, key_format, key_format_versions));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MediaPlaylist::WriteToFile(media::File* file) {
|
bool MediaPlaylist::WriteToFile(media::File* file) {
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
#include "packager/base/macros.h"
|
#include "packager/base/macros.h"
|
||||||
#include "packager/base/memory/scoped_ptr.h"
|
#include "packager/base/memory/scoped_ptr.h"
|
||||||
|
#include "packager/base/stl_util.h"
|
||||||
#include "packager/mpd/base/media_info.pb.h"
|
#include "packager/mpd/base/media_info.pb.h"
|
||||||
|
|
||||||
namespace edash_packager {
|
namespace edash_packager {
|
||||||
|
@ -164,7 +165,8 @@ class MediaPlaylist {
|
||||||
bool target_duration_set_ = false;
|
bool target_duration_set_ = false;
|
||||||
uint32_t target_duration_ = 0;
|
uint32_t target_duration_ = 0;
|
||||||
|
|
||||||
std::list<scoped_ptr<HlsEntry>> entries_;
|
std::list<HlsEntry*> entries_;
|
||||||
|
STLElementDeleter<decltype(entries_)> entries_deleter_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(MediaPlaylist);
|
DISALLOW_COPY_AND_ASSIGN(MediaPlaylist);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue