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 // Map of corresponding media constraints and platform effects. | 55 // Map of corresponding media constraints and platform effects. |
60 struct { | 56 struct { |
61 const char* constraint; | 57 const char* constraint; |
62 const media::AudioParameters::PlatformEffectsMask effect; | 58 const media::AudioParameters::PlatformEffectsMask effect; |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 MediaStreamDependencyFactory::MediaSourcesCreatedCallback ready_callback_; | 191 MediaStreamDependencyFactory::MediaSourcesCreatedCallback ready_callback_; |
196 bool live_; | 192 bool live_; |
197 typedef std::vector<scoped_refptr<webrtc::MediaSourceInterface> > | 193 typedef std::vector<scoped_refptr<webrtc::MediaSourceInterface> > |
198 ObservedSources; | 194 ObservedSources; |
199 ObservedSources sources_; | 195 ObservedSources sources_; |
200 }; | 196 }; |
201 | 197 |
202 MediaStreamDependencyFactory::MediaStreamDependencyFactory( | 198 MediaStreamDependencyFactory::MediaStreamDependencyFactory( |
203 P2PSocketDispatcher* p2p_socket_dispatcher) | 199 P2PSocketDispatcher* p2p_socket_dispatcher) |
204 : network_manager_(NULL), | 200 : network_manager_(NULL), |
205 #if defined(GOOGLE_TV) | |
206 decoder_factory_tv_(NULL), | |
207 #endif | |
208 p2p_socket_dispatcher_(p2p_socket_dispatcher), | 201 p2p_socket_dispatcher_(p2p_socket_dispatcher), |
209 signaling_thread_(NULL), | 202 signaling_thread_(NULL), |
210 worker_thread_(NULL), | 203 worker_thread_(NULL), |
211 chrome_worker_thread_("Chrome_libJingle_WorkerThread"), | 204 chrome_worker_thread_("Chrome_libJingle_WorkerThread"), |
212 aec_dump_file_(base::kInvalidPlatformFileValue) { | 205 aec_dump_file_(base::kInvalidPlatformFileValue) { |
213 } | 206 } |
214 | 207 |
215 MediaStreamDependencyFactory::~MediaStreamDependencyFactory() { | 208 MediaStreamDependencyFactory::~MediaStreamDependencyFactory() { |
216 CleanupPeerConnectionFactory(); | 209 CleanupPeerConnectionFactory(); |
217 if (aec_dump_file_ != base::kInvalidPlatformFileValue) | 210 if (aec_dump_file_ != base::kInvalidPlatformFileValue) |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 DCHECK(!pc_factory_.get()); | 577 DCHECK(!pc_factory_.get()); |
585 DCHECK(!audio_device_.get()); | 578 DCHECK(!audio_device_.get()); |
586 DVLOG(1) << "MediaStreamDependencyFactory::CreatePeerConnectionFactory()"; | 579 DVLOG(1) << "MediaStreamDependencyFactory::CreatePeerConnectionFactory()"; |
587 | 580 |
588 scoped_ptr<cricket::WebRtcVideoDecoderFactory> decoder_factory; | 581 scoped_ptr<cricket::WebRtcVideoDecoderFactory> decoder_factory; |
589 scoped_ptr<cricket::WebRtcVideoEncoderFactory> encoder_factory; | 582 scoped_ptr<cricket::WebRtcVideoEncoderFactory> encoder_factory; |
590 | 583 |
591 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 584 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
592 scoped_refptr<RendererGpuVideoAcceleratorFactories> gpu_factories = | 585 scoped_refptr<RendererGpuVideoAcceleratorFactories> gpu_factories = |
593 RenderThreadImpl::current()->GetGpuFactories(); | 586 RenderThreadImpl::current()->GetGpuFactories(); |
594 #if !defined(GOOGLE_TV) | |
595 if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWDecoding)) { | 587 if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWDecoding)) { |
596 if (gpu_factories) | 588 if (gpu_factories) |
597 decoder_factory.reset(new RTCVideoDecoderFactory(gpu_factories)); | 589 decoder_factory.reset(new RTCVideoDecoderFactory(gpu_factories)); |
598 } | 590 } |
599 #else | |
600 // PeerConnectionFactory will hold the ownership of this | |
601 // VideoDecoderFactory. | |
602 decoder_factory.reset(decoder_factory_tv_ = new RTCVideoDecoderFactoryTv()); | |
603 #endif | |
604 | 591 |
605 if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) { | 592 if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) { |
606 if (gpu_factories) | 593 if (gpu_factories) |
607 encoder_factory.reset(new RTCVideoEncoderFactory(gpu_factories)); | 594 encoder_factory.reset(new RTCVideoEncoderFactory(gpu_factories)); |
608 } | 595 } |
609 | 596 |
610 #if defined(OS_ANDROID) | 597 #if defined(OS_ANDROID) |
611 if (!media::MediaCodecBridge::IsAvailable() || | 598 if (!media::MediaCodecBridge::IsAvailable() || |
612 !media::MediaCodecBridge::SupportsSetParameters()) { | 599 !media::MediaCodecBridge::SupportsSetParameters()) { |
613 encoder_factory.reset(); | 600 encoder_factory.reset(); |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 if (!aec_dump_file_stream) { | 996 if (!aec_dump_file_stream) { |
1010 VLOG(1) << "Could not open AEC dump file."; | 997 VLOG(1) << "Could not open AEC dump file."; |
1011 base::ClosePlatformFile(aec_dump_file); | 998 base::ClosePlatformFile(aec_dump_file); |
1012 } else { | 999 } else { |
1013 // |pc_factory_| takes ownership of |aec_dump_file_stream|. | 1000 // |pc_factory_| takes ownership of |aec_dump_file_stream|. |
1014 pc_factory_->StartAecDump(aec_dump_file_stream); | 1001 pc_factory_->StartAecDump(aec_dump_file_stream); |
1015 } | 1002 } |
1016 } | 1003 } |
1017 | 1004 |
1018 } // namespace content | 1005 } // namespace content |
OLD | NEW |