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

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: update the license of rtc_video_decoder.h Created 7 years, 5 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 0d1a150171fdd62ea093f56275090b0aa8cc44cc..e6e6dcfbf64348bfbc4f1562349684201196c214 100644
--- a/content/renderer/media/renderer_gpu_video_decoder_factories.cc
+++ b/content/renderer/media/renderer_gpu_video_decoder_factories.cc
@@ -30,6 +30,7 @@ RendererGpuVideoDecoderFactories::RendererGpuVideoDecoderFactories(
render_thread_async_waiter_(false, false) {
if (compositor_message_loop_->BelongsToCurrentThread()) {
AsyncGetContext(context);
+ compositor_loop_async_waiter_.Reset();
return;
}
// Threaded compositor requires us to wait for the context to be acquired.
@@ -64,7 +65,11 @@ media::VideoDecodeAccelerator*
RendererGpuVideoDecoderFactories::CreateVideoDecodeAccelerator(
media::VideoCodecProfile profile,
media::VideoDecodeAccelerator::Client* client) {
- DCHECK(!compositor_message_loop_->BelongsToCurrentThread());
+ if (compositor_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.
compositor_message_loop_->PostTask(FROM_HERE, base::Bind(
@@ -104,7 +109,13 @@ uint32 RendererGpuVideoDecoderFactories::CreateTextures(
uint32 texture_target) {
uint32 sync_point = 0;
- DCHECK(!compositor_message_loop_->BelongsToCurrentThread());
+ if (compositor_message_loop_->BelongsToCurrentThread()) {
+ AsyncCreateTextures(count, size, texture_target, &sync_point);
+ texture_ids->swap(created_textures_);
+ texture_mailboxes->swap(created_texture_mailboxes_);
+ compositor_loop_async_waiter_.Reset();
+ return sync_point;
+ }
compositor_message_loop_->PostTask(FROM_HERE, base::Bind(
&RendererGpuVideoDecoderFactories::AsyncCreateTextures, this,
count, size, texture_target, &sync_point));
@@ -160,7 +171,10 @@ void RendererGpuVideoDecoderFactories::AsyncCreateTextures(
}
void RendererGpuVideoDecoderFactories::DeleteTexture(uint32 texture_id) {
- DCHECK(!compositor_message_loop_->BelongsToCurrentThread());
+ if (compositor_message_loop_->BelongsToCurrentThread()) {
+ AsyncDeleteTexture(texture_id);
+ return;
+ }
compositor_message_loop_->PostTask(FROM_HERE, base::Bind(
&RendererGpuVideoDecoderFactories::AsyncDeleteTexture, this, texture_id));
}
@@ -261,7 +275,9 @@ void RendererGpuVideoDecoderFactories::AsyncReadPixels(
base::SharedMemory* RendererGpuVideoDecoderFactories::CreateSharedMemory(
size_t size) {
- DCHECK(!main_message_loop_->BelongsToCurrentThread());
+ if (main_message_loop_->BelongsToCurrentThread()) {
+ return ChildThread::current()->AllocateSharedMemory(size);
+ }
main_message_loop_->PostTask(FROM_HERE, base::Bind(
&RendererGpuVideoDecoderFactories::AsyncCreateSharedMemory, this,
size));
« no previous file with comments | « content/renderer/media/media_stream_dependency_factory.cc ('k') | content/renderer/media/rtc_video_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698