From f82000328d01f5bd679ccac431205a485221eaa2 Mon Sep 17 00:00:00 2001 From: Oskar Sundbom Date: Thu, 16 Nov 2017 10:57:26 +0100 Subject: [PATCH] Optional: Use nullopt and implicit construction in /rtc_base/rate_statistics.cc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Commit-Queue: Oskar Sundbom Cr-Commit-Position: refs/heads/master@{#20930} --- rtc_base/rate_statistics.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/rtc_base/rate_statistics.cc b/rtc_base/rate_statistics.cc index 0485566c62..e2d6b113df 100644 --- a/rtc_base/rate_statistics.cc +++ b/rtc_base/rate_statistics.cc @@ -71,12 +71,11 @@ rtc::Optional 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(); + return rtc::nullopt; } float scale = scale_ / active_window_size; - return rtc::Optional( - static_cast(accumulated_count_ * scale + 0.5f)); + return static_cast(accumulated_count_ * scale + 0.5f); } void RateStatistics::EraseOld(int64_t now_ms) {