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/media_stream_dependency_factory.h" | 5 #include "content/renderer/media/media_stream_dependency_factory.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
218 WebKit::WebMediaStream* description_; | 218 WebKit::WebMediaStream* description_; |
219 MediaStreamDependencyFactory::MediaSourcesCreatedCallback ready_callback_; | 219 MediaStreamDependencyFactory::MediaSourcesCreatedCallback ready_callback_; |
220 bool live_; | 220 bool live_; |
221 typedef std::vector<scoped_refptr<webrtc::MediaSourceInterface> > | 221 typedef std::vector<scoped_refptr<webrtc::MediaSourceInterface> > |
222 ObservedSources; | 222 ObservedSources; |
223 ObservedSources sources_; | 223 ObservedSources sources_; |
224 }; | 224 }; |
225 | 225 |
226 MediaStreamDependencyFactory::MediaStreamDependencyFactory( | 226 MediaStreamDependencyFactory::MediaStreamDependencyFactory( |
227 VideoCaptureImplManager* vc_manager, | 227 VideoCaptureImplManager* vc_manager, |
228 P2PSocketDispatcher* p2p_socket_dispatcher) | 228 P2PSocketDispatcher* p2p_socket_dispatcher, |
229 const scoped_refptr<base::MessageLoopProxy>& media_loop_proxy) | |
229 : network_manager_(NULL), | 230 : network_manager_(NULL), |
230 #if defined(GOOGLE_TV) | 231 #if defined(GOOGLE_TV) |
231 decoder_factory_tv_(NULL), | 232 decoder_factory_tv_(NULL), |
232 #endif | 233 #endif |
233 vc_manager_(vc_manager), | 234 vc_manager_(vc_manager), |
234 p2p_socket_dispatcher_(p2p_socket_dispatcher), | 235 p2p_socket_dispatcher_(p2p_socket_dispatcher), |
235 signaling_thread_(NULL), | 236 signaling_thread_(NULL), |
236 worker_thread_(NULL), | 237 worker_thread_(NULL), |
237 chrome_worker_thread_("Chrome_libJingle_WorkerThread") { | 238 chrome_worker_thread_("Chrome_libJingle_WorkerThread"), |
239 media_loop_proxy_(media_loop_proxy) { | |
238 } | 240 } |
239 | 241 |
240 MediaStreamDependencyFactory::~MediaStreamDependencyFactory() { | 242 MediaStreamDependencyFactory::~MediaStreamDependencyFactory() { |
241 CleanupPeerConnectionFactory(); | 243 CleanupPeerConnectionFactory(); |
242 } | 244 } |
243 | 245 |
244 WebKit::WebRTCPeerConnectionHandler* | 246 WebKit::WebRTCPeerConnectionHandler* |
245 MediaStreamDependencyFactory::CreateRTCPeerConnectionHandler( | 247 MediaStreamDependencyFactory::CreateRTCPeerConnectionHandler( |
246 WebKit::WebRTCPeerConnectionHandlerClient* client) { | 248 WebKit::WebRTCPeerConnectionHandlerClient* client) { |
247 // Save histogram data so we can see how much PeerConnetion is used. | 249 // Save histogram data so we can see how much PeerConnetion is used. |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
490 DVLOG(1) << "MediaStreamDependencyFactory::CreatePeerConnectionFactory()"; | 492 DVLOG(1) << "MediaStreamDependencyFactory::CreatePeerConnectionFactory()"; |
491 if (!pc_factory_.get()) { | 493 if (!pc_factory_.get()) { |
492 DCHECK(!audio_device_.get()); | 494 DCHECK(!audio_device_.get()); |
493 audio_device_ = new WebRtcAudioDeviceImpl(); | 495 audio_device_ = new WebRtcAudioDeviceImpl(); |
494 | 496 |
495 scoped_ptr<cricket::WebRtcVideoDecoderFactory> decoder_factory; | 497 scoped_ptr<cricket::WebRtcVideoDecoderFactory> decoder_factory; |
496 scoped_ptr<cricket::WebRtcVideoEncoderFactory> encoder_factory; | 498 scoped_ptr<cricket::WebRtcVideoEncoderFactory> encoder_factory; |
497 | 499 |
498 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 500 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
499 if (cmd_line->HasSwitch(switches::kEnableWebRtcHWDecoding)) { | 501 if (cmd_line->HasSwitch(switches::kEnableWebRtcHWDecoding)) { |
500 scoped_refptr<media::GpuVideoDecoder::Factories> gpu_factories = | 502 scoped_refptr<content::RendererGpuVideoDecoderFactories> gpu_factories = |
501 RenderThreadImpl::current()->GetGpuFactories(); | 503 RenderThreadImpl::current()->GetGpuFactories(media_loop_proxy_); |
scherkus (not reviewing)
2013/07/19 18:13:58
how about replacing media_loop_proxy_ with a call
wuchengli
2013/07/20 06:04:14
Good idea. Done.
| |
502 if (gpu_factories.get() != NULL) | 504 if (gpu_factories.get() != NULL) { |
503 decoder_factory.reset(new RTCVideoDecoderFactory(gpu_factories)); | 505 decoder_factory.reset( |
506 new RTCVideoDecoderFactory(media_loop_proxy_, gpu_factories)); | |
507 } | |
504 } | 508 } |
505 #if defined(GOOGLE_TV) | 509 #if defined(GOOGLE_TV) |
506 // PeerConnectionFactory will hold the ownership of this | 510 // PeerConnectionFactory will hold the ownership of this |
507 // VideoDecoderFactory. | 511 // VideoDecoderFactory. |
508 decoder_factory.reset(decoder_factory_tv_ = new RTCVideoDecoderFactoryTv); | 512 decoder_factory.reset(decoder_factory_tv_ = new RTCVideoDecoderFactoryTv); |
509 #endif | 513 #endif |
510 | 514 |
511 #if defined(ENABLE_WEBRTC) && defined(OS_CHROMEOS) | 515 #if defined(ENABLE_WEBRTC) && defined(OS_CHROMEOS) |
512 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 516 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
513 if (command_line.HasSwitch(switches::kEnableEncodedScreenCapture)) { | 517 if (command_line.HasSwitch(switches::kEnableEncodedScreenCapture)) { |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
825 // processed before returning. We wait for the above task to finish before | 829 // processed before returning. We wait for the above task to finish before |
826 // letting the the function continue to avoid any potential race issues. | 830 // letting the the function continue to avoid any potential race issues. |
827 chrome_worker_thread_.Stop(); | 831 chrome_worker_thread_.Stop(); |
828 } else { | 832 } else { |
829 NOTREACHED() << "Worker thread not running."; | 833 NOTREACHED() << "Worker thread not running."; |
830 } | 834 } |
831 } | 835 } |
832 } | 836 } |
833 | 837 |
834 } // namespace content | 838 } // namespace content |
OLD | NEW |