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_synchronous_impl
.h" | 5 #include "content/renderer/media/android/stream_texture_factory_synchronous_impl
.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 context_provider_->GetSurfaceTexture(stream_id); | 185 context_provider_->GetSurfaceTexture(stream_id); |
186 if (surface_texture.get()) { | 186 if (surface_texture.get()) { |
187 SurfaceTexturePeer::GetInstance()->EstablishSurfaceTexturePeer( | 187 SurfaceTexturePeer::GetInstance()->EstablishSurfaceTexturePeer( |
188 base::GetCurrentProcessHandle(), | 188 base::GetCurrentProcessHandle(), |
189 surface_texture, | 189 surface_texture, |
190 frame_id_, | 190 frame_id_, |
191 player_id); | 191 player_id); |
192 } | 192 } |
193 } | 193 } |
194 | 194 |
195 unsigned StreamTextureFactorySynchronousImpl::CreateStreamTexture( | 195 int32 StreamTextureFactorySynchronousImpl::CreateStreamTexture( |
196 unsigned texture_target, | 196 unsigned texture_target, |
197 unsigned* texture_id, | 197 unsigned* texture_id, |
198 gpu::Mailbox* texture_mailbox) { | 198 gpu::Mailbox* texture_mailbox) { |
199 DCHECK(context_provider_.get()); | 199 DCHECK(context_provider_.get()); |
200 unsigned stream_id = 0; | 200 int32 stream_id = 0; |
201 GLES2Interface* gl = context_provider_->ContextGL(); | 201 GLES2Interface* gl = context_provider_->ContextGL(); |
202 gl->GenTextures(1, texture_id); | 202 gl->GenTextures(1, texture_id); |
203 stream_id = gl->CreateStreamTextureCHROMIUM(*texture_id); | 203 stream_id = gl->CreateStreamTextureCHROMIUM(*texture_id); |
204 | 204 |
205 gl->GenMailboxCHROMIUM(texture_mailbox->name); | 205 gl->GenMailboxCHROMIUM(texture_mailbox->name); |
206 gl->ProduceTextureDirectCHROMIUM( | 206 gl->ProduceTextureDirectCHROMIUM( |
207 *texture_id, texture_target, texture_mailbox->name); | 207 *texture_id, texture_target, texture_mailbox->name); |
208 return stream_id; | 208 return stream_id; |
209 } | 209 } |
210 | 210 |
211 void StreamTextureFactorySynchronousImpl::SetStreamTextureSize( | |
212 int32 stream_id, | |
213 const gfx::Size& size) {} | |
214 | |
215 gpu::gles2::GLES2Interface* StreamTextureFactorySynchronousImpl::ContextGL() { | 211 gpu::gles2::GLES2Interface* StreamTextureFactorySynchronousImpl::ContextGL() { |
216 DCHECK(context_provider_.get()); | 212 DCHECK(context_provider_.get()); |
217 return context_provider_->ContextGL(); | 213 return context_provider_->ContextGL(); |
218 } | 214 } |
219 | 215 |
220 void StreamTextureFactorySynchronousImpl::AddObserver( | 216 void StreamTextureFactorySynchronousImpl::AddObserver( |
221 StreamTextureFactoryContextObserver* obs) { | 217 StreamTextureFactoryContextObserver* obs) { |
222 DCHECK(!observer_); | 218 DCHECK(!observer_); |
223 observer_ = obs; | 219 observer_ = obs; |
224 if (context_provider_.get()) | 220 if (context_provider_.get()) |
225 context_provider_->AddObserver(obs); | 221 context_provider_->AddObserver(obs); |
226 } | 222 } |
227 | 223 |
228 void StreamTextureFactorySynchronousImpl::RemoveObserver( | 224 void StreamTextureFactorySynchronousImpl::RemoveObserver( |
229 StreamTextureFactoryContextObserver* obs) { | 225 StreamTextureFactoryContextObserver* obs) { |
230 DCHECK_EQ(observer_, obs); | 226 DCHECK_EQ(observer_, obs); |
231 observer_ = NULL; | 227 observer_ = NULL; |
232 if (context_provider_.get()) | 228 if (context_provider_.get()) |
233 context_provider_->RemoveObserver(obs); | 229 context_provider_->RemoveObserver(obs); |
234 } | 230 } |
235 | 231 |
236 } // namespace content | 232 } // namespace content |
OLD | NEW |