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

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: rebase Created 7 years 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
« no previous file with comments | « media/filters/video_frame_stream.h ('k') | media/filters/video_renderer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/video_frame_stream.cc
diff --git a/media/filters/video_frame_stream.cc b/media/filters/video_frame_stream.cc
index 4b13ac9a8e4a0663644da0eba10acb13a7d13361..0c7ccf367992165c1f5cbf62ec028b3df752503d 100644
--- a/media/filters/video_frame_stream.cc
+++ b/media/filters/video_frame_stream.cc
@@ -9,7 +9,7 @@
#include "base/debug/trace_event.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"
@@ -20,14 +20,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)) {
}
@@ -40,7 +40,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());
@@ -59,7 +59,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.
@@ -69,7 +69,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;
}
@@ -86,7 +86,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());
@@ -121,7 +121,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());
@@ -139,10 +139,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(
@@ -160,11 +160,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();
}
@@ -172,7 +172,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());
@@ -310,7 +310,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());
@@ -353,7 +353,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());
@@ -365,7 +365,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());
@@ -396,7 +396,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());
@@ -407,7 +407,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
@@ -427,7 +427,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());
@@ -437,7 +437,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.
« no previous file with comments | « media/filters/video_frame_stream.h ('k') | media/filters/video_renderer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698