Optional: Use nullopt and implicit construction in /rtc_base/rate_statistics.cc

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=sprang@webrtc.org

Bug: None
Change-Id: I50d25d6174486928963c2e98455587a8a9f0bee6
Reviewed-on: https://webrtc-review.googlesource.com/23616
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Oskar Sundbom <ossu@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20930}
This commit is contained in:
Oskar Sundbom 2017-11-16 10:57:26 +01:00 committed by Commit Bot
parent 903dcd733a
commit f82000328d

View File

@ -71,12 +71,11 @@ rtc::Optional<uint32_t> RateStatistics::Rate(int64_t now_ms) const {
int64_t active_window_size = now_ms - oldest_time_ + 1;
if (num_samples_ == 0 || active_window_size <= 1 ||
(num_samples_ <= 1 && active_window_size < current_window_size_ms_)) {
return rtc::Optional<uint32_t>();
return rtc::nullopt;
}
float scale = scale_ / active_window_size;
return rtc::Optional<uint32_t>(
static_cast<uint32_t>(accumulated_count_ * scale + 0.5f));
return static_cast<uint32_t>(accumulated_count_ * scale + 0.5f);
}
void RateStatistics::EraseOld(int64_t now_ms) {