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

Unified Diff: trunk/src/media/filters/video_frame_stream.cc

Issue 14320005: Revert 194993 "Remove reference counting from media::VideoDecode..." (Closed) Base URL: svn://svn.chromium.org/chrome/
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: trunk/src/media/filters/video_frame_stream.cc
===================================================================
--- trunk/src/media/filters/video_frame_stream.cc (revision 195011)
+++ trunk/src/media/filters/video_frame_stream.cc (working copy)
@@ -19,13 +19,11 @@
VideoFrameStream::VideoFrameStream(
const scoped_refptr<base::MessageLoopProxy>& message_loop,
- ScopedVector<VideoDecoder> decoders,
const SetDecryptorReadyCB& set_decryptor_ready_cb)
: message_loop_(message_loop),
weak_factory_(this),
state_(UNINITIALIZED),
- decoder_selector_(
- message_loop_, decoders.Pass(), set_decryptor_ready_cb) {
+ set_decryptor_ready_cb_(set_decryptor_ready_cb) {
}
VideoFrameStream::~VideoFrameStream() {
@@ -33,6 +31,7 @@
}
void VideoFrameStream::Initialize(const scoped_refptr<DemuxerStream>& stream,
+ const VideoDecoderList& decoders,
const StatisticsCB& statistics_cb,
const InitCB& init_cb) {
DCHECK(message_loop_->BelongsToCurrentThread());
@@ -45,8 +44,20 @@
init_cb_ = init_cb;
stream_ = stream;
- decoder_selector_.SelectVideoDecoder(this, statistics_cb, base::Bind(
- &VideoFrameStream::OnDecoderSelected, weak_this_));
+ scoped_ptr<VideoDecoderSelector> decoder_selector(
+ new VideoDecoderSelector(message_loop_,
+ decoders,
+ set_decryptor_ready_cb_));
+
+ // To avoid calling |decoder_selector| methods and passing ownership of
+ // |decoder_selector| in the same line.
+ VideoDecoderSelector* decoder_selector_ptr = decoder_selector.get();
+
+ decoder_selector_ptr->SelectVideoDecoder(
+ this,
+ statistics_cb,
+ base::Bind(&VideoFrameStream::OnDecoderSelected, weak_this_,
+ base::Passed(&decoder_selector)));
}
void VideoFrameStream::ReadFrame(const VideoDecoder::ReadCB& read_cb) {
@@ -117,7 +128,7 @@
// we don't need this here. See: http://crbug.com/173313
stream_ = NULL;
decrypting_demuxer_stream_ = NULL;
- decoder_.reset();
+ decoder_ = NULL;
message_loop_->PostTask(FROM_HERE, base::ResetAndReturn(&stop_cb_));
}
@@ -153,7 +164,8 @@
}
void VideoFrameStream::OnDecoderSelected(
- scoped_ptr<VideoDecoder> selected_decoder,
+ scoped_ptr<VideoDecoderSelector> decoder_selector,
+ const scoped_refptr<VideoDecoder>& selected_decoder,
const scoped_refptr<DecryptingDemuxerStream>& decrypting_demuxer_stream) {
DCHECK(message_loop_->BelongsToCurrentThread());
DCHECK_EQ(state_, UNINITIALIZED);
@@ -163,7 +175,7 @@
state_ = UNINITIALIZED;
base::ResetAndReturn(&init_cb_).Run(false, false);
} else {
- decoder_ = selected_decoder.Pass();
+ decoder_ = selected_decoder;
decrypting_demuxer_stream_ = decrypting_demuxer_stream;
state_ = NORMAL;
base::ResetAndReturn(&init_cb_).Run(true, decoder_->HasAlpha());
@@ -227,7 +239,7 @@
// we don't need this here. See: http://crbug.com/173313
stream_ = NULL;
decrypting_demuxer_stream_ = NULL;
- decoder_.reset();
+ decoder_ = NULL;
base::ResetAndReturn(&stop_cb_).Run();
}
« no previous file with comments | « trunk/src/media/filters/video_frame_stream.h ('k') | trunk/src/media/filters/video_frame_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698