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

Unified Diff: media/filters/ffmpeg_video_decoder.cc

Issue 11428095: Pass in media message loop to VideoRendererBase and enforce calling on the right thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
« no previous file with comments | « no previous file | media/filters/video_renderer_base.h » ('j') | media/filters/video_renderer_base.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/ffmpeg_video_decoder.cc
diff --git a/media/filters/ffmpeg_video_decoder.cc b/media/filters/ffmpeg_video_decoder.cc
index 85014fb85ed7679fe26f0c2e099e5fb0ab38e4b2..853906cff2f8949ccffdbd18d9ff7349319dd21c 100644
--- a/media/filters/ffmpeg_video_decoder.cc
+++ b/media/filters/ffmpeg_video_decoder.cc
@@ -133,12 +133,7 @@ static void ReleaseVideoBufferImpl(AVCodecContext* s, AVFrame* frame) {
void FFmpegVideoDecoder::Initialize(const scoped_refptr<DemuxerStream>& stream,
const PipelineStatusCB& status_cb,
const StatisticsCB& statistics_cb) {
- if (!message_loop_->BelongsToCurrentThread()) {
- message_loop_->PostTask(FROM_HERE, base::Bind(
- &FFmpegVideoDecoder::Initialize, this,
- stream, status_cb, statistics_cb));
- return;
- }
+ DCHECK(message_loop_->BelongsToCurrentThread());
FFmpegGlue::InitializeFFmpeg();
DCHECK(!demuxer_stream_) << "Already initialized.";
@@ -162,19 +157,12 @@ void FFmpegVideoDecoder::Initialize(const scoped_refptr<DemuxerStream>& stream,
}
void FFmpegVideoDecoder::Read(const ReadCB& read_cb) {
- // Complete operation asynchronously on different stack of execution as per
- // the API contract of VideoDecoder::Read()
- message_loop_->PostTask(FROM_HERE, base::Bind(
- &FFmpegVideoDecoder::DoRead, this, read_cb));
+ DCHECK(message_loop_->BelongsToCurrentThread());
+ DoRead(read_cb);
Ami GONE FROM CHROMIUM 2012/11/29 23:34:23 Either force-post or change the API contract of Vi
scherkus (not reviewing) 2012/11/29 23:45:56 This was lazy prototyping. Inlining the code took
}
void FFmpegVideoDecoder::Reset(const base::Closure& closure) {
- if (!message_loop_->BelongsToCurrentThread()) {
- message_loop_->PostTask(FROM_HERE, base::Bind(
- &FFmpegVideoDecoder::Reset, this, closure));
- return;
- }
-
+ DCHECK(message_loop_->BelongsToCurrentThread());
DCHECK(reset_cb_.is_null());
reset_cb_ = closure;
@@ -198,11 +186,7 @@ void FFmpegVideoDecoder::DoReset() {
}
void FFmpegVideoDecoder::Stop(const base::Closure& closure) {
- if (!message_loop_->BelongsToCurrentThread()) {
- message_loop_->PostTask(FROM_HERE, base::Bind(
- &FFmpegVideoDecoder::Stop, this, closure));
- return;
- }
+ DCHECK(message_loop_->BelongsToCurrentThread());
if (state_ == kUninitialized) {
closure.Run();
« no previous file with comments | « no previous file | media/filters/video_renderer_base.h » ('j') | media/filters/video_renderer_base.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698