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

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: 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..92b8e23ceab04a0c2966291649e9669628827f27 100644
--- a/media/base/pipeline.cc
+++ b/media/base/pipeline.cc
@@ -584,7 +584,7 @@ void Pipeline::DoSeek(
// Seek demuxer.
bound_fns.Push(base::Bind(
- &Demuxer::Seek, demuxer_, seek_timestamp));
+ &Demuxer::Seek, base::Unretained(demuxer_.get()), seek_timestamp));
// Preroll renderers.
if (audio_renderer_) {
@@ -628,8 +628,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_.get())));
+ }
if (audio_renderer_) {
bound_fns.Push(base::Bind(
@@ -657,7 +659,7 @@ void Pipeline::OnStopCompleted(PipelineStatus status) {
filter_collection_.reset();
audio_renderer_.reset();
video_renderer_.reset();
- demuxer_ = NULL;
+ demuxer_.reset();
scherkus (not reviewing) 2013/04/17 17:21:59 I'm still skeptical that we should be deleting the
// 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),
@@ -930,9 +928,7 @@ void Pipeline::InitializeAudioRenderer(const PipelineStatusCB& done_cb) {
void Pipeline::InitializeVideoRenderer(const PipelineStatusCB& done_cb) {
DCHECK(message_loop_->BelongsToCurrentThread());
- scoped_refptr<DemuxerStream> stream =
- demuxer_->GetStream(DemuxerStream::VIDEO);
- DCHECK(stream);
+ DemuxerStream* stream = demuxer_->GetStream(DemuxerStream::VIDEO);
{
// Get an initial natural size so we have something when we signal

Powered by Google App Engine
This is Rietveld 408576698