| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 return new StreamTextureProxy(host); | 88 return new StreamTextureProxy(host); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void StreamTextureFactory::EstablishPeer(int32_t stream_id, | 91 void StreamTextureFactory::EstablishPeer(int32_t stream_id, |
| 92 int player_id, | 92 int player_id, |
| 93 int frame_id) { | 93 int frame_id) { |
| 94 channel_->Send( | 94 channel_->Send( |
| 95 new GpuStreamTextureMsg_EstablishPeer(stream_id, frame_id, player_id)); | 95 new GpuStreamTextureMsg_EstablishPeer(stream_id, frame_id, player_id)); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void StreamTextureFactory::RegisterStreamTexture(int32_t stream_id, |
| 99 int surface_texture_id) { |
| 100 channel_->Send(new GpuStreamTextureMsg_RegisterStreamTexture( |
| 101 stream_id, surface_texture_id)); |
| 102 } |
| 103 |
| 98 unsigned StreamTextureFactory::CreateStreamTexture( | 104 unsigned StreamTextureFactory::CreateStreamTexture( |
| 99 unsigned texture_target, | 105 unsigned texture_target, |
| 100 unsigned* texture_id, | 106 unsigned* texture_id, |
| 101 gpu::Mailbox* texture_mailbox) { | 107 gpu::Mailbox* texture_mailbox) { |
| 102 GLuint stream_id = 0; | 108 GLuint stream_id = 0; |
| 103 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); | 109 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); |
| 104 gl->GenTextures(1, texture_id); | 110 gl->GenTextures(1, texture_id); |
| 105 gl->ShallowFlushCHROMIUM(); | 111 gl->ShallowFlushCHROMIUM(); |
| 106 stream_id = context_provider_->GetCommandBufferProxy()->CreateStreamTexture( | 112 stream_id = context_provider_->GetCommandBufferProxy()->CreateStreamTexture( |
| 107 *texture_id); | 113 *texture_id); |
| 108 gl->GenMailboxCHROMIUM(texture_mailbox->name); | 114 gl->GenMailboxCHROMIUM(texture_mailbox->name); |
| 109 gl->ProduceTextureDirectCHROMIUM( | 115 gl->ProduceTextureDirectCHROMIUM( |
| 110 *texture_id, texture_target, texture_mailbox->name); | 116 *texture_id, texture_target, texture_mailbox->name); |
| 111 return stream_id; | 117 return stream_id; |
| 112 } | 118 } |
| 113 | 119 |
| 114 void StreamTextureFactory::SetStreamTextureSize(int32_t stream_id, | 120 void StreamTextureFactory::SetStreamTextureSize(int32_t stream_id, |
| 115 const gfx::Size& size) { | 121 const gfx::Size& size) { |
| 116 channel_->Send(new GpuStreamTextureMsg_SetSize(stream_id, size)); | 122 channel_->Send(new GpuStreamTextureMsg_SetSize(stream_id, size)); |
| 117 } | 123 } |
| 118 | 124 |
| 119 gpu::gles2::GLES2Interface* StreamTextureFactory::ContextGL() { | 125 gpu::gles2::GLES2Interface* StreamTextureFactory::ContextGL() { |
| 120 return context_provider_->ContextGL(); | 126 return context_provider_->ContextGL(); |
| 121 } | 127 } |
| 122 | 128 |
| 123 } // namespace content | 129 } // namespace content |
| OLD | NEW |