OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/render_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 5213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5224 #if defined(OS_ANDROID) | 5224 #if defined(OS_ANDROID) |
5225 WebMediaPlayer* RenderFrameImpl::CreateAndroidWebMediaPlayer( | 5225 WebMediaPlayer* RenderFrameImpl::CreateAndroidWebMediaPlayer( |
5226 WebMediaPlayerClient* client, | 5226 WebMediaPlayerClient* client, |
5227 WebMediaPlayerEncryptedMediaClient* encrypted_client, | 5227 WebMediaPlayerEncryptedMediaClient* encrypted_client, |
5228 const media::WebMediaPlayerParams& params) { | 5228 const media::WebMediaPlayerParams& params) { |
5229 scoped_refptr<StreamTextureFactory> stream_texture_factory; | 5229 scoped_refptr<StreamTextureFactory> stream_texture_factory; |
5230 if (SynchronousCompositorFactory* factory = | 5230 if (SynchronousCompositorFactory* factory = |
5231 SynchronousCompositorFactory::GetInstance()) { | 5231 SynchronousCompositorFactory::GetInstance()) { |
5232 stream_texture_factory = factory->CreateStreamTextureFactory(routing_id_); | 5232 stream_texture_factory = factory->CreateStreamTextureFactory(routing_id_); |
5233 } else { | 5233 } else { |
5234 GpuChannelHost* gpu_channel_host = | 5234 stream_texture_factory = |
5235 RenderThreadImpl::current()->EstablishGpuChannelSync( | 5235 RenderThreadImpl::current()->GetStreamTexureFactory(); |
5236 CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE); | 5236 if (!stream_texture_factory.get()) { |
5237 | 5237 LOG(ERROR) << "Failed to get stream texture factory!"; |
5238 if (!gpu_channel_host) { | |
5239 LOG(ERROR) << "Failed to establish GPU channel for media player"; | |
5240 return NULL; | 5238 return NULL; |
5241 } | 5239 } |
5242 | |
5243 scoped_refptr<cc_blink::ContextProviderWebContext> context_provider = | |
5244 RenderThreadImpl::current()->SharedMainThreadContextProvider(); | |
5245 | |
5246 if (!context_provider.get()) { | |
5247 LOG(ERROR) << "Failed to get context3d for media player"; | |
5248 return NULL; | |
5249 } | |
5250 | |
5251 stream_texture_factory = StreamTextureFactoryImpl::Create( | |
5252 context_provider, gpu_channel_host, routing_id_); | |
5253 } | 5240 } |
5254 | 5241 |
5255 return new WebMediaPlayerAndroid(frame_, client, encrypted_client, | 5242 return new WebMediaPlayerAndroid(frame_, client, encrypted_client, |
5256 GetWebMediaPlayerDelegate()->AsWeakPtr(), | 5243 GetWebMediaPlayerDelegate()->AsWeakPtr(), |
5257 GetMediaPlayerManager(), GetCdmFactory(), | 5244 GetMediaPlayerManager(), GetCdmFactory(), |
5258 stream_texture_factory, params); | 5245 stream_texture_factory, routing_id_, params); |
5259 } | 5246 } |
5260 | 5247 |
5261 RendererMediaPlayerManager* RenderFrameImpl::GetMediaPlayerManager() { | 5248 RendererMediaPlayerManager* RenderFrameImpl::GetMediaPlayerManager() { |
5262 if (!media_player_manager_) | 5249 if (!media_player_manager_) |
5263 media_player_manager_ = new RendererMediaPlayerManager(this); | 5250 media_player_manager_ = new RendererMediaPlayerManager(this); |
5264 return media_player_manager_; | 5251 return media_player_manager_; |
5265 } | 5252 } |
5266 #endif // defined(OS_ANDROID) | 5253 #endif // defined(OS_ANDROID) |
5267 | 5254 |
5268 scoped_ptr<media::MediaPermission> RenderFrameImpl::CreateMediaPermissionProxy( | 5255 scoped_ptr<media::MediaPermission> RenderFrameImpl::CreateMediaPermissionProxy( |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5373 media::ConvertToSwitchOutputDeviceCB(web_callbacks); | 5360 media::ConvertToSwitchOutputDeviceCB(web_callbacks); |
5374 scoped_refptr<media::AudioOutputDevice> device = | 5361 scoped_refptr<media::AudioOutputDevice> device = |
5375 AudioDeviceFactory::NewOutputDevice(routing_id_, 0, sink_id.utf8(), | 5362 AudioDeviceFactory::NewOutputDevice(routing_id_, 0, sink_id.utf8(), |
5376 security_origin); | 5363 security_origin); |
5377 media::OutputDeviceStatus status = device->GetDeviceStatus(); | 5364 media::OutputDeviceStatus status = device->GetDeviceStatus(); |
5378 device->Stop(); | 5365 device->Stop(); |
5379 callback.Run(status); | 5366 callback.Run(status); |
5380 } | 5367 } |
5381 | 5368 |
5382 } // namespace content | 5369 } // namespace content |
OLD | NEW |