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

Unified Diff: content/renderer/media/renderer_gpu_video_decoder_factories.cc

Issue 13890012: Integrate VDA with WebRTC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix a deadlock by calling RGVDF::CreateSharedMemory asynchronously Created 7 years, 6 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: content/renderer/media/renderer_gpu_video_decoder_factories.cc
diff --git a/content/renderer/media/renderer_gpu_video_decoder_factories.cc b/content/renderer/media/renderer_gpu_video_decoder_factories.cc
index 2a59e673e6df567325d02b2f86cc78dc7586e052..79d791f08d0c866d583b0027d7e6e0c1057e396e 100644
--- a/content/renderer/media/renderer_gpu_video_decoder_factories.cc
+++ b/content/renderer/media/renderer_gpu_video_decoder_factories.cc
@@ -29,6 +29,7 @@ RendererGpuVideoDecoderFactories::RendererGpuVideoDecoderFactories(
render_thread_async_waiter_(false, false) {
if (message_loop_->BelongsToCurrentThread()) {
AsyncGetContext(context);
+ compositor_loop_async_waiter_.Reset();
return;
}
// Threaded compositor requires us to wait for the context to be acquired.
@@ -63,7 +64,11 @@ media::VideoDecodeAccelerator*
RendererGpuVideoDecoderFactories::CreateVideoDecodeAccelerator(
media::VideoCodecProfile profile,
media::VideoDecodeAccelerator::Client* client) {
- DCHECK(!message_loop_->BelongsToCurrentThread());
+ if (message_loop_->BelongsToCurrentThread()) {
+ AsyncCreateVideoDecodeAccelerator(profile, client);
+ compositor_loop_async_waiter_.Reset();
+ return vda_.release();
+ }
// The VDA is returned in the vda_ member variable by the
// AsyncCreateVideoDecodeAccelerator() function.
message_loop_->PostTask(FROM_HERE, base::Bind(
@@ -100,7 +105,12 @@ bool RendererGpuVideoDecoderFactories::CreateTextures(
int32 count, const gfx::Size& size,
std::vector<uint32>* texture_ids,
uint32 texture_target) {
- DCHECK(!message_loop_->BelongsToCurrentThread());
+ if (message_loop_->BelongsToCurrentThread()) {
+ AsyncCreateTextures(count, size, texture_target);
+ texture_ids->swap(created_textures_);
+ compositor_loop_async_waiter_.Reset();
+ return true;
+ }
message_loop_->PostTask(FROM_HERE, base::Bind(
&RendererGpuVideoDecoderFactories::AsyncCreateTextures, this,
count, size, texture_target));
@@ -147,7 +157,10 @@ void RendererGpuVideoDecoderFactories::AsyncCreateTextures(
}
void RendererGpuVideoDecoderFactories::DeleteTexture(uint32 texture_id) {
- DCHECK(!message_loop_->BelongsToCurrentThread());
+ if (message_loop_->BelongsToCurrentThread()) {
+ AsyncDeleteTexture(texture_id);
+ return;
+ }
message_loop_->PostTask(FROM_HERE, base::Bind(
&RendererGpuVideoDecoderFactories::AsyncDeleteTexture, this, texture_id));
}
@@ -221,8 +234,9 @@ void RendererGpuVideoDecoderFactories::AsyncReadPixels(
base::SharedMemory* RendererGpuVideoDecoderFactories::CreateSharedMemory(
size_t size) {
- DCHECK_NE(base::MessageLoop::current(),
- ChildThread::current()->message_loop());
+ if (base::MessageLoop::current() == ChildThread::current()->message_loop()) {
+ return ChildThread::current()->AllocateSharedMemory(size);
+ }
ChildThread::current()->message_loop()->PostTask(FROM_HERE, base::Bind(
&RendererGpuVideoDecoderFactories::AsyncCreateSharedMemory, this,
size));

Powered by Google App Engine
This is Rietveld 408576698