Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Unified Diff: webrtc/api/peerconnectionfactory.cc

Issue 1717583002: Non-constraint interfaces for all constrainable interfaces (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Review comments Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/api/peerconnectionfactory.h ('k') | webrtc/api/peerconnectionfactoryproxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/peerconnectionfactory.cc
diff --git a/webrtc/api/peerconnectionfactory.cc b/webrtc/api/peerconnectionfactory.cc
index d63045f9ca9a2470cd1d8e1282b5c29f007d0029..4d8125fe8ba3cd8174d9a6e808f076ec411b2499 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"
@@ -199,6 +200,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,
@@ -209,6 +218,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(
+ VideoSource::Create(worker_thread_, capturer, false));
+ return VideoSourceProxy::Create(signaling_thread_, source);
+}
+
bool PeerConnectionFactory::StartAecDump(rtc::PlatformFile file,
int64_t max_size_bytes) {
RTC_DCHECK(signaling_thread_->IsCurrent());
@@ -232,13 +249,29 @@ 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;
+ CopyConstraintsIntoRtcConfiguration(constraints, &configuration);
+
+ return CreatePeerConnection(configuration, std::move(allocator),
+ std::move(dtls_identity_store), observer);
+}
+
+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
@@ -255,7 +288,24 @@ PeerConnectionFactory::CreatePeerConnection(
rtc::scoped_refptr<PeerConnection> pc(
new rtc::RefCountedObject<PeerConnection>(this));
- if (!pc->Initialize(configuration, constraints, std::move(allocator),
+ // We rely on default values when constraints aren't found.
+ cricket::MediaConfig media_config;
+
+ media_config.video.disable_prerenderer_smoothing =
+ configuration.disable_prerenderer_smoothing;
+ if (configuration.enable_dscp) {
+ media_config.enable_dscp = *(configuration.enable_dscp);
+ }
+ if (configuration.cpu_overuse_detection) {
+ media_config.video.enable_cpu_overuse_detection =
+ *(configuration.cpu_overuse_detection);
+ }
+ if (configuration.suspend_below_min_bitrate) {
+ media_config.video.suspend_below_min_bitrate =
+ *(configuration.suspend_below_min_bitrate);
+ }
+
+ if (!pc->Initialize(media_config, configuration, std::move(allocator),
std::move(dtls_identity_store), observer)) {
return nullptr;
}
« no previous file with comments | « webrtc/api/peerconnectionfactory.h ('k') | webrtc/api/peerconnectionfactoryproxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698