From 71bdda0ededda74cdd73a8309419cf626499627f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= Date: Thu, 31 Mar 2016 12:59:59 +0200 Subject: [PATCH] Add RTCConfiguration getter and setter methods. The immediate plan is to move some flags into an embedded MediaConfig (https://codereview.webrtc.org/1818033002/), which will be possible after Chrome is updated to use these new setter methods. BUG=webrtc:4906 R=hbos@google.com, hbos@webrtc.org, perkj@webrtc.org, pthatcher@webrtc.org Review URL: https://codereview.webrtc.org/1836083003 . Cr-Commit-Position: refs/heads/master@{#12177} --- webrtc/api/peerconnectioninterface.h | 30 +++++++++++++++++++ .../api/peerconnectioninterface_unittest.cc | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/webrtc/api/peerconnectioninterface.h b/webrtc/api/peerconnectioninterface.h index 08a131920e..9259275b86 100644 --- a/webrtc/api/peerconnectioninterface.h +++ b/webrtc/api/peerconnectioninterface.h @@ -223,6 +223,36 @@ class PeerConnectionInterface : public rtc::RefCountInterface { // TODO(hbos): Change into class with private data and public getters. struct RTCConfiguration { + // This struct is subject to reorganization, both for naming + // consistency, and to group settings to match where they are used + // in the implementation. To do that, we need getter and setter + // methods for all settings which are of interest to applications, + // Chrome in particular. + + bool dscp() { return enable_dscp.value_or(false); } + void set_dscp(bool enable) { enable_dscp = rtc::Optional(enable); } + + // TODO(nisse): The corresponding flag in MediaConfig and + // elsewhere should be renamed enable_cpu_adaptation. + bool cpu_adaptation() { return cpu_overuse_detection.value_or(true); } + void set_cpu_adaptation(bool enable) { + cpu_overuse_detection = rtc::Optional(enable); + } + + // TODO(nisse): Currently no getter method, since it collides with + // the flag itself. Add when the flag is moved to MediaConfig. + void set_suspend_below_min_bitrate(bool enable) { + suspend_below_min_bitrate = rtc::Optional(enable); + } + + // TODO(nisse): The negation in the corresponding MediaConfig + // attribute is inconsistent, and it should be renamed at some + // point. + bool prerenderer_smoothing() { return !disable_prerenderer_smoothing; } + void set_prerenderer_smoothing(bool enable) { + disable_prerenderer_smoothing = !enable; + } + static const int kUndefined = -1; // Default maximum number of packets in the audio jitter buffer. static const int kAudioJitterBufferMaxPackets = 50; diff --git a/webrtc/api/peerconnectioninterface_unittest.cc b/webrtc/api/peerconnectioninterface_unittest.cc index 2c044e2080..51968e6cbf 100644 --- a/webrtc/api/peerconnectioninterface_unittest.cc +++ b/webrtc/api/peerconnectioninterface_unittest.cc @@ -2552,7 +2552,7 @@ TEST_F(PeerConnectionMediaConfigTest, TestDisablePrerendererSmoothingTrue) { PeerConnectionInterface::RTCConfiguration config; FakeConstraints constraints; - config.disable_prerenderer_smoothing = true; + config.set_prerenderer_smoothing(false); const cricket::MediaConfig& media_config = TestCreatePeerConnection(config, &constraints);