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

Unified Diff: media/filters/video_frame_stream.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/filters/video_frame_stream.cc
diff --git a/media/filters/video_frame_stream.cc b/media/filters/video_frame_stream.cc
index 8a788daa50a7dc45fe707bcba8f41c1a173123a9..6913a545f8be29abd9237bfa9cb5515ddbe42887 100644
--- a/media/filters/video_frame_stream.cc
+++ b/media/filters/video_frame_stream.cc
@@ -32,7 +32,7 @@ VideoFrameStream::~VideoFrameStream() {
DCHECK(state_ == UNINITIALIZED || state_ == STOPPED) << state_;
}
-void VideoFrameStream::Initialize(const scoped_refptr<DemuxerStream>& stream,
+void VideoFrameStream::Initialize(DemuxerStream* stream,
const StatisticsCB& statistics_cb,
const InitCB& init_cb) {
DCHECK(message_loop_->BelongsToCurrentThread());
@@ -112,12 +112,8 @@ void VideoFrameStream::Stop(const base::Closure& closure) {
}
state_ = STOPPED;
- // Break the ref-count loop so we don't leak objects.
- // TODO(scherkus): Make DemuxerStream and/or VideoDecoder not ref-counted so
- // we don't need this here. See: http://crbug.com/173313
- stream_ = NULL;
- decrypting_demuxer_stream_ = NULL;
decoder_.reset();
+ decrypting_demuxer_stream_.reset();
message_loop_->PostTask(FROM_HERE, base::ResetAndReturn(&stop_cb_));
}
@@ -154,7 +150,7 @@ void VideoFrameStream::EnableBitstreamConverter() {
void VideoFrameStream::OnDecoderSelected(
scoped_ptr<VideoDecoder> selected_decoder,
- const scoped_refptr<DecryptingDemuxerStream>& decrypting_demuxer_stream) {
+ scoped_ptr<DecryptingDemuxerStream> decrypting_demuxer_stream) {
DCHECK(message_loop_->BelongsToCurrentThread());
DCHECK_EQ(state_, UNINITIALIZED);
DCHECK(!init_cb_.is_null());
@@ -164,7 +160,7 @@ void VideoFrameStream::OnDecoderSelected(
base::ResetAndReturn(&init_cb_).Run(false, false);
} else {
decoder_ = selected_decoder.Pass();
- decrypting_demuxer_stream_ = decrypting_demuxer_stream;
+ decrypting_demuxer_stream_ = decrypting_demuxer_stream.Pass();
state_ = NORMAL;
base::ResetAndReturn(&init_cb_).Run(true, decoder_->HasAlpha());
}
@@ -222,12 +218,8 @@ void VideoFrameStream::OnDecoderStopped() {
DCHECK(!stop_cb_.is_null());
state_ = STOPPED;
- // Break the ref-count loop so we don't leak objects.
- // TODO(scherkus): Make DemuxerStream and/or VideoDecoder not ref-counted so
- // we don't need this here. See: http://crbug.com/173313
- stream_ = NULL;
acolwell GONE FROM CHROMIUM 2013/04/17 20:24:53 We don't still want to make stream_ == NULL?
scherkus (not reviewing) 2013/04/19 01:07:22 reverted
- decrypting_demuxer_stream_ = NULL;
decoder_.reset();
+ decrypting_demuxer_stream_.reset();
base::ResetAndReturn(&stop_cb_).Run();
}

Powered by Google App Engine
This is Rietveld 408576698