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

Unified Diff: media/filters/video_frame_stream.cc

Issue 65803002: Replace MessageLoopProxy with SingleThreadTaskRunner for media/filters/ + associated code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 29c5781bc832d1833501e3efe1ced44c52e042bf..0b5a79e7e9ef5bfb5442ff9526a345249fa299e1 100644
--- a/media/filters/video_frame_stream.cc
+++ b/media/filters/video_frame_stream.cc
@@ -8,7 +8,7 @@
#include "base/callback_helpers.h"
#include "base/location.h"
#include "base/logging.h"
-#include "base/message_loop/message_loop_proxy.h"
+#include "base/single_thread_task_runner.h"
#include "media/base/bind_to_loop.h"
#include "media/base/decoder_buffer.h"
#include "media/base/demuxer_stream.h"
@@ -19,14 +19,14 @@
namespace media {
VideoFrameStream::VideoFrameStream(
- const scoped_refptr<base::MessageLoopProxy>& message_loop,
+ const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
ScopedVector<VideoDecoder> decoders,
const SetDecryptorReadyCB& set_decryptor_ready_cb)
- : message_loop_(message_loop),
+ : task_runner_(task_runner),
weak_factory_(this),
state_(STATE_UNINITIALIZED),
stream_(NULL),
- decoder_selector_(new VideoDecoderSelector(message_loop,
+ decoder_selector_(new VideoDecoderSelector(task_runner,
decoders.Pass(),
set_decryptor_ready_cb)) {
}
@@ -39,7 +39,7 @@ void VideoFrameStream::Initialize(DemuxerStream* stream,
const StatisticsCB& statistics_cb,
const InitCB& init_cb) {
DVLOG(2) << __FUNCTION__;
- DCHECK(message_loop_->BelongsToCurrentThread());
+ DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK_EQ(state_, STATE_UNINITIALIZED) << state_;
DCHECK(init_cb_.is_null());
DCHECK(!init_cb.is_null());
@@ -58,7 +58,7 @@ void VideoFrameStream::Initialize(DemuxerStream* stream,
void VideoFrameStream::Read(const ReadCB& read_cb) {
DVLOG(2) << __FUNCTION__;
- DCHECK(message_loop_->BelongsToCurrentThread());
+ DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK(state_ == STATE_NORMAL || state_ == STATE_FLUSHING_DECODER ||
state_ == STATE_ERROR) << state_;
// No two reads in the flight at any time.
@@ -68,7 +68,7 @@ void VideoFrameStream::Read(const ReadCB& read_cb) {
DCHECK(stop_cb_.is_null());
if (state_ == STATE_ERROR) {
- message_loop_->PostTask(FROM_HERE, base::Bind(
+ task_runner_->PostTask(FROM_HERE, base::Bind(
read_cb, DECODE_ERROR, scoped_refptr<VideoFrame>()));
return;
}
@@ -85,7 +85,7 @@ void VideoFrameStream::Read(const ReadCB& read_cb) {
void VideoFrameStream::Reset(const base::Closure& closure) {
DVLOG(2) << __FUNCTION__;
- DCHECK(message_loop_->BelongsToCurrentThread());
+ DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK(state_ != STATE_UNINITIALIZED && state_ != STATE_STOPPED) << state_;
DCHECK(reset_cb_.is_null());
DCHECK(stop_cb_.is_null());
@@ -120,7 +120,7 @@ void VideoFrameStream::Reset(const base::Closure& closure) {
void VideoFrameStream::Stop(const base::Closure& closure) {
DVLOG(2) << __FUNCTION__;
- DCHECK(message_loop_->BelongsToCurrentThread());
+ DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK_NE(state_, STATE_STOPPED) << state_;
DCHECK(stop_cb_.is_null());
@@ -138,10 +138,10 @@ void VideoFrameStream::Stop(const base::Closure& closure) {
// Post callbacks to prevent reentrance into this object.
if (!read_cb_.is_null())
- message_loop_->PostTask(FROM_HERE, base::Bind(
+ task_runner_->PostTask(FROM_HERE, base::Bind(
base::ResetAndReturn(&read_cb_), ABORTED, scoped_refptr<VideoFrame>()));
if (!reset_cb_.is_null())
- message_loop_->PostTask(FROM_HERE, base::ResetAndReturn(&reset_cb_));
+ task_runner_->PostTask(FROM_HERE, base::ResetAndReturn(&reset_cb_));
if (decrypting_demuxer_stream_) {
decrypting_demuxer_stream_->Reset(base::Bind(
@@ -159,11 +159,11 @@ void VideoFrameStream::Stop(const base::Closure& closure) {
stream_ = NULL;
decoder_.reset();
decrypting_demuxer_stream_.reset();
- message_loop_->PostTask(FROM_HERE, base::ResetAndReturn(&stop_cb_));
+ task_runner_->PostTask(FROM_HERE, base::ResetAndReturn(&stop_cb_));
}
bool VideoFrameStream::CanReadWithoutStalling() const {
- DCHECK(message_loop_->BelongsToCurrentThread());
+ DCHECK(task_runner_->BelongsToCurrentThread());
return decoder_->CanReadWithoutStalling();
}
@@ -171,7 +171,7 @@ void VideoFrameStream::OnDecoderSelected(
scoped_ptr<VideoDecoder> selected_decoder,
scoped_ptr<DecryptingDemuxerStream> decrypting_demuxer_stream) {
DVLOG(2) << __FUNCTION__;
- DCHECK(message_loop_->BelongsToCurrentThread());
+ DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK_EQ(state_, STATE_INITIALIZING) << state_;
DCHECK(!init_cb_.is_null());
DCHECK(read_cb_.is_null());
@@ -305,7 +305,7 @@ void VideoFrameStream::OnBufferReady(
DemuxerStream::Status status,
const scoped_refptr<DecoderBuffer>& buffer) {
DVLOG(2) << __FUNCTION__;
- DCHECK(message_loop_->BelongsToCurrentThread());
+ DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK_EQ(state_, STATE_PENDING_DEMUXER_READ) << state_;
DCHECK_EQ(buffer.get() != NULL, status == DemuxerStream::kOk) << status;
DCHECK(!read_cb_.is_null());
@@ -348,7 +348,7 @@ void VideoFrameStream::OnBufferReady(
void VideoFrameStream::ReinitializeDecoder() {
DVLOG(2) << __FUNCTION__;
- DCHECK(message_loop_->BelongsToCurrentThread());
+ DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK_EQ(state_, STATE_FLUSHING_DECODER) << state_;
DCHECK(stream_->video_decoder_config().IsValidConfig());
@@ -360,7 +360,7 @@ void VideoFrameStream::ReinitializeDecoder() {
void VideoFrameStream::OnDecoderReinitialized(PipelineStatus status) {
DVLOG(2) << __FUNCTION__;
- DCHECK(message_loop_->BelongsToCurrentThread());
+ DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK_EQ(state_, STATE_REINITIALIZING_DECODER) << state_;
DCHECK(stop_cb_.is_null());
@@ -391,7 +391,7 @@ void VideoFrameStream::OnDecoderReinitialized(PipelineStatus status) {
void VideoFrameStream::ResetDecoder() {
DVLOG(2) << __FUNCTION__;
- DCHECK(message_loop_->BelongsToCurrentThread());
+ DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK(state_ == STATE_NORMAL || state_ == STATE_FLUSHING_DECODER ||
state_ == STATE_ERROR) << state_;
DCHECK(!reset_cb_.is_null());
@@ -402,7 +402,7 @@ void VideoFrameStream::ResetDecoder() {
void VideoFrameStream::OnDecoderReset() {
DVLOG(2) << __FUNCTION__;
- DCHECK(message_loop_->BelongsToCurrentThread());
+ DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK(state_ == STATE_NORMAL || state_ == STATE_FLUSHING_DECODER ||
state_ == STATE_ERROR) << state_;
// If Reset() was called during pending read, read callback should be fired
@@ -422,7 +422,7 @@ void VideoFrameStream::OnDecoderReset() {
void VideoFrameStream::StopDecoder() {
DVLOG(2) << __FUNCTION__;
- DCHECK(message_loop_->BelongsToCurrentThread());
+ DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK(state_ != STATE_UNINITIALIZED && state_ != STATE_STOPPED) << state_;
DCHECK(!stop_cb_.is_null());
@@ -432,7 +432,7 @@ void VideoFrameStream::StopDecoder() {
void VideoFrameStream::OnDecoderStopped() {
DVLOG(2) << __FUNCTION__;
- DCHECK(message_loop_->BelongsToCurrentThread());
+ DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK(state_ != STATE_UNINITIALIZED && state_ != STATE_STOPPED) << state_;
// If Stop() was called during pending read/reset, read/reset callback should
// be fired before the stop callback is fired.

Powered by Google App Engine
This is Rietveld 408576698