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 1f0e85a754badb76c2f739d0ec3b049ed7ca7af3..700df08e19423ee87e3f18f63e0aca763a747a1f 100644 |
--- a/content/renderer/media/renderer_gpu_video_decoder_factories.cc |
+++ b/content/renderer/media/renderer_gpu_video_decoder_factories.cc |
@@ -160,6 +160,67 @@ void RendererGpuVideoDecoderFactories::AsyncDeleteTexture(uint32 texture_id) { |
DCHECK_EQ(gles2->GetError(), static_cast<GLenum>(GL_NO_ERROR)); |
} |
+gpu::Mailbox RendererGpuVideoDecoderFactories::ProduceTextureToMailbox( |
+ uint32 texture_id) { |
+ gpu::Mailbox mailbox; |
+ if (message_loop_->BelongsToCurrentThread()) { |
+ AsyncProduceTextureToMailbox(texture_id, &mailbox); |
+ return mailbox; |
+ } |
+ |
+ message_loop_->PostTask(FROM_HERE, base::Bind( |
+ &RendererGpuVideoDecoderFactories::AsyncProduceTextureToMailbox, |
+ this, |
+ texture_id, |
+ &mailbox)); |
+ base::WaitableEvent* objects[] = {&aborted_waiter_, &async_waiter_}; |
+ base::WaitableEvent::WaitMany(objects, arraysize(objects)); |
+ return mailbox; |
+} |
+ |
+void RendererGpuVideoDecoderFactories::AsyncProduceTextureToMailbox( |
+ uint32 texture_id, gpu::Mailbox* mailbox) { |
+ DCHECK(message_loop_->BelongsToCurrentThread()); |
+ if (!context_) { |
+ async_waiter_.Signal(); |
+ return; |
+ } |
+ |
+ gpu::gles2::GLES2Implementation* gles2 = context_->GetImplementation(); |
+ gles2->GenMailboxCHROMIUM(mailbox->name); |
+ gles2->BindTexture(GL_TEXTURE_2D, texture_id); |
+ gles2->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox->name); |
piman
2013/04/11 22:57:58
You probably need to shallow Flush so that the com
danakj
2013/04/12 00:01:39
Should be fine to stick a sync point into the Vide
|
+} |
+ |
+void RendererGpuVideoDecoderFactories::ConsumeMailboxToTexture( |
+ const gpu::Mailbox& mailbox, uint32 texture_id) { |
+ if (message_loop_->BelongsToCurrentThread()) { |
+ AsyncConsumeMailboxToTexture(mailbox, texture_id); |
+ return; |
+ } |
+ |
+ message_loop_->PostTask(FROM_HERE, base::Bind( |
+ &RendererGpuVideoDecoderFactories::AsyncConsumeMailboxToTexture, |
+ this, |
+ mailbox, |
+ texture_id)); |
+ base::WaitableEvent* objects[] = {&aborted_waiter_, &async_waiter_}; |
+ base::WaitableEvent::WaitMany(objects, arraysize(objects)); |
+} |
+ |
+void RendererGpuVideoDecoderFactories::AsyncConsumeMailboxToTexture( |
+ const gpu::Mailbox& mailbox, uint32 texture_id) { |
+ DCHECK(message_loop_->BelongsToCurrentThread()); |
+ if (!context_) { |
+ async_waiter_.Signal(); |
+ return; |
+ } |
+ |
+ gpu::gles2::GLES2Implementation* gles2 = context_->GetImplementation(); |
+ gles2->BindTexture(GL_TEXTURE_2D, texture_id); |
+ gles2->ConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); |
+} |
+ |
void RendererGpuVideoDecoderFactories::ReadPixels( |
uint32 texture_id, uint32 texture_target, const gfx::Size& size, |
const SkBitmap& pixels) { |