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/metrics/field_trial.h" | |
10 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
11 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
12 #include "content/common/media/media_stream_messages.h" | 13 #include "content/common/media/media_stream_messages.h" |
13 #include "content/public/common/content_switches.h" | 14 #include "content/public/common/content_switches.h" |
14 #include "content/renderer/media/media_stream.h" | 15 #include "content/renderer/media/media_stream.h" |
15 #include "content/renderer/media/media_stream_audio_processor_options.h" | 16 #include "content/renderer/media/media_stream_audio_processor_options.h" |
16 #include "content/renderer/media/media_stream_audio_source.h" | 17 #include "content/renderer/media/media_stream_audio_source.h" |
17 #include "content/renderer/media/media_stream_video_source.h" | 18 #include "content/renderer/media/media_stream_video_source.h" |
18 #include "content/renderer/media/media_stream_video_track.h" | 19 #include "content/renderer/media/media_stream_video_track.h" |
19 #include "content/renderer/media/peer_connection_identity_service.h" | 20 #include "content/renderer/media/peer_connection_identity_service.h" |
(...skipping 14 matching lines...) Expand all Loading... | |
34 #include "jingle/glue/thread_wrapper.h" | 35 #include "jingle/glue/thread_wrapper.h" |
35 #include "media/filters/gpu_video_accelerator_factories.h" | 36 #include "media/filters/gpu_video_accelerator_factories.h" |
36 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | 37 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" |
37 #include "third_party/WebKit/public/platform/WebMediaStream.h" | 38 #include "third_party/WebKit/public/platform/WebMediaStream.h" |
38 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" | 39 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" |
39 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 40 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
40 #include "third_party/WebKit/public/platform/WebURL.h" | 41 #include "third_party/WebKit/public/platform/WebURL.h" |
41 #include "third_party/WebKit/public/web/WebDocument.h" | 42 #include "third_party/WebKit/public/web/WebDocument.h" |
42 #include "third_party/WebKit/public/web/WebFrame.h" | 43 #include "third_party/WebKit/public/web/WebFrame.h" |
43 #include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface .h" | 44 #include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface .h" |
45 #include "third_party/webrtc/system_wrappers/interface/field_trial.h" | |
44 | 46 |
45 #if defined(USE_OPENSSL) | 47 #if defined(USE_OPENSSL) |
46 #include "third_party/libjingle/source/talk/base/ssladapter.h" | 48 #include "third_party/libjingle/source/talk/base/ssladapter.h" |
47 #else | 49 #else |
48 #include "net/socket/nss_ssl_util.h" | 50 #include "net/socket/nss_ssl_util.h" |
49 #endif | 51 #endif |
50 | 52 |
51 #if defined(OS_ANDROID) | 53 #if defined(OS_ANDROID) |
52 #include "media/base/android/media_codec_bridge.h" | 54 #include "media/base/android/media_codec_bridge.h" |
53 #endif | 55 #endif |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
262 void MediaStreamDependencyFactory::CreatePeerConnectionFactory() { | 264 void MediaStreamDependencyFactory::CreatePeerConnectionFactory() { |
263 DCHECK(!pc_factory_.get()); | 265 DCHECK(!pc_factory_.get()); |
264 DCHECK(!signaling_thread_); | 266 DCHECK(!signaling_thread_); |
265 DCHECK(!worker_thread_); | 267 DCHECK(!worker_thread_); |
266 DCHECK(!network_manager_); | 268 DCHECK(!network_manager_); |
267 DCHECK(!socket_factory_); | 269 DCHECK(!socket_factory_); |
268 DCHECK(!chrome_worker_thread_.IsRunning()); | 270 DCHECK(!chrome_worker_thread_.IsRunning()); |
269 | 271 |
270 DVLOG(1) << "MediaStreamDependencyFactory::CreatePeerConnectionFactory()"; | 272 DVLOG(1) << "MediaStreamDependencyFactory::CreatePeerConnectionFactory()"; |
271 | 273 |
274 // Initialize webrtc field trial before start calling into webrtc code. | |
275 webrtc::FieldTrial::Init(&base::FieldTrialList::FindFullName); | |
tommi (sloooow) - chröme
2014/05/07 12:49:33
Would InitializeWebRtcModule be a better place to
| |
276 | |
272 jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); | 277 jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); |
273 jingle_glue::JingleThreadWrapper::current()->set_send_allowed(true); | 278 jingle_glue::JingleThreadWrapper::current()->set_send_allowed(true); |
274 signaling_thread_ = jingle_glue::JingleThreadWrapper::current(); | 279 signaling_thread_ = jingle_glue::JingleThreadWrapper::current(); |
275 CHECK(signaling_thread_); | 280 CHECK(signaling_thread_); |
276 | 281 |
277 CHECK(chrome_worker_thread_.Start()); | 282 CHECK(chrome_worker_thread_.Start()); |
278 | 283 |
279 base::WaitableEvent start_worker_event(true, false); | 284 base::WaitableEvent start_worker_event(true, false); |
280 chrome_worker_thread_.message_loop()->PostTask(FROM_HERE, base::Bind( | 285 chrome_worker_thread_.message_loop()->PostTask(FROM_HERE, base::Bind( |
281 &MediaStreamDependencyFactory::InitializeWorkerThread, | 286 &MediaStreamDependencyFactory::InitializeWorkerThread, |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
654 } | 659 } |
655 | 660 |
656 void MediaStreamDependencyFactory::EnsureWebRtcAudioDeviceImpl() { | 661 void MediaStreamDependencyFactory::EnsureWebRtcAudioDeviceImpl() { |
657 if (audio_device_) | 662 if (audio_device_) |
658 return; | 663 return; |
659 | 664 |
660 audio_device_ = new WebRtcAudioDeviceImpl(); | 665 audio_device_ = new WebRtcAudioDeviceImpl(); |
661 } | 666 } |
662 | 667 |
663 } // namespace content | 668 } // namespace content |
OLD | NEW |