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,
|
||||
const std::string& name,
|
||||
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() {}
|
||||
|
||||
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
|
||||
<< " cannot be calculated. The output will be wrong.";
|
||||
|
||||
scoped_ptr<SegmentInfoEntry> info(new SegmentInfoEntry(file_name, 0.0));
|
||||
entries_.push_back(info.Pass());
|
||||
entries_.push_back(new SegmentInfoEntry(file_name, 0.0));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -177,9 +177,7 @@ void MediaPlaylist::AddSegment(const std::string& file_name,
|
|||
total_segments_size_ += size;
|
||||
++total_num_segments_;
|
||||
|
||||
scoped_ptr<SegmentInfoEntry> info(
|
||||
new SegmentInfoEntry(file_name, segment_duration));
|
||||
entries_.push_back(info.Pass());
|
||||
entries_.push_back(new SegmentInfoEntry(file_name, segment_duration));
|
||||
}
|
||||
|
||||
// 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.
|
||||
void MediaPlaylist::RemoveOldestSegment() {
|
||||
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.");
|
||||
if (entries_.empty())
|
||||
return;
|
||||
if (entries_.front()->type() == HlsEntry::EntryType::kExtInf) {
|
||||
delete entries_.front();
|
||||
entries_.pop_front();
|
||||
return;
|
||||
}
|
||||
|
@ -216,8 +215,10 @@ void MediaPlaylist::RemoveOldestSegment() {
|
|||
auto entries_itr = entries_.begin();
|
||||
++entries_itr;
|
||||
if ((*entries_itr)->type() == HlsEntry::EntryType::kExtKey) {
|
||||
delete entries_.front();
|
||||
entries_.pop_front();
|
||||
} else {
|
||||
delete *entries_itr;
|
||||
entries_.erase(entries_itr);
|
||||
}
|
||||
return;
|
||||
|
@ -227,6 +228,7 @@ void MediaPlaylist::RemoveOldestSegment() {
|
|||
++entries_itr;
|
||||
if ((*entries_itr)->type() == HlsEntry::EntryType::kExtInf) {
|
||||
DCHECK((*entries_itr)->type() == HlsEntry::EntryType::kExtInf);
|
||||
delete *entries_itr;
|
||||
entries_.erase(entries_itr);
|
||||
return;
|
||||
}
|
||||
|
@ -235,7 +237,9 @@ void MediaPlaylist::RemoveOldestSegment() {
|
|||
// This assumes that there is a segment between 2 EXT-X-KEY entries.
|
||||
// Which should be the case due to logic in AddEncryptionInfo().
|
||||
DCHECK((*entries_itr)->type() == HlsEntry::EntryType::kExtInf);
|
||||
delete *entries_itr;
|
||||
entries_.erase(entries_itr);
|
||||
delete entries_.front();
|
||||
entries_.pop_front();
|
||||
}
|
||||
|
||||
|
@ -250,9 +254,9 @@ void MediaPlaylist::AddEncryptionInfo(MediaPlaylist::EncryptionMethod method,
|
|||
if (entries_.back()->type() == HlsEntry::EntryType::kExtKey)
|
||||
entries_.pop_back();
|
||||
}
|
||||
scoped_ptr<EncryptionInfoEntry> info(new EncryptionInfoEntry(
|
||||
method, url, iv, key_format, key_format_versions));
|
||||
entries_.push_back(info.Pass());
|
||||
entries_.push_back(
|
||||
new EncryptionInfoEntry(
|
||||
method, url, iv, key_format, key_format_versions));
|
||||
}
|
||||
|
||||
bool MediaPlaylist::WriteToFile(media::File* file) {
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include "packager/base/macros.h"
|
||||
#include "packager/base/memory/scoped_ptr.h"
|
||||
#include "packager/base/stl_util.h"
|
||||
#include "packager/mpd/base/media_info.pb.h"
|
||||
|
||||
namespace edash_packager {
|
||||
|
@ -164,7 +165,8 @@ class MediaPlaylist {
|
|||
bool target_duration_set_ = false;
|
||||
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);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue