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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 112 |
113 webkit_media::StreamTextureProxy* StreamTextureFactoryImpl::CreateProxy() { | 113 webkit_media::StreamTextureProxy* StreamTextureFactoryImpl::CreateProxy() { |
114 DCHECK(channel_.get()); | 114 DCHECK(channel_.get()); |
115 StreamTextureHost* host = new StreamTextureHost(channel_.get()); | 115 StreamTextureHost* host = new StreamTextureHost(channel_.get()); |
116 return new StreamTextureProxyImpl(host); | 116 return new StreamTextureProxyImpl(host); |
117 } | 117 } |
118 | 118 |
119 void StreamTextureFactoryImpl::EstablishPeer(int stream_id, int player_id) { | 119 void StreamTextureFactoryImpl::EstablishPeer(int stream_id, int player_id) { |
120 DCHECK(channel_.get()); | 120 DCHECK(channel_.get()); |
121 channel_->Send(new GpuChannelMsg_EstablishStreamTexture( | 121 channel_->Send(new GpuChannelMsg_EstablishStreamTexture( |
122 stream_id, SurfaceTexturePeer::SET_VIDEO_SURFACE_TEXTURE, | 122 stream_id, view_id_, player_id)); |
123 view_id_, player_id)); | |
124 } | 123 } |
125 | 124 |
126 unsigned StreamTextureFactoryImpl::CreateStreamTexture(unsigned* texture_id) { | 125 unsigned StreamTextureFactoryImpl::CreateStreamTexture(unsigned* texture_id) { |
127 unsigned stream_id = 0; | 126 unsigned stream_id = 0; |
128 if (context_->makeContextCurrent()) { | 127 if (context_->makeContextCurrent()) { |
129 *texture_id = context_->createTexture(); | 128 *texture_id = context_->createTexture(); |
130 stream_id = context_->createStreamTextureCHROMIUM(*texture_id); | 129 stream_id = context_->createStreamTextureCHROMIUM(*texture_id); |
131 context_->flush(); | 130 context_->flush(); |
132 } | 131 } |
133 return stream_id; | 132 return stream_id; |
134 } | 133 } |
135 | 134 |
136 void StreamTextureFactoryImpl::DestroyStreamTexture(unsigned texture_id) { | 135 void StreamTextureFactoryImpl::DestroyStreamTexture(unsigned texture_id) { |
137 if (context_->makeContextCurrent()) { | 136 if (context_->makeContextCurrent()) { |
138 context_->destroyStreamTextureCHROMIUM(texture_id); | 137 context_->destroyStreamTextureCHROMIUM(texture_id); |
139 context_->deleteTexture(texture_id); | 138 context_->deleteTexture(texture_id); |
140 context_->flush(); | 139 context_->flush(); |
141 } | 140 } |
142 } | 141 } |
143 | 142 |
144 } // namespace content | 143 } // namespace content |
OLD | NEW |