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" |
11 #include "base/synchronization/waitable_event.h" | 11 #include "base/synchronization/waitable_event.h" |
12 #include "content/public/common/content_switches.h" | 12 #include "content/public/common/content_switches.h" |
13 #include "content/renderer/media/media_stream_source_extra_data.h" | 13 #include "content/renderer/media/media_stream_source_extra_data.h" |
14 #include "content/renderer/media/peer_connection_identity_service.h" | 14 #include "content/renderer/media/peer_connection_identity_service.h" |
15 #include "content/renderer/media/rtc_media_constraints.h" | 15 #include "content/renderer/media/rtc_media_constraints.h" |
16 #include "content/renderer/media/rtc_peer_connection_handler.h" | 16 #include "content/renderer/media/rtc_peer_connection_handler.h" |
17 #include "content/renderer/media/rtc_video_capturer.h" | 17 #include "content/renderer/media/rtc_video_capturer.h" |
18 #include "content/renderer/media/rtc_video_decoder_factory.h" | 18 #include "content/renderer/media/rtc_video_decoder_factory.h" |
19 #include "content/renderer/media/rtc_video_encoder_factory.h" | 19 #include "content/renderer/media/rtc_video_encoder_factory.h" |
20 #include "content/renderer/media/video_capture_impl_manager.h" | 20 #include "content/renderer/media/video_capture_impl_manager.h" |
21 #include "content/renderer/media/webaudio_capturer_source.h" | 21 #include "content/renderer/media/webaudio_capturer_source.h" |
22 #include "content/renderer/media/webrtc_audio_device_impl.h" | 22 #include "content/renderer/media/webrtc_audio_device_impl.h" |
23 #include "content/renderer/media/webrtc_local_audio_track.h" | 23 #include "content/renderer/media/webrtc_local_audio_track.h" |
24 #include "content/renderer/media/webrtc_logging_initializer.h" | 24 #include "content/renderer/media/webrtc_logging_initializer.h" |
no longer working on chromium
2013/10/01 08:41:42
remove if you don't need this
Henrik Grunell
2013/10/02 12:47:18
Done.
| |
25 #include "content/renderer/media/webrtc_uma_histograms.h" | 25 #include "content/renderer/media/webrtc_uma_histograms.h" |
26 #include "content/renderer/p2p/ipc_network_manager.h" | 26 #include "content/renderer/p2p/ipc_network_manager.h" |
27 #include "content/renderer/p2p/ipc_socket_factory.h" | 27 #include "content/renderer/p2p/ipc_socket_factory.h" |
28 #include "content/renderer/p2p/port_allocator.h" | 28 #include "content/renderer/p2p/port_allocator.h" |
29 #include "content/renderer/render_thread_impl.h" | 29 #include "content/renderer/render_thread_impl.h" |
30 #include "jingle/glue/thread_wrapper.h" | 30 #include "jingle/glue/thread_wrapper.h" |
31 #include "media/filters/gpu_video_accelerator_factories.h" | 31 #include "media/filters/gpu_video_accelerator_factories.h" |
32 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | 32 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" |
33 #include "third_party/WebKit/public/platform/WebMediaStream.h" | 33 #include "third_party/WebKit/public/platform/WebMediaStream.h" |
34 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" | 34 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" |
35 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 35 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
36 #include "third_party/WebKit/public/platform/WebURL.h" | 36 #include "third_party/WebKit/public/platform/WebURL.h" |
37 #include "third_party/WebKit/public/web/WebDocument.h" | 37 #include "third_party/WebKit/public/web/WebDocument.h" |
38 #include "third_party/WebKit/public/web/WebFrame.h" | 38 #include "third_party/WebKit/public/web/WebFrame.h" |
39 #include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface .h" | 39 #include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface .h" |
40 | 40 |
41 #if defined(USE_OPENSSL) | 41 #if defined(USE_OPENSSL) |
42 #include "third_party/libjingle/source/talk/base/ssladapter.h" | 42 #include "third_party/libjingle/source/talk/base/ssladapter.h" |
43 #else | 43 #else |
44 #include "net/socket/nss_ssl_util.h" | 44 #include "net/socket/nss_ssl_util.h" |
45 #endif | 45 #endif |
46 | 46 |
47 #if defined(GOOGLE_TV) | 47 #if defined(GOOGLE_TV) |
48 #include "content/renderer/media/rtc_video_decoder_factory_tv.h" | 48 #include "content/renderer/media/rtc_video_decoder_factory_tv.h" |
49 #endif | 49 #endif |
50 | 50 |
51 namespace content { | 51 namespace content { |
52 | 52 |
53 // The constraint key for the PeerConnection constructor for enabling diagnostic | |
54 // WebRTC logging. It's a Google specific key, hence the "goog" prefix. | |
55 const char kWebRtcLoggingConstraint[] = "googLog"; | |
56 | |
57 // Constant constraint keys which enables default audio constraints on | 53 // Constant constraint keys which enables default audio constraints on |
58 // mediastreams with audio. | 54 // mediastreams with audio. |
59 struct { | 55 struct { |
60 const char* key; | 56 const char* key; |
61 const char* value; | 57 const char* value; |
62 } const kDefaultAudioConstraints[] = { | 58 } const kDefaultAudioConstraints[] = { |
63 { webrtc::MediaConstraintsInterface::kEchoCancellation, | 59 { webrtc::MediaConstraintsInterface::kEchoCancellation, |
64 webrtc::MediaConstraintsInterface::kValueTrue }, | 60 webrtc::MediaConstraintsInterface::kValueTrue }, |
65 #if defined(OS_CHROMEOS) || defined(OS_MACOSX) | 61 #if defined(OS_CHROMEOS) || defined(OS_MACOSX) |
66 // Enable the extended filter mode AEC on platforms with known echo issues. | 62 // Enable the extended filter mode AEC on platforms with known echo issues. |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
562 | 558 |
563 scoped_refptr<webrtc::PeerConnectionInterface> | 559 scoped_refptr<webrtc::PeerConnectionInterface> |
564 MediaStreamDependencyFactory::CreatePeerConnection( | 560 MediaStreamDependencyFactory::CreatePeerConnection( |
565 const webrtc::PeerConnectionInterface::IceServers& ice_servers, | 561 const webrtc::PeerConnectionInterface::IceServers& ice_servers, |
566 const webrtc::MediaConstraintsInterface* constraints, | 562 const webrtc::MediaConstraintsInterface* constraints, |
567 WebKit::WebFrame* web_frame, | 563 WebKit::WebFrame* web_frame, |
568 webrtc::PeerConnectionObserver* observer) { | 564 webrtc::PeerConnectionObserver* observer) { |
569 CHECK(web_frame); | 565 CHECK(web_frame); |
570 CHECK(observer); | 566 CHECK(observer); |
571 | 567 |
572 webrtc::MediaConstraintsInterface::Constraints optional_constraints = | |
573 constraints->GetOptional(); | |
574 std::string constraint_value; | |
575 if (optional_constraints.FindFirst(kWebRtcLoggingConstraint, | |
576 &constraint_value)) { | |
577 std::string url = web_frame->document().url().spec(); | |
578 RenderThreadImpl::current()->GetIOMessageLoopProxy()->PostTask( | |
579 FROM_HERE, base::Bind( | |
580 &InitWebRtcLogging, | |
581 constraint_value, | |
582 url)); | |
583 } | |
584 | |
585 scoped_refptr<P2PPortAllocatorFactory> pa_factory = | 568 scoped_refptr<P2PPortAllocatorFactory> pa_factory = |
586 new talk_base::RefCountedObject<P2PPortAllocatorFactory>( | 569 new talk_base::RefCountedObject<P2PPortAllocatorFactory>( |
587 p2p_socket_dispatcher_.get(), | 570 p2p_socket_dispatcher_.get(), |
588 network_manager_, | 571 network_manager_, |
589 socket_factory_.get(), | 572 socket_factory_.get(), |
590 web_frame); | 573 web_frame); |
591 | 574 |
592 PeerConnectionIdentityService* identity_service = | 575 PeerConnectionIdentityService* identity_service = |
593 PeerConnectionIdentityService::Create( | 576 PeerConnectionIdentityService::Create( |
594 GURL(web_frame->document().url().spec()).GetOrigin()); | 577 GURL(web_frame->document().url().spec()).GetOrigin()); |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
850 } | 833 } |
851 | 834 |
852 // Add the capturer to the WebRtcAudioDeviceImpl if it is a new capturer. | 835 // Add the capturer to the WebRtcAudioDeviceImpl if it is a new capturer. |
853 if (is_new_capturer) | 836 if (is_new_capturer) |
854 GetWebRtcAudioDevice()->AddAudioCapturer(capturer); | 837 GetWebRtcAudioDevice()->AddAudioCapturer(capturer); |
855 | 838 |
856 return capturer; | 839 return capturer; |
857 } | 840 } |
858 | 841 |
859 } // namespace content | 842 } // namespace content |
OLD | NEW |