Chromium Code Reviews| Index: webrtc/api/peerconnectionfactory.cc |
| diff --git a/webrtc/api/peerconnectionfactory.cc b/webrtc/api/peerconnectionfactory.cc |
| index c05cd852f605faada5dbd47e68e7b2ec8afd94e8..85714087e91f58d882c47f503084fb025a68ce55 100644 |
| --- a/webrtc/api/peerconnectionfactory.cc |
| +++ b/webrtc/api/peerconnectionfactory.cc |
| @@ -14,6 +14,7 @@ |
| #include "webrtc/api/audiotrack.h" |
| #include "webrtc/api/localaudiosource.h" |
| +#include "webrtc/api/mediaconstraintsinterface.h" |
| #include "webrtc/api/mediastream.h" |
| #include "webrtc/api/mediastreamproxy.h" |
| #include "webrtc/api/mediastreamtrackproxy.h" |
| @@ -198,6 +199,14 @@ PeerConnectionFactory::CreateAudioSource( |
| return source; |
| } |
| +rtc::scoped_refptr<AudioSourceInterface> |
| +PeerConnectionFactory::CreateAudioSource(const cricket::AudioOptions& options) { |
| + RTC_DCHECK(signaling_thread_->IsCurrent()); |
| + rtc::scoped_refptr<LocalAudioSource> source( |
| + LocalAudioSource::Create(options_, &options)); |
| + return source; |
| +} |
| + |
| rtc::scoped_refptr<VideoSourceInterface> |
| PeerConnectionFactory::CreateVideoSource( |
| cricket::VideoCapturer* capturer, |
| @@ -208,6 +217,14 @@ PeerConnectionFactory::CreateVideoSource( |
| return VideoSourceProxy::Create(signaling_thread_, source); |
| } |
| +rtc::scoped_refptr<VideoSourceInterface> |
| +PeerConnectionFactory::CreateVideoSource(cricket::VideoCapturer* capturer) { |
| + RTC_DCHECK(signaling_thread_->IsCurrent()); |
| + rtc::scoped_refptr<VideoSource> source( |
|
perkj_webrtc
2016/02/23 11:40:18
Just call the other implementation with constraint
nisse-webrtc
2016/02/23 13:05:32
I would have expected this function to get some ty
hta-webrtc
2016/02/23 14:30:34
This pair is one where the functionality we reach
|
| + VideoSource::Create(channel_manager_.get(), capturer, false)); |
| + return VideoSourceProxy::Create(signaling_thread_, source); |
| +} |
| + |
| bool PeerConnectionFactory::StartAecDump(rtc::PlatformFile file, |
| int64_t max_size_bytes) { |
| RTC_DCHECK(signaling_thread_->IsCurrent()); |
| @@ -231,13 +248,50 @@ void PeerConnectionFactory::StopRtcEventLog() { |
| rtc::scoped_refptr<PeerConnectionInterface> |
| PeerConnectionFactory::CreatePeerConnection( |
| - const PeerConnectionInterface::RTCConfiguration& configuration, |
| + const PeerConnectionInterface::RTCConfiguration& configuration_in, |
| const MediaConstraintsInterface* constraints, |
| rtc::scoped_ptr<cricket::PortAllocator> allocator, |
| rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, |
| PeerConnectionObserver* observer) { |
| RTC_DCHECK(signaling_thread_->IsCurrent()); |
| + // We merge constraints and configuration into a single configuration. |
| + PeerConnectionInterface::RTCConfiguration configuration = configuration_in; |
| + |
| + if (!dtls_identity_store.get()) { |
| + // Because |pc|->Initialize takes ownership of the store we need a new |
| + // wrapper object that can be deleted without deleting the underlying |
| + // |dtls_identity_store_|, protecting it from being deleted multiple times. |
| + dtls_identity_store.reset( |
| + new DtlsIdentityStoreWrapper(dtls_identity_store_)); |
| + } |
| + |
| + if (!allocator) { |
| + allocator.reset(new cricket::BasicPortAllocator( |
| + default_network_manager_.get(), default_socket_factory_.get())); |
| + } |
| + allocator->SetNetworkIgnoreMask(options_.network_ignore_mask); |
| + |
| + rtc::scoped_refptr<PeerConnection> pc( |
| + new rtc::RefCountedObject<PeerConnection>(this)); |
| + |
| + CopyConstraintsIntoRtcConfiguration(constraints, &configuration); |
|
perkj_webrtc
2016/02/23 11:40:18
Move the implementation of CopyConstraintsIntoRtcC
hta-webrtc
2016/02/23 14:30:34
See comments about unittests.
|
| + |
| + if (!pc->Initialize(configuration, std::move(allocator), |
| + std::move(dtls_identity_store), observer)) { |
| + return nullptr; |
| + } |
| + return PeerConnectionProxy::Create(signaling_thread(), pc); |
| +} |
| + |
| +rtc::scoped_refptr<PeerConnectionInterface> |
| +PeerConnectionFactory::CreatePeerConnection( |
| + const PeerConnectionInterface::RTCConfiguration& configuration, |
| + rtc::scoped_ptr<cricket::PortAllocator> allocator, |
| + rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, |
| + PeerConnectionObserver* observer) { |
| + RTC_DCHECK(signaling_thread_->IsCurrent()); |
| + |
| if (!dtls_identity_store.get()) { |
| // Because |pc|->Initialize takes ownership of the store we need a new |
| // wrapper object that can be deleted without deleting the underlying |
| @@ -254,7 +308,7 @@ PeerConnectionFactory::CreatePeerConnection( |
| rtc::scoped_refptr<PeerConnection> pc( |
| new rtc::RefCountedObject<PeerConnection>(this)); |
| - if (!pc->Initialize(configuration, constraints, std::move(allocator), |
| + if (!pc->Initialize(configuration, std::move(allocator), |
| std::move(dtls_identity_store), observer)) { |
| return nullptr; |
| } |