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