Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1040)

Unified Diff: media/base/pipeline.cc

Issue 13813016: Remove reference counting from media::Demuxer and friends. (Closed) Base URL: http://git.chromium.org/chromium/src.git@vd_scoped
Patch Set: demuxer only Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/base/pipeline.cc
diff --git a/media/base/pipeline.cc b/media/base/pipeline.cc
index 8d379c4b64c0c46b2c284d67d5f944e9365b1f7a..58bba72eeecd11fc6084e8aeaa4628e35aec8e5d 100644
--- a/media/base/pipeline.cc
+++ b/media/base/pipeline.cc
@@ -81,6 +81,7 @@ Pipeline::Pipeline(const scoped_refptr<base::MessageLoopProxy>& message_loop,
audio_ended_(false),
video_ended_(false),
audio_disabled_(false),
+ demuxer_(NULL),
creation_time_(base::Time::Now()) {
media_log_->AddEvent(media_log_->CreatePipelineStateChangedEvent(kCreated));
media_log_->AddEvent(
@@ -584,7 +585,7 @@ void Pipeline::DoSeek(
// Seek demuxer.
bound_fns.Push(base::Bind(
- &Demuxer::Seek, demuxer_, seek_timestamp));
+ &Demuxer::Seek, base::Unretained(demuxer_), seek_timestamp));
// Preroll renderers.
if (audio_renderer_) {
@@ -628,8 +629,10 @@ void Pipeline::DoStop(const PipelineStatusCB& done_cb) {
DCHECK(!pending_callbacks_.get());
SerialRunner::Queue bound_fns;
- if (demuxer_)
- bound_fns.Push(base::Bind(&Demuxer::Stop, demuxer_));
+ if (demuxer_) {
+ bound_fns.Push(base::Bind(
+ &Demuxer::Stop, base::Unretained(demuxer_)));
+ }
if (audio_renderer_) {
bound_fns.Push(base::Bind(
@@ -657,7 +660,6 @@ void Pipeline::OnStopCompleted(PipelineStatus status) {
filter_collection_.reset();
audio_renderer_.reset();
video_renderer_.reset();
- demuxer_ = NULL;
acolwell GONE FROM CHROMIUM 2013/04/19 18:17:59 nit: Any harm in keeping this? It will trigger an
scherkus (not reviewing) 2013/04/19 23:18:45 Done.
// If we stop during initialization/seeking we want to run |seek_cb_|
// followed by |stop_cb_| so we don't leave outstanding callbacks around.
@@ -911,13 +913,9 @@ void Pipeline::InitializeDemuxer(const PipelineStatusCB& done_cb) {
void Pipeline::InitializeAudioRenderer(const PipelineStatusCB& done_cb) {
DCHECK(message_loop_->BelongsToCurrentThread());
- scoped_refptr<DemuxerStream> stream =
- demuxer_->GetStream(DemuxerStream::AUDIO);
- DCHECK(stream);
-
audio_renderer_ = filter_collection_->GetAudioRenderer();
audio_renderer_->Initialize(
- stream,
+ demuxer_->GetStream(DemuxerStream::AUDIO),
done_cb,
base::Bind(&Pipeline::OnUpdateStatistics, this),
base::Bind(&Pipeline::OnAudioUnderflow, this),
@@ -932,7 +930,6 @@ void Pipeline::InitializeVideoRenderer(const PipelineStatusCB& done_cb) {
scoped_refptr<DemuxerStream> stream =
demuxer_->GetStream(DemuxerStream::VIDEO);
- DCHECK(stream);
{
// Get an initial natural size so we have something when we signal

Powered by Google App Engine
This is Rietveld 408576698