summaryrefslogtreecommitdiffstats
path: root/content/renderer
diff options
context:
space:
mode:
authorvrk@google.com <vrk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-15 23:13:58 +0000
committervrk@google.com <vrk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-15 23:13:58 +0000
commit1d9957637a336558f458bdc6dc28bc5b691e61b9 (patch)
tree6bfd079df4b1376431062b2fcc19150fadd964c5 /content/renderer
parent3bf2bbb2f37cf88fd6c8e9a69879451683179065 (diff)
downloadchromium_src-1d9957637a336558f458bdc6dc28bc5b691e61b9.zip
chromium_src-1d9957637a336558f458bdc6dc28bc5b691e61b9.tar.gz
chromium_src-1d9957637a336558f458bdc6dc28bc5b691e61b9.tar.bz2
Run Video Decode PPAPI callbacks on same thread
Repost video callbacks on the same message loop where the video decoder interface was created. This fixes a bunch of threading problems. BUG=NONE TEST=gles2 ppapi example does not hang. Review URL: http://codereview.chromium.org/7170002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89267 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer')
-rw-r--r--content/renderer/pepper_platform_video_decoder_impl.cc70
-rw-r--r--content/renderer/pepper_platform_video_decoder_impl.h3
2 files changed, 56 insertions, 17 deletions
diff --git a/content/renderer/pepper_platform_video_decoder_impl.cc b/content/renderer/pepper_platform_video_decoder_impl.cc
index 009571d..1217bb9 100644
--- a/content/renderer/pepper_platform_video_decoder_impl.cc
+++ b/content/renderer/pepper_platform_video_decoder_impl.cc
@@ -118,49 +118,85 @@ bool PlatformVideoDecoderImpl::Abort() {
}
void PlatformVideoDecoderImpl::NotifyEndOfStream() {
- client_->NotifyEndOfStream();
+ DCHECK(message_loop_);
+ message_loop_->
+ PostTask(FROM_HERE, base::Bind(
+ &VideoDecodeAccelerator::Client::NotifyEndOfStream,
+ base::Unretained(client_)));
}
void PlatformVideoDecoderImpl::NotifyError(
VideoDecodeAccelerator::Error error) {
- client_->NotifyError(error);
+ DCHECK(message_loop_);
+ message_loop_->
+ PostTask(FROM_HERE, base::Bind(
+ &VideoDecodeAccelerator::Client::NotifyError,
+ base::Unretained(client_),
+ error));
}
void PlatformVideoDecoderImpl::ProvidePictureBuffers(
uint32 requested_num_of_buffers,
const gfx::Size& dimensions,
media::VideoDecodeAccelerator::MemoryType type) {
- client_->ProvidePictureBuffers(requested_num_of_buffers, dimensions, type);
+ DCHECK(message_loop_);
+ message_loop_->
+ PostTask(FROM_HERE, base::Bind(
+ &VideoDecodeAccelerator::Client::ProvidePictureBuffers,
+ base::Unretained(client_),
+ requested_num_of_buffers,
+ dimensions,
+ type));
}
void PlatformVideoDecoderImpl::DismissPictureBuffer(int32 picture_buffer_id) {
- client_->DismissPictureBuffer(picture_buffer_id);
+ DCHECK(message_loop_);
+ message_loop_->
+ PostTask(FROM_HERE, base::Bind(
+ &VideoDecodeAccelerator::Client::DismissPictureBuffer,
+ base::Unretained(client_),
+ picture_buffer_id));
}
void PlatformVideoDecoderImpl::PictureReady(const media::Picture& picture) {
- client_->PictureReady(picture);
+ DCHECK(message_loop_);
+ message_loop_->
+ PostTask(FROM_HERE, base::Bind(
+ &VideoDecodeAccelerator::Client::PictureReady,
+ base::Unretained(client_),
+ picture));
}
void PlatformVideoDecoderImpl::NotifyInitializeDone() {
- if (message_loop_ != MessageLoop::current() ) {
- message_loop_->
- PostTask(FROM_HERE, base::Bind(
- &PlatformVideoDecoderImpl::NotifyInitializeDone,
- base::Unretained(this)));
- return;
- }
- client_->NotifyInitializeDone();
+ DCHECK(message_loop_);
+ message_loop_->
+ PostTask(FROM_HERE, base::Bind(
+ &VideoDecodeAccelerator::Client::NotifyInitializeDone,
+ base::Unretained(client_)));
}
void PlatformVideoDecoderImpl::NotifyEndOfBitstreamBuffer(
- int32 bitstream_buffer_id) {
- client_->NotifyEndOfBitstreamBuffer(bitstream_buffer_id);
+ int32 bitstream_buffer_id) {
+ DCHECK(message_loop_);
+ message_loop_->
+ PostTask(FROM_HERE, base::Bind(
+ &VideoDecodeAccelerator::Client::NotifyEndOfBitstreamBuffer,
+ base::Unretained(client_),
+ bitstream_buffer_id));
}
void PlatformVideoDecoderImpl::NotifyFlushDone() {
- client_->NotifyFlushDone();
+ DCHECK(message_loop_);
+ message_loop_->
+ PostTask(FROM_HERE, base::Bind(
+ &VideoDecodeAccelerator::Client::NotifyFlushDone,
+ base::Unretained(client_)));
}
void PlatformVideoDecoderImpl::NotifyAbortDone() {
- client_->NotifyAbortDone();
+ DCHECK(message_loop_);
+ message_loop_->
+ PostTask(FROM_HERE, base::Bind(
+ &VideoDecodeAccelerator::Client::NotifyAbortDone,
+ base::Unretained(client_)));
}
diff --git a/content/renderer/pepper_platform_video_decoder_impl.h b/content/renderer/pepper_platform_video_decoder_impl.h
index 02ca25e..4f10db6 100644
--- a/content/renderer/pepper_platform_video_decoder_impl.h
+++ b/content/renderer/pepper_platform_video_decoder_impl.h
@@ -59,6 +59,9 @@ class PlatformVideoDecoderImpl
void InitializeDecoder(const std::vector<uint32>& configs);
// Client lifetime must exceed lifetime of this class.
+ // TODO(vrk/fischman): We should take another look at the overall
+ // arcitecture of PPAPI Video Decode to make sure lifetime/ownership makes
+ // sense, including lifetime of this client.
media::VideoDecodeAccelerator::Client* client_;
// Route ID for the command buffer associated with video decoder's context.