| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/media/android/stream_texture_factory.h" | 5 #include "content/renderer/media/android/stream_texture_factory.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "cc/output/context_provider.h" | 8 #include "cc/output/context_provider.h" |
| 9 #include "content/common/gpu/client/context_provider_command_buffer.h" | 9 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 10 #include "gpu/command_buffer/client/gles2_interface.h" | 10 #include "gpu/command_buffer/client/gles2_interface.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 channel_->Send( | 97 channel_->Send( |
| 98 new GpuStreamTextureMsg_EstablishPeer(stream_id, frame_id, player_id)); | 98 new GpuStreamTextureMsg_EstablishPeer(stream_id, frame_id, player_id)); |
| 99 } | 99 } |
| 100 | 100 |
| 101 unsigned StreamTextureFactory::CreateStreamTexture( | 101 unsigned StreamTextureFactory::CreateStreamTexture( |
| 102 unsigned texture_target, | 102 unsigned texture_target, |
| 103 unsigned* texture_id, | 103 unsigned* texture_id, |
| 104 gpu::Mailbox* texture_mailbox) { | 104 gpu::Mailbox* texture_mailbox) { |
| 105 GLuint stream_id = 0; | 105 GLuint stream_id = 0; |
| 106 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); | 106 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); |
| 107 int32_t image_id = channel_->ReserveImageId(); |
| 107 gl->GenTextures(1, texture_id); | 108 gl->GenTextures(1, texture_id); |
| 108 gl->ShallowFlushCHROMIUM(); | 109 gl->ShallowFlushCHROMIUM(); |
| 109 stream_id = context_provider_->GetCommandBufferProxy()->CreateStreamTexture( | 110 stream_id = context_provider_->GetCommandBufferProxy()->CreateStreamTexture( |
| 110 *texture_id); | 111 image_id); |
| 112 gl->BindTexture(texture_target, *texture_id); |
| 113 gl->BindTexImage2DCHROMIUM(texture_target, image_id); |
| 111 gl->GenMailboxCHROMIUM(texture_mailbox->name); | 114 gl->GenMailboxCHROMIUM(texture_mailbox->name); |
| 112 gl->ProduceTextureDirectCHROMIUM( | 115 gl->ProduceTextureDirectCHROMIUM( |
| 113 *texture_id, texture_target, texture_mailbox->name); | 116 *texture_id, texture_target, texture_mailbox->name); |
| 117 gl->Finish(); |
| 114 return stream_id; | 118 return stream_id; |
| 115 } | 119 } |
| 116 | 120 |
| 117 void StreamTextureFactory::SetStreamTextureSize(int32_t stream_id, | 121 void StreamTextureFactory::SetStreamTextureSize(int32_t stream_id, |
| 118 const gfx::Size& size) { | 122 const gfx::Size& size) { |
| 119 channel_->Send(new GpuStreamTextureMsg_SetSize(stream_id, size)); | 123 channel_->Send(new GpuStreamTextureMsg_SetSize(stream_id, size)); |
| 120 } | 124 } |
| 121 | 125 |
| 122 gpu::gles2::GLES2Interface* StreamTextureFactory::ContextGL() { | 126 gpu::gles2::GLES2Interface* StreamTextureFactory::ContextGL() { |
| 123 return context_provider_->ContextGL(); | 127 return context_provider_->ContextGL(); |
| 124 } | 128 } |
| 125 | 129 |
| 126 } // namespace content | 130 } // namespace content |
| OLD | NEW |