OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/webrtc/peer_connection_dependency_factory.h" | 5 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/location.h" | 13 #include "base/location.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/metrics/field_trial.h" | 16 #include "base/metrics/field_trial.h" |
17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
19 #include "base/synchronization/waitable_event.h" | 19 #include "base/synchronization/waitable_event.h" |
20 #include "build/build_config.h" | 20 #include "build/build_config.h" |
21 #include "content/common/media/media_stream_messages.h" | 21 #include "content/common/media/media_stream_messages.h" |
22 #include "content/public/common/common_features.h" | |
23 #include "content/public/common/content_client.h" | 22 #include "content/public/common/content_client.h" |
24 #include "content/public/common/content_switches.h" | 23 #include "content/public/common/content_switches.h" |
25 #include "content/public/common/feature_h264_with_openh264_ffmpeg.h" | |
26 #include "content/public/common/renderer_preferences.h" | 24 #include "content/public/common/renderer_preferences.h" |
27 #include "content/public/common/webrtc_ip_handling_policy.h" | 25 #include "content/public/common/webrtc_ip_handling_policy.h" |
28 #include "content/public/renderer/content_renderer_client.h" | 26 #include "content/public/renderer/content_renderer_client.h" |
29 #include "content/renderer/media/media_stream.h" | 27 #include "content/renderer/media/media_stream.h" |
30 #include "content/renderer/media/media_stream_audio_processor.h" | 28 #include "content/renderer/media/media_stream_audio_processor.h" |
31 #include "content/renderer/media/media_stream_audio_processor_options.h" | 29 #include "content/renderer/media/media_stream_audio_processor_options.h" |
32 #include "content/renderer/media/media_stream_audio_source.h" | 30 #include "content/renderer/media/media_stream_audio_source.h" |
33 #include "content/renderer/media/media_stream_video_source.h" | 31 #include "content/renderer/media/media_stream_video_source.h" |
34 #include "content/renderer/media/media_stream_video_track.h" | 32 #include "content/renderer/media/media_stream_video_track.h" |
35 #include "content/renderer/media/peer_connection_identity_store.h" | 33 #include "content/renderer/media/peer_connection_identity_store.h" |
(...skipping 11 matching lines...) Expand all Loading... |
47 #include "content/renderer/media/webrtc_logging.h" | 45 #include "content/renderer/media/webrtc_logging.h" |
48 #include "content/renderer/media/webrtc_uma_histograms.h" | 46 #include "content/renderer/media/webrtc_uma_histograms.h" |
49 #include "content/renderer/p2p/empty_network_manager.h" | 47 #include "content/renderer/p2p/empty_network_manager.h" |
50 #include "content/renderer/p2p/filtering_network_manager.h" | 48 #include "content/renderer/p2p/filtering_network_manager.h" |
51 #include "content/renderer/p2p/ipc_network_manager.h" | 49 #include "content/renderer/p2p/ipc_network_manager.h" |
52 #include "content/renderer/p2p/ipc_socket_factory.h" | 50 #include "content/renderer/p2p/ipc_socket_factory.h" |
53 #include "content/renderer/p2p/port_allocator.h" | 51 #include "content/renderer/p2p/port_allocator.h" |
54 #include "content/renderer/render_frame_impl.h" | 52 #include "content/renderer/render_frame_impl.h" |
55 #include "content/renderer/render_thread_impl.h" | 53 #include "content/renderer/render_thread_impl.h" |
56 #include "content/renderer/render_view_impl.h" | 54 #include "content/renderer/render_view_impl.h" |
| 55 #include "content/renderer/renderer_features.h" |
57 #include "crypto/openssl_util.h" | 56 #include "crypto/openssl_util.h" |
58 #include "jingle/glue/thread_wrapper.h" | 57 #include "jingle/glue/thread_wrapper.h" |
59 #include "media/base/media_permission.h" | 58 #include "media/base/media_permission.h" |
60 #include "media/filters/ffmpeg_glue.h" | 59 #include "media/filters/ffmpeg_glue.h" |
61 #include "media/renderers/gpu_video_accelerator_factories.h" | 60 #include "media/renderers/gpu_video_accelerator_factories.h" |
62 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | 61 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" |
63 #include "third_party/WebKit/public/platform/WebMediaStream.h" | 62 #include "third_party/WebKit/public/platform/WebMediaStream.h" |
64 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" | 63 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" |
65 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 64 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
66 #include "third_party/WebKit/public/platform/WebURL.h" | 65 #include "third_party/WebKit/public/platform/WebURL.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 DCHECK(!signaling_thread_); | 256 DCHECK(!signaling_thread_); |
258 DCHECK(!worker_thread_); | 257 DCHECK(!worker_thread_); |
259 DCHECK(!network_manager_); | 258 DCHECK(!network_manager_); |
260 DCHECK(!socket_factory_); | 259 DCHECK(!socket_factory_); |
261 DCHECK(!chrome_signaling_thread_.IsRunning()); | 260 DCHECK(!chrome_signaling_thread_.IsRunning()); |
262 DCHECK(!chrome_worker_thread_.IsRunning()); | 261 DCHECK(!chrome_worker_thread_.IsRunning()); |
263 | 262 |
264 DVLOG(1) << "PeerConnectionDependencyFactory::CreatePeerConnectionFactory()"; | 263 DVLOG(1) << "PeerConnectionDependencyFactory::CreatePeerConnectionFactory()"; |
265 | 264 |
266 #if BUILDFLAG(RTC_USE_H264) | 265 #if BUILDFLAG(RTC_USE_H264) |
267 // Building /w |rtc_use_h264|, is the corresponding run-time feature enabled? | 266 // TODO(hbos): This is temporary. Disable the runtime effects of building with |
268 if (base::FeatureList::IsEnabled(kWebRtcH264WithOpenH264FFmpeg)) { | 267 // |rtc_use_h264|. We are planning to default the |rtc_use_h264| flag to |
269 LOG(WARNING) << "WebRTC H.264 with OpenH264/FFmpeg ENABLED."; | 268 // |proprietary_codecs| so that it will be used by Chromium trybots. This |
270 // |H264DecoderImpl| may be used which depends on FFmpeg, therefore we need | 269 // would also make it used by Chrome, but this feature is not ready to be |
271 // to initialize FFmpeg before going further. | 270 // launched yet. An upcoming CL will add browser tests for H264. That CL will |
272 media::FFmpegGlue::InitializeFFmpeg(); | 271 // remove this line. It should remain disabled until tested. |
273 } else { | 272 webrtc::DisableRtcUseH264(); |
274 LOG(WARNING) << "WebRTC H.264 with OpenH264/FFmpeg DISABLED."; | 273 // When building with |rtc_use_h264|, |H264DecoderImpl| may be used which |
275 // Feature is to be disabled, no need to make sure FFmpeg is initialized. | 274 // depends on FFmpeg, therefore we need to initialize FFmpeg before going |
276 webrtc::DisableRtcUseH264(); | 275 // further. |
277 } | 276 // TODO(hbos): Temporarily commented out due to webrtc::DisableRtcUseH264(), |
| 277 // no need to initialize FFmpeg when |H264DecoderImpl| is disabled. |
| 278 // media::FFmpegGlue::InitializeFFmpeg(); |
278 #endif | 279 #endif |
279 | 280 |
280 base::MessageLoop::current()->AddDestructionObserver(this); | 281 base::MessageLoop::current()->AddDestructionObserver(this); |
281 // To allow sending to the signaling/worker threads. | 282 // To allow sending to the signaling/worker threads. |
282 jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); | 283 jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); |
283 jingle_glue::JingleThreadWrapper::current()->set_send_allowed(true); | 284 jingle_glue::JingleThreadWrapper::current()->set_send_allowed(true); |
284 | 285 |
285 CHECK(chrome_signaling_thread_.Start()); | 286 CHECK(chrome_signaling_thread_.Start()); |
286 CHECK(chrome_worker_thread_.Start()); | 287 CHECK(chrome_worker_thread_.Start()); |
287 | 288 |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 } | 800 } |
800 | 801 |
801 void PeerConnectionDependencyFactory::EnsureWebRtcAudioDeviceImpl() { | 802 void PeerConnectionDependencyFactory::EnsureWebRtcAudioDeviceImpl() { |
802 if (audio_device_.get()) | 803 if (audio_device_.get()) |
803 return; | 804 return; |
804 | 805 |
805 audio_device_ = new WebRtcAudioDeviceImpl(); | 806 audio_device_ = new WebRtcAudioDeviceImpl(); |
806 } | 807 } |
807 | 808 |
808 } // namespace content | 809 } // namespace content |
OLD | NEW |