Optional: Use nullopt and implicit construction in /modules/remote_bitrate_estimator

Changes places where we explicitly construct an Optional to instead use
nullopt or the requisite value type only.

This CL was uploaded by git cl split.

R=terelius@webrtc.org

Bug: None
Change-Id: I1d2538482e2390d91f3285124d011a578da4b61b
Reviewed-on: https://webrtc-review.googlesource.com/23564
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Commit-Queue: Oskar Sundbom <ossu@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20710}
This commit is contained in:
Oskar Sundbom
2017-11-16 10:52:14 +01:00
committed by Commit Bot
parent c9b89aaa16
commit 18f26d1434
3 changed files with 8 additions and 11 deletions

View File

@ -250,10 +250,9 @@ uint32_t AimdRateControl::ChangeBitrate(uint32_t new_bitrate_bps,
// If bitrate decreases more than a normal back off after overuse, it
// indicates a real network degradation. We do not let such a decrease
// to determine the bandwidth estimation period.
last_decrease_ = rtc::Optional<int>();
last_decrease_ = rtc::nullopt;
} else {
last_decrease_ =
rtc::Optional<int>(current_bitrate_bps_ - new_bitrate_bps);
last_decrease_ = current_bitrate_bps_ - new_bitrate_bps;
}
}
if (incoming_bitrate_kbps <

View File

@ -45,8 +45,7 @@ void UpdateRateControl(const AimdRateControlStates& states,
const BandwidthUsage& bandwidth_usage,
int bitrate,
int64_t now_ms) {
RateControlInput input(bandwidth_usage, rtc::Optional<uint32_t>(bitrate),
now_ms);
RateControlInput input(bandwidth_usage, bitrate, now_ms);
states.aimd_rate_control->Update(&input, now_ms);
}

View File

@ -45,18 +45,17 @@ TEST(CongestionWindowTest, DataInflight) {
TEST(CongestionWindowTest, ZeroBandwidthDelayProduct) {
CongestionWindow congestion_window;
int64_t target_congestion_window =
congestion_window.GetTargetCongestionWindow(
100, rtc::Optional<int64_t>(0), 2.885f);
congestion_window.GetTargetCongestionWindow(100, 0, 2.885f);
EXPECT_EQ(target_congestion_window, 2.885f * kStartingCongestionWindow);
}
TEST(CongestionWindowTest, CalculateCongestionWindow) {
CongestionWindow congestion_window;
int64_t cwnd = congestion_window.GetCongestionWindow(
BbrBweSender::STARTUP, 800000, rtc::Optional<int64_t>(100l), 2.885f);
int64_t cwnd = congestion_window.GetCongestionWindow(BbrBweSender::STARTUP,
800000, 100l, 2.885f);
EXPECT_EQ(cwnd, 28850);
cwnd = congestion_window.GetCongestionWindow(
BbrBweSender::STARTUP, 400000, rtc::Optional<int64_t>(200l), 2.885f);
cwnd = congestion_window.GetCongestionWindow(BbrBweSender::STARTUP, 400000,
200l, 2.885f);
EXPECT_EQ(cwnd, 28850);
}
} // namespace bwe