OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/stream_texture_factory_impl_android.h" | 5 #include "content/renderer/media/stream_texture_factory_impl_android.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 StreamTextureHost* host = new StreamTextureHost(channel_.get()); | 109 StreamTextureHost* host = new StreamTextureHost(channel_.get()); |
110 return new StreamTextureProxyImpl(host); | 110 return new StreamTextureProxyImpl(host); |
111 } | 111 } |
112 | 112 |
113 void StreamTextureFactoryImpl::EstablishPeer(int stream_id, int player_id) { | 113 void StreamTextureFactoryImpl::EstablishPeer(int stream_id, int player_id) { |
114 DCHECK(channel_.get()); | 114 DCHECK(channel_.get()); |
115 channel_->Send(new GpuChannelMsg_EstablishStreamTexture( | 115 channel_->Send(new GpuChannelMsg_EstablishStreamTexture( |
116 stream_id, view_id_, player_id)); | 116 stream_id, view_id_, player_id)); |
117 } | 117 } |
118 | 118 |
119 unsigned StreamTextureFactoryImpl::CreateStreamTexture(unsigned* texture_id) { | 119 unsigned StreamTextureFactoryImpl::CreateStreamTexture( |
| 120 unsigned texture_target, |
| 121 unsigned* texture_id, |
| 122 gpu::Mailbox* texture_mailbox, |
| 123 unsigned* texture_mailbox_sync_point) { |
120 unsigned stream_id = 0; | 124 unsigned stream_id = 0; |
121 if (context_->makeContextCurrent()) { | 125 if (context_->makeContextCurrent()) { |
122 *texture_id = context_->createTexture(); | 126 *texture_id = context_->createTexture(); |
123 stream_id = context_->createStreamTextureCHROMIUM(*texture_id); | 127 stream_id = context_->createStreamTextureCHROMIUM(*texture_id); |
| 128 |
| 129 context_->genMailboxCHROMIUM(texture_mailbox->name); |
| 130 context_->bindTexture(texture_target, *texture_id); |
| 131 context_->produceTextureCHROMIUM(texture_target, texture_mailbox->name); |
| 132 |
124 context_->flush(); | 133 context_->flush(); |
| 134 *texture_mailbox_sync_point = context_->insertSyncPoint(); |
125 } | 135 } |
126 return stream_id; | 136 return stream_id; |
127 } | 137 } |
128 | 138 |
129 void StreamTextureFactoryImpl::DestroyStreamTexture(unsigned texture_id) { | 139 void StreamTextureFactoryImpl::DestroyStreamTexture(unsigned texture_id) { |
130 if (context_->makeContextCurrent()) { | 140 if (context_->makeContextCurrent()) { |
| 141 // TODO(sievers): Make the destroyStreamTexture implicit when the last |
| 142 // texture referencing it is lost. |
131 context_->destroyStreamTextureCHROMIUM(texture_id); | 143 context_->destroyStreamTextureCHROMIUM(texture_id); |
132 context_->deleteTexture(texture_id); | 144 context_->deleteTexture(texture_id); |
133 context_->flush(); | 145 context_->flush(); |
134 } | 146 } |
135 } | 147 } |
136 | 148 |
137 } // namespace content | 149 } // namespace content |
OLD | NEW |