| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 if (client_) | 129 if (client_) |
| 130 client_->DidReceiveFrame(); | 130 client_->DidReceiveFrame(); |
| 131 } | 131 } |
| 132 | 132 |
| 133 } // namespace | 133 } // namespace |
| 134 | 134 |
| 135 // static | 135 // static |
| 136 scoped_refptr<StreamTextureFactorySynchronousImpl> | 136 scoped_refptr<StreamTextureFactorySynchronousImpl> |
| 137 StreamTextureFactorySynchronousImpl::Create( | 137 StreamTextureFactorySynchronousImpl::Create( |
| 138 const CreateContextProviderCallback& try_create_callback, | 138 const CreateContextProviderCallback& try_create_callback, |
| 139 int view_id) { | 139 int frame_id) { |
| 140 return new StreamTextureFactorySynchronousImpl(try_create_callback, view_id); | 140 return new StreamTextureFactorySynchronousImpl(try_create_callback, frame_id); |
| 141 } | 141 } |
| 142 | 142 |
| 143 StreamTextureFactorySynchronousImpl::StreamTextureFactorySynchronousImpl( | 143 StreamTextureFactorySynchronousImpl::StreamTextureFactorySynchronousImpl( |
| 144 const CreateContextProviderCallback& try_create_callback, | 144 const CreateContextProviderCallback& try_create_callback, |
| 145 int view_id) | 145 int frame_id) |
| 146 : create_context_provider_callback_(try_create_callback), | 146 : create_context_provider_callback_(try_create_callback), |
| 147 context_provider_(create_context_provider_callback_.Run()), | 147 context_provider_(create_context_provider_callback_.Run()), |
| 148 view_id_(view_id) {} | 148 frame_id_(frame_id) {} |
| 149 | 149 |
| 150 StreamTextureFactorySynchronousImpl::~StreamTextureFactorySynchronousImpl() {} | 150 StreamTextureFactorySynchronousImpl::~StreamTextureFactorySynchronousImpl() {} |
| 151 | 151 |
| 152 StreamTextureProxy* StreamTextureFactorySynchronousImpl::CreateProxy() { | 152 StreamTextureProxy* StreamTextureFactorySynchronousImpl::CreateProxy() { |
| 153 if (!context_provider_) | 153 if (!context_provider_) |
| 154 context_provider_ = create_context_provider_callback_.Run(); | 154 context_provider_ = create_context_provider_callback_.Run(); |
| 155 | 155 |
| 156 if (!context_provider_) | 156 if (!context_provider_) |
| 157 return NULL; | 157 return NULL; |
| 158 return new StreamTextureProxyImpl(context_provider_); | 158 return new StreamTextureProxyImpl(context_provider_); |
| 159 } | 159 } |
| 160 | 160 |
| 161 void StreamTextureFactorySynchronousImpl::EstablishPeer(int32 stream_id, | 161 void StreamTextureFactorySynchronousImpl::EstablishPeer(int32 stream_id, |
| 162 int player_id) { | 162 int player_id) { |
| 163 DCHECK(context_provider_); | 163 DCHECK(context_provider_); |
| 164 scoped_refptr<gfx::SurfaceTexture> surface_texture = | 164 scoped_refptr<gfx::SurfaceTexture> surface_texture = |
| 165 context_provider_->GetSurfaceTexture(stream_id); | 165 context_provider_->GetSurfaceTexture(stream_id); |
| 166 if (surface_texture) { | 166 if (surface_texture) { |
| 167 SurfaceTexturePeer::GetInstance()->EstablishSurfaceTexturePeer( | 167 SurfaceTexturePeer::GetInstance()->EstablishSurfaceTexturePeer( |
| 168 base::Process::Current().handle(), | 168 base::Process::Current().handle(), |
| 169 surface_texture, | 169 surface_texture, |
| 170 view_id_, | 170 frame_id_, |
| 171 player_id); | 171 player_id); |
| 172 } | 172 } |
| 173 } | 173 } |
| 174 | 174 |
| 175 unsigned StreamTextureFactorySynchronousImpl::CreateStreamTexture( | 175 unsigned StreamTextureFactorySynchronousImpl::CreateStreamTexture( |
| 176 unsigned texture_target, | 176 unsigned texture_target, |
| 177 unsigned* texture_id, | 177 unsigned* texture_id, |
| 178 gpu::Mailbox* texture_mailbox) { | 178 gpu::Mailbox* texture_mailbox) { |
| 179 DCHECK(context_provider_); | 179 DCHECK(context_provider_); |
| 180 unsigned stream_id = 0; | 180 unsigned stream_id = 0; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 191 void StreamTextureFactorySynchronousImpl::SetStreamTextureSize( | 191 void StreamTextureFactorySynchronousImpl::SetStreamTextureSize( |
| 192 int32 stream_id, | 192 int32 stream_id, |
| 193 const gfx::Size& size) {} | 193 const gfx::Size& size) {} |
| 194 | 194 |
| 195 gpu::gles2::GLES2Interface* StreamTextureFactorySynchronousImpl::ContextGL() { | 195 gpu::gles2::GLES2Interface* StreamTextureFactorySynchronousImpl::ContextGL() { |
| 196 DCHECK(context_provider_); | 196 DCHECK(context_provider_); |
| 197 return context_provider_->ContextGL(); | 197 return context_provider_->ContextGL(); |
| 198 } | 198 } |
| 199 | 199 |
| 200 } // namespace content | 200 } // namespace content |
| OLD | NEW |