| 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 <memory> |
| 9 #include <utility> | 10 #include <utility> |
| 10 #include <vector> | 11 #include <vector> |
| 11 | 12 |
| 12 #include "base/bind.h" | 13 #include "base/bind.h" |
| 13 #include "base/bind_helpers.h" | 14 #include "base/bind_helpers.h" |
| 14 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 15 #include "base/location.h" | 16 #include "base/location.h" |
| 16 #include "base/logging.h" | 17 #include "base/logging.h" |
| 17 #include "base/macros.h" | 18 #include "base/macros.h" |
| 18 #include "base/memory/ptr_util.h" | 19 #include "base/memory/ptr_util.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 #include "jingle/glue/thread_wrapper.h" | 55 #include "jingle/glue/thread_wrapper.h" |
| 55 #include "media/base/media_permission.h" | 56 #include "media/base/media_permission.h" |
| 56 #include "media/filters/ffmpeg_glue.h" | 57 #include "media/filters/ffmpeg_glue.h" |
| 57 #include "media/renderers/gpu_video_accelerator_factories.h" | 58 #include "media/renderers/gpu_video_accelerator_factories.h" |
| 58 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | 59 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" |
| 59 #include "third_party/WebKit/public/platform/WebMediaStream.h" | 60 #include "third_party/WebKit/public/platform/WebMediaStream.h" |
| 60 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" | 61 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" |
| 61 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 62 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
| 62 #include "third_party/WebKit/public/platform/WebURL.h" | 63 #include "third_party/WebKit/public/platform/WebURL.h" |
| 63 #include "third_party/WebKit/public/web/WebDocument.h" | 64 #include "third_party/WebKit/public/web/WebDocument.h" |
| 64 #include "third_party/WebKit/public/web/WebFrame.h" | 65 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 65 #include "third_party/webrtc/api/audio_codecs/builtin_audio_decoder_factory.h" | 66 #include "third_party/webrtc/api/audio_codecs/builtin_audio_decoder_factory.h" |
| 66 #include "third_party/webrtc/api/audio_codecs/builtin_audio_encoder_factory.h" | 67 #include "third_party/webrtc/api/audio_codecs/builtin_audio_encoder_factory.h" |
| 67 #include "third_party/webrtc/api/mediaconstraintsinterface.h" | 68 #include "third_party/webrtc/api/mediaconstraintsinterface.h" |
| 68 #include "third_party/webrtc/api/videosourceproxy.h" | 69 #include "third_party/webrtc/api/videosourceproxy.h" |
| 69 #include "third_party/webrtc/base/ssladapter.h" | 70 #include "third_party/webrtc/base/ssladapter.h" |
| 70 #include "third_party/webrtc/modules/video_coding/codecs/h264/include/h264.h" | 71 #include "third_party/webrtc/modules/video_coding/codecs/h264/include/h264.h" |
| 71 | 72 |
| 72 #if defined(OS_ANDROID) | 73 #if defined(OS_ANDROID) |
| 73 #include "media/base/android/media_codec_util.h" | 74 #include "media/base/android/media_codec_util.h" |
| 74 #endif | 75 #endif |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 event->Signal(); | 271 event->Signal(); |
| 271 } | 272 } |
| 272 | 273 |
| 273 bool PeerConnectionDependencyFactory::PeerConnectionFactoryCreated() { | 274 bool PeerConnectionDependencyFactory::PeerConnectionFactoryCreated() { |
| 274 return pc_factory_.get() != NULL; | 275 return pc_factory_.get() != NULL; |
| 275 } | 276 } |
| 276 | 277 |
| 277 scoped_refptr<webrtc::PeerConnectionInterface> | 278 scoped_refptr<webrtc::PeerConnectionInterface> |
| 278 PeerConnectionDependencyFactory::CreatePeerConnection( | 279 PeerConnectionDependencyFactory::CreatePeerConnection( |
| 279 const webrtc::PeerConnectionInterface::RTCConfiguration& config, | 280 const webrtc::PeerConnectionInterface::RTCConfiguration& config, |
| 280 blink::WebFrame* web_frame, | 281 blink::WebLocalFrame* web_frame, |
| 281 webrtc::PeerConnectionObserver* observer) { | 282 webrtc::PeerConnectionObserver* observer) { |
| 282 CHECK(web_frame); | 283 CHECK(web_frame); |
| 283 CHECK(observer); | 284 CHECK(observer); |
| 284 if (!GetPcFactory().get()) | 285 if (!GetPcFactory().get()) |
| 285 return NULL; | 286 return NULL; |
| 286 | 287 |
| 287 // Copy the flag from Preference associated with this WebFrame. | 288 // Copy the flag from Preference associated with this WebLocalFrame. |
| 288 P2PPortAllocator::Config port_config; | 289 P2PPortAllocator::Config port_config; |
| 289 uint16_t min_port = 0; | 290 uint16_t min_port = 0; |
| 290 uint16_t max_port = 0; | 291 uint16_t max_port = 0; |
| 291 | 292 |
| 292 // |media_permission| will be called to check mic/camera permission. If at | 293 // |media_permission| will be called to check mic/camera permission. If at |
| 293 // least one of them is granted, P2PPortAllocator is allowed to gather local | 294 // least one of them is granted, P2PPortAllocator is allowed to gather local |
| 294 // host IP addresses as ICE candidates. |media_permission| could be nullptr, | 295 // host IP addresses as ICE candidates. |media_permission| could be nullptr, |
| 295 // which means the permission will be granted automatically. This could be the | 296 // which means the permission will be granted automatically. This could be the |
| 296 // case when either the experiment is not enabled or the preference is not | 297 // case when either the experiment is not enabled or the preference is not |
| 297 // enforced. | 298 // enforced. |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 | 557 |
| 557 void PeerConnectionDependencyFactory::EnsureWebRtcAudioDeviceImpl() { | 558 void PeerConnectionDependencyFactory::EnsureWebRtcAudioDeviceImpl() { |
| 558 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); | 559 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 559 if (audio_device_.get()) | 560 if (audio_device_.get()) |
| 560 return; | 561 return; |
| 561 | 562 |
| 562 audio_device_ = new WebRtcAudioDeviceImpl(); | 563 audio_device_ = new WebRtcAudioDeviceImpl(); |
| 563 } | 564 } |
| 564 | 565 |
| 565 } // namespace content | 566 } // namespace content |
| OLD | NEW |