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

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: Create new VDA thread, copy gpu_factories, and add DestructionObserver 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 43da85d4c35eed8fcd81bebdffe5ee51879323c2..747c2ddfadafd86714d8c49e38dd896c77b78150 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.
@@ -46,6 +47,23 @@ RendererGpuVideoDecoderFactories::RendererGpuVideoDecoderFactories(
compositor_loop_async_waiter_.Wait();
}
+RendererGpuVideoDecoderFactories::RendererGpuVideoDecoderFactories(
+ scoped_refptr<base::MessageLoopProxy> message_loop,
+ scoped_refptr<GpuChannelHost> gpu_channel_host,
+ base::WeakPtr<WebGraphicsContext3DCommandBufferImpl> context)
+ : message_loop_(message_loop),
+ gpu_channel_host_(gpu_channel_host),
+ context_(context),
+ aborted_waiter_(true, false),
+ compositor_loop_async_waiter_(false, false),
+ render_thread_async_waiter_(false, false) {
+}
+
+RendererGpuVideoDecoderFactories* RendererGpuVideoDecoderFactories::Copy() {
+ return new RendererGpuVideoDecoderFactories(
+ message_loop_, gpu_channel_host_, context_);
+}
+
void RendererGpuVideoDecoderFactories::AsyncGetContext(
WebGraphicsContext3DCommandBufferImpl* context) {
context_ = context->AsWeakPtr();
@@ -63,7 +81,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(
@@ -101,7 +123,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));
@@ -148,7 +175,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));
}

Powered by Google App Engine
This is Rietveld 408576698