Rename a few MediaConfig::Video flags for consistency.

enable_cpu_overuse_detection --> enable_cpu_adaptation
  disable_prerenderer_smoothing --> enable_prerenderer_smoothing

where the latter also gets opposite meaning.

Bug: none
Change-Id: Ic10de0871a87e86a899aefa72ecb7e46fcdeaa65
Reviewed-on: https://webrtc-review.googlesource.com/40280
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21726}
This commit is contained in:
Niels Möller
2018-01-18 15:25:12 +01:00
committed by Commit Bot
parent 700ef33edc
commit 1d7ecd29c7
9 changed files with 26 additions and 36 deletions

View File

@ -197,7 +197,7 @@ void CopyConstraintsIntoRtcConfiguration(
&configuration->media_config.enable_dscp, nullptr);
FindConstraint(
constraints, MediaConstraintsInterface::kCpuOveruseDetection,
&configuration->media_config.video.enable_cpu_overuse_detection, nullptr);
&configuration->media_config.video.enable_cpu_adaptation, nullptr);
FindConstraint(constraints, MediaConstraintsInterface::kEnableRtpDataChannels,
&configuration->enable_rtp_data_channel, nullptr);
// Find Suspend Below Min Bitrate constraint.

View File

@ -305,13 +305,11 @@ class PeerConnectionInterface : public rtc::RefCountInterface {
bool dscp() const { return media_config.enable_dscp; }
void set_dscp(bool enable) { media_config.enable_dscp = enable; }
// TODO(nisse): The corresponding flag in MediaConfig and
// elsewhere should be renamed enable_cpu_adaptation.
bool cpu_adaptation() const {
return media_config.video.enable_cpu_overuse_detection;
return media_config.video.enable_cpu_adaptation;
}
void set_cpu_adaptation(bool enable) {
media_config.video.enable_cpu_overuse_detection = enable;
media_config.video.enable_cpu_adaptation = enable;
}
bool suspend_below_min_bitrate() const {
@ -321,14 +319,11 @@ class PeerConnectionInterface : public rtc::RefCountInterface {
media_config.video.suspend_below_min_bitrate = enable;
}
// TODO(nisse): The negation in the corresponding MediaConfig
// attribute is inconsistent, and it should be renamed at some
// point.
bool prerenderer_smoothing() const {
return !media_config.video.disable_prerenderer_smoothing;
return media_config.video.enable_prerenderer_smoothing;
}
void set_prerenderer_smoothing(bool enable) {
media_config.video.disable_prerenderer_smoothing = !enable;
media_config.video.enable_prerenderer_smoothing = enable;
}
bool experiment_cpu_load_estimator() const {

View File

@ -99,7 +99,7 @@ struct MediaConfig {
struct Video {
// Enable WebRTC CPU Overuse Detection. This flag comes from the
// PeerConnection constraint 'googCpuOveruseDetection'.
bool enable_cpu_overuse_detection = true;
bool enable_cpu_adaptation = true;
// Enable WebRTC suspension of video. No video frames will be sent
// when the bitrate is below the configured minimum bitrate. This
@ -123,7 +123,7 @@ struct MediaConfig {
// SmoothsRenderedFrames method. This method is used by the
// VideoReceiveStream, where the value is passed on to the
// IncomingVideoStream constructor.
bool disable_prerenderer_smoothing = false;
bool enable_prerenderer_smoothing = true;
// Enables periodic bandwidth probing in application-limited region.
bool periodic_alr_bandwidth_probing = false;
@ -138,12 +138,12 @@ struct MediaConfig {
bool operator==(const MediaConfig& o) const {
return enable_dscp == o.enable_dscp &&
video.enable_cpu_overuse_detection ==
o.video.enable_cpu_overuse_detection &&
video.enable_cpu_adaptation ==
o.video.enable_cpu_adaptation &&
video.suspend_below_min_bitrate ==
o.video.suspend_below_min_bitrate &&
video.disable_prerenderer_smoothing ==
o.video.disable_prerenderer_smoothing &&
video.enable_prerenderer_smoothing ==
o.video.enable_prerenderer_smoothing &&
video.periodic_alr_bandwidth_probing ==
o.video.periodic_alr_bandwidth_probing &&
video.experiment_cpu_load_estimator ==

View File

@ -85,7 +85,7 @@ class VideoMediaChannelTest : public testing::Test,
// implies DegradationPreference kMaintainResolution. Automatic scaling
// needs to be disabled, otherwise, tests which check the size of received
// frames become flaky.
media_config.video.enable_cpu_overuse_detection = false;
media_config.video.enable_cpu_adaptation = false;
channel_.reset(engine_.CreateChannel(call_.get(), media_config,
cricket::VideoOptions()));
channel_->OnReadyToSend(true);

View File

@ -1104,7 +1104,7 @@ bool WebRtcVideoChannel::AddSendStream(const StreamParams& sp) {
WebRtcVideoSendStream* stream = new WebRtcVideoSendStream(
call_, sp, std::move(config), default_send_options_, encoder_factory_,
video_config_.enable_cpu_overuse_detection,
video_config_.enable_cpu_adaptation,
bitrate_config_.max_bitrate_bps, send_codec_, send_rtp_extensions_,
send_params_);
@ -1211,8 +1211,9 @@ bool WebRtcVideoChannel::AddRecvStream(const StreamParams& sp,
webrtc::FlexfecReceiveStream::Config flexfec_config(this);
ConfigureReceiverRtp(&config, &flexfec_config, sp);
// TODO(nisse): Rename config variable to avoid negation.
config.disable_prerenderer_smoothing =
video_config_.disable_prerenderer_smoothing;
!video_config_.enable_prerenderer_smoothing;
config.sync_group = sp.sync_label;
receive_streams_[ssrc] = new WebRtcVideoReceiveStream(

View File

@ -143,7 +143,7 @@ void VerifySendStreamHasRtxTypes(const webrtc::VideoSendStream::Config& config,
cricket::MediaConfig GetMediaConfig() {
cricket::MediaConfig media_config;
media_config.video.enable_cpu_overuse_detection = false;
media_config.video.enable_cpu_adaptation = false;
return media_config;
}
@ -2404,7 +2404,7 @@ TEST_F(WebRtcVideoChannelTest, PreviousAdaptationDoesNotApplyToScreenshare) {
parameters.codecs.push_back(codec);
MediaConfig media_config = GetMediaConfig();
media_config.video.enable_cpu_overuse_detection = true;
media_config.video.enable_cpu_adaptation = true;
channel_.reset(
engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions()));
channel_->OnReadyToSend(true);
@ -2481,7 +2481,7 @@ void WebRtcVideoChannelTest::TestDegradationPreference(
parameters.codecs.push_back(codec);
MediaConfig media_config = GetMediaConfig();
media_config.video.enable_cpu_overuse_detection = true;
media_config.video.enable_cpu_adaptation = true;
channel_.reset(
engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions()));
channel_->OnReadyToSend(true);
@ -2515,7 +2515,7 @@ void WebRtcVideoChannelTest::TestCpuAdaptation(bool enable_overuse,
MediaConfig media_config = GetMediaConfig();
if (enable_overuse) {
media_config.video.enable_cpu_overuse_detection = true;
media_config.video.enable_cpu_adaptation = true;
}
channel_.reset(
engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions()));

View File

@ -28,13 +28,7 @@ bool Matches(const PeerConnectionInterface::RTCConfiguration& a,
a.screencast_min_bitrate == b.screencast_min_bitrate &&
a.combined_audio_video_bwe == b.combined_audio_video_bwe &&
a.enable_dtls_srtp == b.enable_dtls_srtp &&
a.media_config.enable_dscp == b.media_config.enable_dscp &&
a.media_config.video.enable_cpu_overuse_detection ==
b.media_config.video.enable_cpu_overuse_detection &&
a.media_config.video.disable_prerenderer_smoothing ==
b.media_config.video.disable_prerenderer_smoothing &&
a.media_config.video.suspend_below_min_bitrate ==
b.media_config.video.suspend_below_min_bitrate;
a.media_config == b.media_config;
}
TEST(MediaConstraintsInterface, CopyConstraintsIntoRtcConfiguration) {

View File

@ -3741,8 +3741,8 @@ TEST_F(PeerConnectionMediaConfigTest, TestDefaults) {
TestCreatePeerConnection(config, &constraints);
EXPECT_FALSE(media_config.enable_dscp);
EXPECT_TRUE(media_config.video.enable_cpu_overuse_detection);
EXPECT_FALSE(media_config.video.disable_prerenderer_smoothing);
EXPECT_TRUE(media_config.video.enable_cpu_adaptation);
EXPECT_TRUE(media_config.video.enable_prerenderer_smoothing);
EXPECT_FALSE(media_config.video.suspend_below_min_bitrate);
EXPECT_FALSE(media_config.video.experiment_cpu_load_estimator);
}
@ -3771,10 +3771,10 @@ TEST_F(PeerConnectionMediaConfigTest, TestCpuOveruseConstraintFalse) {
const cricket::MediaConfig media_config =
TestCreatePeerConnection(config, &constraints);
EXPECT_FALSE(media_config.video.enable_cpu_overuse_detection);
EXPECT_FALSE(media_config.video.enable_cpu_adaptation);
}
// This test verifies that the disable_prerenderer_smoothing flag is
// This test verifies that the enable_prerenderer_smoothing flag is
// propagated from RTCConfiguration to the PeerConnection.
TEST_F(PeerConnectionMediaConfigTest, TestDisablePrerendererSmoothingTrue) {
PeerConnectionInterface::RTCConfiguration config;
@ -3784,7 +3784,7 @@ TEST_F(PeerConnectionMediaConfigTest, TestDisablePrerendererSmoothingTrue) {
const cricket::MediaConfig& media_config =
TestCreatePeerConnection(config, &constraints);
EXPECT_TRUE(media_config.video.disable_prerenderer_smoothing);
EXPECT_FALSE(media_config.video.enable_prerenderer_smoothing);
}
// This test verifies that the experiment_cpu_load_estimator flag is

View File

@ -171,7 +171,7 @@ void JavaToNativeRTCConfiguration(
Java_RTCConfiguration_getDisableIpv6(jni, j_rtc_config);
rtc_config->media_config.enable_dscp =
Java_RTCConfiguration_getEnableDscp(jni, j_rtc_config);
rtc_config->media_config.video.enable_cpu_overuse_detection =
rtc_config->media_config.video.enable_cpu_adaptation =
Java_RTCConfiguration_getEnableCpuOveruseDetection(jni, j_rtc_config);
rtc_config->enable_rtp_data_channel =
Java_RTCConfiguration_getEnableRtpDataChannel(jni, j_rtc_config);