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 19 matching lines...) Expand all Loading... |
30 #include "media/filters/gpu_video_decoder_factories.h" | 30 #include "media/filters/gpu_video_decoder_factories.h" |
31 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | 31 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" |
32 #include "third_party/WebKit/public/platform/WebMediaStream.h" | 32 #include "third_party/WebKit/public/platform/WebMediaStream.h" |
33 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" | 33 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" |
34 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 34 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
35 #include "third_party/WebKit/public/platform/WebURL.h" | 35 #include "third_party/WebKit/public/platform/WebURL.h" |
36 #include "third_party/WebKit/public/web/WebDocument.h" | 36 #include "third_party/WebKit/public/web/WebDocument.h" |
37 #include "third_party/WebKit/public/web/WebFrame.h" | 37 #include "third_party/WebKit/public/web/WebFrame.h" |
38 #include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface
.h" | 38 #include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface
.h" |
39 | 39 |
40 #if defined(ENABLE_WEBRTC) | |
41 #include "content/renderer/media/rtc_encoding_video_capturer_factory.h" | |
42 #endif | |
43 | |
44 #if defined(USE_OPENSSL) | 40 #if defined(USE_OPENSSL) |
45 #include "third_party/libjingle/source/talk/base/ssladapter.h" | 41 #include "third_party/libjingle/source/talk/base/ssladapter.h" |
46 #else | 42 #else |
47 #include "net/socket/nss_ssl_util.h" | 43 #include "net/socket/nss_ssl_util.h" |
48 #endif | 44 #endif |
49 | 45 |
50 #if defined(GOOGLE_TV) | 46 #if defined(GOOGLE_TV) |
51 #include "content/renderer/media/rtc_video_decoder_factory_tv.h" | 47 #include "content/renderer/media/rtc_video_decoder_factory_tv.h" |
52 #endif | 48 #endif |
53 | 49 |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 native_stream->RemoveTrack(native_stream->FindVideoTrack(track_id)); | 480 native_stream->RemoveTrack(native_stream->FindVideoTrack(track_id)); |
485 } | 481 } |
486 | 482 |
487 bool MediaStreamDependencyFactory::CreatePeerConnectionFactory() { | 483 bool MediaStreamDependencyFactory::CreatePeerConnectionFactory() { |
488 DVLOG(1) << "MediaStreamDependencyFactory::CreatePeerConnectionFactory()"; | 484 DVLOG(1) << "MediaStreamDependencyFactory::CreatePeerConnectionFactory()"; |
489 if (!pc_factory_.get()) { | 485 if (!pc_factory_.get()) { |
490 DCHECK(!audio_device_.get()); | 486 DCHECK(!audio_device_.get()); |
491 audio_device_ = new WebRtcAudioDeviceImpl(); | 487 audio_device_ = new WebRtcAudioDeviceImpl(); |
492 | 488 |
493 scoped_ptr<cricket::WebRtcVideoDecoderFactory> decoder_factory; | 489 scoped_ptr<cricket::WebRtcVideoDecoderFactory> decoder_factory; |
494 scoped_ptr<cricket::WebRtcVideoEncoderFactory> encoder_factory; | |
495 | 490 |
496 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 491 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
497 if (cmd_line->HasSwitch(switches::kEnableWebRtcHWDecoding)) { | 492 if (cmd_line->HasSwitch(switches::kEnableWebRtcHWDecoding)) { |
498 scoped_refptr<base::MessageLoopProxy> media_loop_proxy = | 493 scoped_refptr<base::MessageLoopProxy> media_loop_proxy = |
499 RenderThreadImpl::current()->GetMediaThreadMessageLoopProxy(); | 494 RenderThreadImpl::current()->GetMediaThreadMessageLoopProxy(); |
500 scoped_refptr<RendererGpuVideoDecoderFactories> gpu_factories = | 495 scoped_refptr<RendererGpuVideoDecoderFactories> gpu_factories = |
501 RenderThreadImpl::current()->GetGpuFactories(media_loop_proxy); | 496 RenderThreadImpl::current()->GetGpuFactories(media_loop_proxy); |
502 if (gpu_factories.get() != NULL) | 497 if (gpu_factories.get() != NULL) |
503 decoder_factory.reset(new RTCVideoDecoderFactory(gpu_factories)); | 498 decoder_factory.reset(new RTCVideoDecoderFactory(gpu_factories)); |
504 } | 499 } |
505 #if defined(GOOGLE_TV) | 500 #if defined(GOOGLE_TV) |
506 // PeerConnectionFactory will hold the ownership of this | 501 // PeerConnectionFactory will hold the ownership of this |
507 // VideoDecoderFactory. | 502 // VideoDecoderFactory. |
508 decoder_factory.reset(decoder_factory_tv_ = new RTCVideoDecoderFactoryTv); | 503 decoder_factory.reset(decoder_factory_tv_ = new RTCVideoDecoderFactoryTv); |
509 #endif | 504 #endif |
510 | 505 |
511 #if defined(ENABLE_WEBRTC) && defined(OS_CHROMEOS) | |
512 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | |
513 if (command_line.HasSwitch(switches::kEnableEncodedScreenCapture)) { | |
514 // PeerConnectionFactory owns the encoder factory. Pass a weak pointer of | |
515 // encoder factory to |vc_manager_| because the manager outlives it. | |
516 RtcEncodingVideoCapturerFactory* rtc_encoding_capturer_factory = | |
517 new RtcEncodingVideoCapturerFactory(); | |
518 encoder_factory.reset(rtc_encoding_capturer_factory); | |
519 vc_manager_->set_encoding_capturer_factory( | |
520 rtc_encoding_capturer_factory->AsWeakPtr()); | |
521 } | |
522 #endif | |
523 | |
524 scoped_refptr<webrtc::PeerConnectionFactoryInterface> factory( | 506 scoped_refptr<webrtc::PeerConnectionFactoryInterface> factory( |
525 webrtc::CreatePeerConnectionFactory(worker_thread_, | 507 webrtc::CreatePeerConnectionFactory(worker_thread_, |
526 signaling_thread_, | 508 signaling_thread_, |
527 audio_device_.get(), | 509 audio_device_.get(), |
528 encoder_factory.release(), | 510 NULL, |
529 decoder_factory.release())); | 511 decoder_factory.release())); |
530 if (factory.get()) | 512 if (factory.get()) |
531 pc_factory_ = factory; | 513 pc_factory_ = factory; |
532 else | 514 else |
533 audio_device_ = NULL; | 515 audio_device_ = NULL; |
534 } | 516 } |
535 return pc_factory_.get() != NULL; | 517 return pc_factory_.get() != NULL; |
536 } | 518 } |
537 | 519 |
538 bool MediaStreamDependencyFactory::PeerConnectionFactoryCreated() { | 520 bool MediaStreamDependencyFactory::PeerConnectionFactoryCreated() { |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 } | 816 } |
835 | 817 |
836 // Add the capturer to the WebRtcAudioDeviceImpl if it is a new capturer. | 818 // Add the capturer to the WebRtcAudioDeviceImpl if it is a new capturer. |
837 if (is_new_capturer) | 819 if (is_new_capturer) |
838 GetWebRtcAudioDevice()->AddAudioCapturer(capturer); | 820 GetWebRtcAudioDevice()->AddAudioCapturer(capturer); |
839 | 821 |
840 return capturer; | 822 return capturer; |
841 } | 823 } |
842 | 824 |
843 } // namespace content | 825 } // namespace content |
OLD | NEW |