Map to raw pointer instead of scoped_ptr

- Fixes Mac build.
- Mapping to scoped_ptr doesn't work, instead use raw pointer and
  STLValueDeleter.

Change-Id: If17e43d9d4aba8c92a76d2b1ca99a64c6a2b0e84
This commit is contained in:
Rintaro Kuroiwa 2016-04-17 00:12:10 -07:00
parent a6646841b7
commit 16ba8da295
3 changed files with 8 additions and 4 deletions

View File

@ -43,7 +43,8 @@ SimpleHlsNotifier::SimpleHlsNotifier(const std::string& prefix,
prefix_(prefix), prefix_(prefix),
output_dir_(output_dir), output_dir_(output_dir),
media_playlist_factory_(new MediaPlaylistFactory()), media_playlist_factory_(new MediaPlaylistFactory()),
master_playlist_(new MasterPlaylist(master_playlist_name)) {} master_playlist_(new MasterPlaylist(master_playlist_name)),
media_playlist_map_deleter_(&media_playlist_map_) {}
SimpleHlsNotifier::~SimpleHlsNotifier() {} SimpleHlsNotifier::~SimpleHlsNotifier() {}
@ -74,7 +75,8 @@ bool SimpleHlsNotifier::NotifyNewStream(const MediaInfo& media_info,
base::AutoLock auto_lock(lock_); base::AutoLock auto_lock(lock_);
master_playlist_->AddMediaPlaylist(media_playlist.get()); master_playlist_->AddMediaPlaylist(media_playlist.get());
media_playlist_map_.insert(std::make_pair(*stream_id, media_playlist.Pass())); media_playlist_map_.insert(
std::make_pair(*stream_id, media_playlist.release()));
return true; return true;
} }

View File

@ -10,6 +10,7 @@
#include "packager/base/atomic_sequence_num.h" #include "packager/base/atomic_sequence_num.h"
#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/base/synchronization/lock.h" #include "packager/base/synchronization/lock.h"
#include "packager/hls/base/hls_notifier.h" #include "packager/hls/base/hls_notifier.h"
#include "packager/hls/base/master_playlist.h" #include "packager/hls/base/master_playlist.h"
@ -72,7 +73,8 @@ class SimpleHlsNotifier : public HlsNotifier {
scoped_ptr<MediaPlaylistFactory> media_playlist_factory_; scoped_ptr<MediaPlaylistFactory> media_playlist_factory_;
scoped_ptr<MasterPlaylist> master_playlist_; scoped_ptr<MasterPlaylist> master_playlist_;
std::map<uint32_t, scoped_ptr<MediaPlaylist>> media_playlist_map_; std::map<uint32_t, MediaPlaylist*> media_playlist_map_;
STLValueDeleter<decltype(media_playlist_map_)> media_playlist_map_deleter_;
base::AtomicSequenceNumber sequence_number_; base::AtomicSequenceNumber sequence_number_;

View File

@ -65,7 +65,7 @@ class SimpleHlsNotifierTest : public ::testing::Test {
notifier_.master_playlist_ = playlist.Pass(); notifier_.master_playlist_ = playlist.Pass();
} }
const std::map<uint32_t, scoped_ptr<MediaPlaylist>>& GetMediaPlaylistMap() { const std::map<uint32_t, MediaPlaylist*>& GetMediaPlaylistMap() {
return notifier_.media_playlist_map_; return notifier_.media_playlist_map_;
} }