Replace rtc::Optional with absl::optional
This is a no-op change because rtc::Optional is an alias to absl::optional
This CL generated by running script from modules with parameters
'pacing video_coding congestion_controller remote_bitrate_estimator':
find $@ -type f \( -name \*.h -o -name \*.cc \) \
-exec sed -i 's|rtc::Optional|absl::optional|g' {} \+ \
-exec sed -i 's|rtc::nullopt|absl::nullopt|g' {} \+ \
-exec sed -i 's|#include "api/optional.h"|#include "absl/types/optional.h"|' {} \+
find $@ -type f -name BUILD.gn \
-exec sed -r -i 's|"(../)*api:optional"|"//third_party/abseil-cpp/absl/types:optional"|' {} \+;
git cl format
Bug: webrtc:9078
Change-Id: I8ea501d7f1ee36e8d8cd3ed37e6b763c7fe29118
Reviewed-on: https://webrtc-review.googlesource.com/83900
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23640}
This commit is contained in:
committed by
Commit Bot
parent
ae1888629a
commit
0040b66ad3
@ -23,13 +23,13 @@ void MovingAverage::AddSample(int sample) {
|
||||
sum_history_[count_ % sum_history_.size()] = sum_;
|
||||
}
|
||||
|
||||
rtc::Optional<int> MovingAverage::GetAverage() const {
|
||||
absl::optional<int> MovingAverage::GetAverage() const {
|
||||
return GetAverage(size());
|
||||
}
|
||||
|
||||
rtc::Optional<int> MovingAverage::GetAverage(size_t num_samples) const {
|
||||
absl::optional<int> MovingAverage::GetAverage(size_t num_samples) const {
|
||||
if (num_samples > size() || num_samples == 0)
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
int sum = sum_ - sum_history_[(count_ - num_samples) % sum_history_.size()];
|
||||
return sum / static_cast<int>(num_samples);
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
|
||||
namespace webrtc {
|
||||
class MovingAverage {
|
||||
@ -21,8 +21,8 @@ class MovingAverage {
|
||||
explicit MovingAverage(size_t s);
|
||||
~MovingAverage();
|
||||
void AddSample(int sample);
|
||||
rtc::Optional<int> GetAverage() const;
|
||||
rtc::Optional<int> GetAverage(size_t num_samples) const;
|
||||
absl::optional<int> GetAverage() const;
|
||||
absl::optional<int> GetAverage(size_t num_samples) const;
|
||||
void Reset();
|
||||
size_t size() const;
|
||||
|
||||
|
||||
@ -44,10 +44,10 @@ class QualityScaler::QpSmoother {
|
||||
explicit QpSmoother(float alpha)
|
||||
: alpha_(alpha), last_sample_ms_(rtc::TimeMillis()), smoother_(alpha) {}
|
||||
|
||||
rtc::Optional<int> GetAvg() const {
|
||||
absl::optional<int> GetAvg() const {
|
||||
float value = smoother_.filtered();
|
||||
if (value == rtc::ExpFilter::kValueUndefined) {
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
return static_cast<int>(value);
|
||||
}
|
||||
@ -182,7 +182,7 @@ void QualityScaler::CheckQp() {
|
||||
observed_enough_frames_ = true;
|
||||
|
||||
// Check if we should scale down due to high frame drop.
|
||||
const rtc::Optional<int> drop_rate =
|
||||
const absl::optional<int> drop_rate =
|
||||
config_.use_all_drop_reasons ? framedrop_percent_all_.GetAverage()
|
||||
: framedrop_percent_media_opt_.GetAverage();
|
||||
if (drop_rate && *drop_rate >= kFramedropPercentThreshold) {
|
||||
@ -192,10 +192,10 @@ void QualityScaler::CheckQp() {
|
||||
}
|
||||
|
||||
// Check if we should scale up or down based on QP.
|
||||
const rtc::Optional<int> avg_qp_high = qp_smoother_high_
|
||||
? qp_smoother_high_->GetAvg()
|
||||
: average_qp_.GetAverage();
|
||||
const rtc::Optional<int> avg_qp_low =
|
||||
const absl::optional<int> avg_qp_high = qp_smoother_high_
|
||||
? qp_smoother_high_->GetAvg()
|
||||
: average_qp_.GetAverage();
|
||||
const absl::optional<int> avg_qp_low =
|
||||
qp_smoother_low_ ? qp_smoother_low_->GetAvg() : average_qp_.GetAverage();
|
||||
if (avg_qp_high && avg_qp_low) {
|
||||
RTC_LOG(LS_INFO) << "Checking average QP " << *avg_qp_high << " ("
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/video_codecs/video_encoder.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "modules/video_coding/utility/moving_average.h"
|
||||
|
||||
Reference in New Issue
Block a user