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 28 matching lines...) Expand all Loading... |
39 #include "third_party/WebKit/public/web/WebDocument.h" | 39 #include "third_party/WebKit/public/web/WebDocument.h" |
40 #include "third_party/WebKit/public/web/WebFrame.h" | 40 #include "third_party/WebKit/public/web/WebFrame.h" |
41 #include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface
.h" | 41 #include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface
.h" |
42 | 42 |
43 #if defined(USE_OPENSSL) | 43 #if defined(USE_OPENSSL) |
44 #include "third_party/libjingle/source/talk/base/ssladapter.h" | 44 #include "third_party/libjingle/source/talk/base/ssladapter.h" |
45 #else | 45 #else |
46 #include "net/socket/nss_ssl_util.h" | 46 #include "net/socket/nss_ssl_util.h" |
47 #endif | 47 #endif |
48 | 48 |
49 #if defined(GOOGLE_TV) | |
50 #include "content/renderer/media/rtc_video_decoder_factory_tv.h" | |
51 #endif | |
52 | |
53 #if defined(OS_ANDROID) | 49 #if defined(OS_ANDROID) |
54 #include "media/base/android/media_codec_bridge.h" | 50 #include "media/base/android/media_codec_bridge.h" |
55 #endif | 51 #endif |
56 | 52 |
57 namespace content { | 53 namespace content { |
58 | 54 |
59 // Constant constraint keys which enables default audio constraints on | 55 // Constant constraint keys which enables default audio constraints on |
60 // mediastreams with audio. | 56 // mediastreams with audio. |
61 struct { | 57 struct { |
62 const char* key; | 58 const char* key; |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 bool live_; | 233 bool live_; |
238 typedef std::vector<scoped_refptr<webrtc::MediaSourceInterface> > | 234 typedef std::vector<scoped_refptr<webrtc::MediaSourceInterface> > |
239 ObservedSources; | 235 ObservedSources; |
240 ObservedSources sources_; | 236 ObservedSources sources_; |
241 }; | 237 }; |
242 | 238 |
243 MediaStreamDependencyFactory::MediaStreamDependencyFactory( | 239 MediaStreamDependencyFactory::MediaStreamDependencyFactory( |
244 VideoCaptureImplManager* vc_manager, | 240 VideoCaptureImplManager* vc_manager, |
245 P2PSocketDispatcher* p2p_socket_dispatcher) | 241 P2PSocketDispatcher* p2p_socket_dispatcher) |
246 : network_manager_(NULL), | 242 : network_manager_(NULL), |
247 #if defined(GOOGLE_TV) | |
248 decoder_factory_tv_(NULL), | |
249 #endif | |
250 vc_manager_(vc_manager), | 243 vc_manager_(vc_manager), |
251 p2p_socket_dispatcher_(p2p_socket_dispatcher), | 244 p2p_socket_dispatcher_(p2p_socket_dispatcher), |
252 signaling_thread_(NULL), | 245 signaling_thread_(NULL), |
253 worker_thread_(NULL), | 246 worker_thread_(NULL), |
254 chrome_worker_thread_("Chrome_libJingle_WorkerThread"), | 247 chrome_worker_thread_("Chrome_libJingle_WorkerThread"), |
255 aec_dump_file_(base::kInvalidPlatformFileValue) { | 248 aec_dump_file_(base::kInvalidPlatformFileValue) { |
256 } | 249 } |
257 | 250 |
258 MediaStreamDependencyFactory::~MediaStreamDependencyFactory() { | 251 MediaStreamDependencyFactory::~MediaStreamDependencyFactory() { |
259 CleanupPeerConnectionFactory(); | 252 CleanupPeerConnectionFactory(); |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 DCHECK(!pc_factory_.get()); | 611 DCHECK(!pc_factory_.get()); |
619 DCHECK(!audio_device_.get()); | 612 DCHECK(!audio_device_.get()); |
620 DVLOG(1) << "MediaStreamDependencyFactory::CreatePeerConnectionFactory()"; | 613 DVLOG(1) << "MediaStreamDependencyFactory::CreatePeerConnectionFactory()"; |
621 | 614 |
622 scoped_ptr<cricket::WebRtcVideoDecoderFactory> decoder_factory; | 615 scoped_ptr<cricket::WebRtcVideoDecoderFactory> decoder_factory; |
623 scoped_ptr<cricket::WebRtcVideoEncoderFactory> encoder_factory; | 616 scoped_ptr<cricket::WebRtcVideoEncoderFactory> encoder_factory; |
624 | 617 |
625 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 618 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
626 scoped_refptr<RendererGpuVideoAcceleratorFactories> gpu_factories = | 619 scoped_refptr<RendererGpuVideoAcceleratorFactories> gpu_factories = |
627 RenderThreadImpl::current()->GetGpuFactories(); | 620 RenderThreadImpl::current()->GetGpuFactories(); |
628 #if !defined(GOOGLE_TV) | |
629 if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWDecoding)) { | 621 if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWDecoding)) { |
630 if (gpu_factories) | 622 if (gpu_factories) |
631 decoder_factory.reset(new RTCVideoDecoderFactory(gpu_factories)); | 623 decoder_factory.reset(new RTCVideoDecoderFactory(gpu_factories)); |
632 } | 624 } |
633 #else | |
634 // PeerConnectionFactory will hold the ownership of this | |
635 // VideoDecoderFactory. | |
636 decoder_factory.reset(decoder_factory_tv_ = new RTCVideoDecoderFactoryTv()); | |
637 #endif | |
638 | 625 |
639 if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) { | 626 if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) { |
640 if (gpu_factories) | 627 if (gpu_factories) |
641 encoder_factory.reset(new RTCVideoEncoderFactory(gpu_factories)); | 628 encoder_factory.reset(new RTCVideoEncoderFactory(gpu_factories)); |
642 } | 629 } |
643 | 630 |
644 #if defined(OS_ANDROID) | 631 #if defined(OS_ANDROID) |
645 if (!media::MediaCodecBridge::IsAvailable() || | 632 if (!media::MediaCodecBridge::IsAvailable() || |
646 !media::MediaCodecBridge::SupportsSetParameters()) { | 633 !media::MediaCodecBridge::SupportsSetParameters()) { |
647 encoder_factory.reset(); | 634 encoder_factory.reset(); |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 if (!aec_dump_file_stream) { | 1030 if (!aec_dump_file_stream) { |
1044 VLOG(1) << "Could not open AEC dump file."; | 1031 VLOG(1) << "Could not open AEC dump file."; |
1045 base::ClosePlatformFile(aec_dump_file); | 1032 base::ClosePlatformFile(aec_dump_file); |
1046 } else { | 1033 } else { |
1047 // |pc_factory_| takes ownership of |aec_dump_file_stream|. | 1034 // |pc_factory_| takes ownership of |aec_dump_file_stream|. |
1048 pc_factory_->StartAecDump(aec_dump_file_stream); | 1035 pc_factory_->StartAecDump(aec_dump_file_stream); |
1049 } | 1036 } |
1050 } | 1037 } |
1051 | 1038 |
1052 } // namespace content | 1039 } // namespace content |
OLD | NEW |