Replace rtc::Optional with absl::optional in modules/audio processing
This is a no-op change because rtc::Optional is an alias to absl::optional
This CL generated by running script with parameter 'modules/audio_processing'
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: Id29f8de59dba704787c2c38a3d05c60827c181b0
Reviewed-on: https://webrtc-review.googlesource.com/83982
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23653}
diff --git a/modules/audio_processing/BUILD.gn b/modules/audio_processing/BUILD.gn
index e6c5933..c361976 100644
--- a/modules/audio_processing/BUILD.gn
+++ b/modules/audio_processing/BUILD.gn
@@ -126,7 +126,6 @@
"../..:typedefs",
"../..:webrtc_common",
"../../api:array_view",
- "../../api:optional",
"../../api/audio:aec3_config",
"../../api/audio:audio_frame_api",
"../../api/audio:echo_control",
@@ -144,6 +143,7 @@
"agc2:fixed_digital",
"agc2:gain_applier",
"vad",
+ "//third_party/abseil-cpp/absl/types:optional",
]
if (aec_untrusted_delay_for_testing) {
@@ -187,7 +187,7 @@
"include/audio_processing_statistics.h",
]
deps = [
- "../../api:optional",
+ "//third_party/abseil-cpp/absl/types:optional",
]
}
@@ -510,7 +510,6 @@
"../..:typedefs",
"../..:webrtc_common",
"../../api:array_view",
- "../../api:optional",
"../../api/audio:aec3_config",
"../../api/audio:aec3_factory",
"../../common_audio:common_audio",
@@ -536,6 +535,7 @@
"test/conversational_speech:unittest",
"vad:vad_unittests",
"//testing/gtest",
+ "//third_party/abseil-cpp/absl/types:optional",
]
defines = []
@@ -650,11 +650,11 @@
]
deps = [
"../../api:array_view",
- "../../api:optional",
"../../api/audio:audio_frame_api",
"../../common_audio:common_audio",
"../../rtc_base:checks",
"../../rtc_base:rtc_base_approved",
+ "//third_party/abseil-cpp/absl/types:optional",
]
}
@@ -678,7 +678,6 @@
":audioproc_debug_proto",
":audioproc_protobuf_utils",
":audioproc_test_utils",
- "../../api:optional",
"../../api/audio:aec3_factory",
"../../common_audio:common_audio",
"../../rtc_base:checks",
@@ -693,6 +692,7 @@
"aec_dump",
"aec_dump:aec_dump_impl",
"//testing/gtest",
+ "//third_party/abseil-cpp/absl/types:optional",
]
} # audioproc_f_impl
rtc_executable("audioproc_f") {
@@ -727,7 +727,6 @@
deps = [
":audio_processing",
"../../api:array_view",
- "../../api:optional",
"../../api/audio:audio_frame_api",
"../../common_audio",
"../../rtc_base:checks",
@@ -737,6 +736,7 @@
"../../test:test_support",
"../audio_coding:neteq_input_audio_tools",
"//testing/gtest",
+ "//third_party/abseil-cpp/absl/types:optional",
]
}
diff --git a/modules/audio_processing/aec3/BUILD.gn b/modules/audio_processing/aec3/BUILD.gn
index 15ca70a..c0f632a 100644
--- a/modules/audio_processing/aec3/BUILD.gn
+++ b/modules/audio_processing/aec3/BUILD.gn
@@ -112,7 +112,6 @@
"..:audio_processing",
"../../..:typedefs",
"../../../api:array_view",
- "../../../api:optional",
"../../../api/audio:aec3_config",
"../../../api/audio:echo_control",
"../../../common_audio:common_audio_c",
@@ -122,6 +121,7 @@
"../../../system_wrappers:cpu_features_api",
"../../../system_wrappers:field_trial_api",
"../../../system_wrappers:metrics_api",
+ "//third_party/abseil-cpp/absl/types:optional",
]
configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
@@ -146,13 +146,13 @@
"..:audio_processing_unittests",
"../../..:typedefs",
"../../../api:array_view",
- "../../../api:optional",
"../../../api/audio:aec3_config",
"../../../rtc_base:checks",
"../../../rtc_base:rtc_base_approved",
"../../../rtc_base:safe_minmax",
"../../../system_wrappers:cpu_features_api",
"../../../test:test_support",
+ "//third_party/abseil-cpp/absl/types:optional",
]
defines = []
diff --git a/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc b/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc
index 9561dff..b075ff5 100644
--- a/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc
+++ b/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc
@@ -325,7 +325,7 @@
std::vector<float> y(kBlockSize, 0.f);
AecState aec_state(EchoCanceller3Config{});
RenderSignalAnalyzer render_signal_analyzer(config);
- rtc::Optional<DelayEstimate> delay_estimate;
+ absl::optional<DelayEstimate> delay_estimate;
std::vector<float> e(kBlockSize, 0.f);
std::array<float, kFftLength> s_scratch;
std::array<float, kBlockSize> s;
diff --git a/modules/audio_processing/aec3/aec_state.cc b/modules/audio_processing/aec3/aec_state.cc
index 5fe8276..b32ae3c 100644
--- a/modules/audio_processing/aec3/aec_state.cc
+++ b/modules/audio_processing/aec3/aec_state.cc
@@ -115,7 +115,7 @@
}
void AecState::Update(
- const rtc::Optional<DelayEstimate>& external_delay,
+ const absl::optional<DelayEstimate>& external_delay,
const std::vector<std::array<float, kFftLengthBy2Plus1>>&
adaptive_filter_frequency_response,
const std::vector<float>& adaptive_filter_impulse_response,
@@ -143,7 +143,7 @@
if (filter_analyzer_.Consistent()) {
internal_delay_ = filter_analyzer_.DelayBlocks();
} else {
- internal_delay_ = rtc::nullopt;
+ internal_delay_ = absl::nullopt;
}
external_delay_seen_ = external_delay_seen_ || external_delay;
diff --git a/modules/audio_processing/aec3/aec_state.h b/modules/audio_processing/aec3/aec_state.h
index 710aedb..ad3d929 100644
--- a/modules/audio_processing/aec3/aec_state.h
+++ b/modules/audio_processing/aec3/aec_state.h
@@ -17,9 +17,9 @@
#include <memory>
#include <vector>
+#include "absl/types/optional.h"
#include "api/array_view.h"
#include "api/audio/echo_canceller3_config.h"
-#include "api/optional.h"
#include "modules/audio_processing/aec3/aec3_common.h"
#include "modules/audio_processing/aec3/delay_estimate.h"
#include "modules/audio_processing/aec3/echo_audibility.h"
@@ -84,7 +84,7 @@
int FilterDelayBlocks() const { return filter_delay_blocks_; }
// Returns the internal delay estimate based on the linear filter.
- rtc::Optional<int> InternalDelay() const { return internal_delay_; }
+ absl::optional<int> InternalDelay() const { return internal_delay_; }
// Returns whether the capture signal is saturated.
bool SaturatedCapture() const { return capture_signal_saturation_; }
@@ -125,7 +125,7 @@
bool InitialState() const { return initial_state_; }
// Updates the aec state.
- void Update(const rtc::Optional<DelayEstimate>& external_delay,
+ void Update(const absl::optional<DelayEstimate>& external_delay,
const std::vector<std::array<float, kFftLengthBy2Plus1>>&
adaptive_filter_frequency_response,
const std::vector<float>& adaptive_filter_impulse_response,
@@ -188,7 +188,7 @@
SuppressionGainUpperLimiter suppression_gain_limiter_;
FilterAnalyzer filter_analyzer_;
bool use_linear_filter_output_ = false;
- rtc::Optional<int> internal_delay_;
+ absl::optional<int> internal_delay_;
size_t diverged_blocks_ = 0;
bool filter_should_have_converged_ = false;
size_t blocks_since_converged_filter_;
@@ -196,7 +196,7 @@
bool converged_filter_seen_ = false;
bool consistent_filter_seen_ = false;
bool external_delay_seen_ = false;
- rtc::Optional<DelayEstimate> external_delay_;
+ absl::optional<DelayEstimate> external_delay_;
size_t frames_since_external_delay_change_ = 0;
size_t converged_filter_count_ = 0;
bool finite_erl_ = false;
diff --git a/modules/audio_processing/aec3/aec_state_unittest.cc b/modules/audio_processing/aec3/aec_state_unittest.cc
index 83213b5..00d25d6 100644
--- a/modules/audio_processing/aec3/aec_state_unittest.cc
+++ b/modules/audio_processing/aec3/aec_state_unittest.cc
@@ -22,7 +22,7 @@
ApmDataDumper data_dumper(42);
EchoCanceller3Config config;
AecState state(config);
- rtc::Optional<DelayEstimate> delay_estimate =
+ absl::optional<DelayEstimate> delay_estimate =
DelayEstimate(DelayEstimate::Quality::kRefined, 10);
std::unique_ptr<RenderDelayBuffer> render_delay_buffer(
RenderDelayBuffer::Create(config, 3));
@@ -173,7 +173,7 @@
AecState state(config);
std::unique_ptr<RenderDelayBuffer> render_delay_buffer(
RenderDelayBuffer::Create(config, 3));
- rtc::Optional<DelayEstimate> delay_estimate;
+ absl::optional<DelayEstimate> delay_estimate;
std::array<float, kFftLengthBy2Plus1> E2_main;
std::array<float, kFftLengthBy2Plus1> Y2;
std::array<float, kBlockSize> x;
diff --git a/modules/audio_processing/aec3/block_processor.cc b/modules/audio_processing/aec3/block_processor.cc
index f954be3..1bb6958 100644
--- a/modules/audio_processing/aec3/block_processor.cc
+++ b/modules/audio_processing/aec3/block_processor.cc
@@ -9,7 +9,7 @@
*/
#include "modules/audio_processing/aec3/block_processor.h"
-#include "api/optional.h"
+#include "absl/types/optional.h"
#include "modules/audio_processing/aec3/aec3_common.h"
#include "modules/audio_processing/aec3/block_processor_metrics.h"
#include "modules/audio_processing/aec3/echo_path_variability.h"
@@ -58,8 +58,8 @@
BlockProcessorMetrics metrics_;
RenderDelayBuffer::BufferingEvent render_event_;
size_t capture_call_counter_ = 0;
- rtc::Optional<DelayEstimate> estimated_delay_;
- rtc::Optional<int> echo_remover_delay_;
+ absl::optional<DelayEstimate> estimated_delay_;
+ absl::optional<int> echo_remover_delay_;
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(BlockProcessorImpl);
};
@@ -232,7 +232,7 @@
void BlockProcessorImpl::GetMetrics(EchoControl::Metrics* metrics) const {
echo_remover_->GetMetrics(metrics);
const int block_size_ms = sample_rate_hz_ == 8000 ? 8 : 4;
- rtc::Optional<size_t> delay = render_buffer_->Delay();
+ absl::optional<size_t> delay = render_buffer_->Delay();
metrics->delay_ms = delay ? static_cast<int>(*delay) * block_size_ms : 0;
}
diff --git a/modules/audio_processing/aec3/echo_audibility.cc b/modules/audio_processing/aec3/echo_audibility.cc
index a504cca..567873b 100644
--- a/modules/audio_processing/aec3/echo_audibility.cc
+++ b/modules/audio_processing/aec3/echo_audibility.cc
@@ -42,7 +42,7 @@
void EchoAudibility::Reset() {
render_stationarity_.Reset();
non_zero_render_seen_ = false;
- render_spectrum_write_prev_ = rtc::nullopt;
+ render_spectrum_write_prev_ = absl::nullopt;
}
void EchoAudibility::UpdateRenderStationarityFlags(
diff --git a/modules/audio_processing/aec3/echo_audibility.h b/modules/audio_processing/aec3/echo_audibility.h
index 58a6599..141ac62 100644
--- a/modules/audio_processing/aec3/echo_audibility.h
+++ b/modules/audio_processing/aec3/echo_audibility.h
@@ -17,8 +17,8 @@
#include <memory>
#include <vector>
+#include "absl/types/optional.h"
#include "api/array_view.h"
-#include "api/optional.h"
#include "modules/audio_processing/aec3/matrix_buffer.h"
#include "modules/audio_processing/aec3/render_buffer.h"
#include "modules/audio_processing/aec3/stationarity_estimator.h"
@@ -70,7 +70,7 @@
// values.
bool IsRenderTooLow(const MatrixBuffer& block_buffer);
- rtc::Optional<int> render_spectrum_write_prev_;
+ absl::optional<int> render_spectrum_write_prev_;
int render_block_write_prev_;
bool non_zero_render_seen_;
StationarityEstimator render_stationarity_;
diff --git a/modules/audio_processing/aec3/echo_path_delay_estimator.cc b/modules/audio_processing/aec3/echo_path_delay_estimator.cc
index bc9cde4..4cae277 100644
--- a/modules/audio_processing/aec3/echo_path_delay_estimator.cc
+++ b/modules/audio_processing/aec3/echo_path_delay_estimator.cc
@@ -61,11 +61,11 @@
matched_filter_lag_aggregator_.Reset();
}
matched_filter_.Reset();
- old_aggregated_lag_ = rtc::nullopt;
+ old_aggregated_lag_ = absl::nullopt;
consistent_estimate_counter_ = 0;
}
-rtc::Optional<DelayEstimate> EchoPathDelayEstimator::EstimateDelay(
+absl::optional<DelayEstimate> EchoPathDelayEstimator::EstimateDelay(
const DownsampledRenderBuffer& render_buffer,
rtc::ArrayView<const float> capture) {
RTC_DCHECK_EQ(kBlockSize, capture.size());
@@ -81,7 +81,7 @@
16000 / down_sampling_factor_, 1);
matched_filter_.Update(render_buffer, downsampled_capture);
- rtc::Optional<DelayEstimate> aggregated_matched_filter_lag =
+ absl::optional<DelayEstimate> aggregated_matched_filter_lag =
matched_filter_lag_aggregator_.Aggregate(
matched_filter_.GetLagEstimates());
diff --git a/modules/audio_processing/aec3/echo_path_delay_estimator.h b/modules/audio_processing/aec3/echo_path_delay_estimator.h
index 6389098..cea9abc 100644
--- a/modules/audio_processing/aec3/echo_path_delay_estimator.h
+++ b/modules/audio_processing/aec3/echo_path_delay_estimator.h
@@ -13,8 +13,8 @@
#include <vector>
+#include "absl/types/optional.h"
#include "api/audio/echo_canceller3_config.h"
-#include "api/optional.h"
#include "modules/audio_processing/aec3/decimator.h"
#include "modules/audio_processing/aec3/delay_estimate.h"
#include "modules/audio_processing/aec3/downsampled_render_buffer.h"
@@ -38,7 +38,7 @@
void Reset(bool soft_reset);
// Produce a delay estimate if such is avaliable.
- rtc::Optional<DelayEstimate> EstimateDelay(
+ absl::optional<DelayEstimate> EstimateDelay(
const DownsampledRenderBuffer& render_buffer,
rtc::ArrayView<const float> capture);
@@ -55,7 +55,7 @@
Decimator capture_decimator_;
MatchedFilter matched_filter_;
MatchedFilterLagAggregator matched_filter_lag_aggregator_;
- rtc::Optional<DelayEstimate> old_aggregated_lag_;
+ absl::optional<DelayEstimate> old_aggregated_lag_;
size_t consistent_estimate_counter_ = 0;
RTC_DISALLOW_COPY_AND_ASSIGN(EchoPathDelayEstimator);
diff --git a/modules/audio_processing/aec3/echo_path_delay_estimator_unittest.cc b/modules/audio_processing/aec3/echo_path_delay_estimator_unittest.cc
index 8dd3bc6..841cdfa 100644
--- a/modules/audio_processing/aec3/echo_path_delay_estimator_unittest.cc
+++ b/modules/audio_processing/aec3/echo_path_delay_estimator_unittest.cc
@@ -72,7 +72,7 @@
delay_samples + 2 * config.delay.api_call_jitter_blocks * 64);
EchoPathDelayEstimator estimator(&data_dumper, config);
- rtc::Optional<DelayEstimate> estimated_delay_samples;
+ absl::optional<DelayEstimate> estimated_delay_samples;
for (size_t k = 0; k < (500 + (delay_samples) / kBlockSize); ++k) {
RandomizeSampleVector(&random_generator, render[0]);
signal_delay_buffer.Delay(render[0], capture);
diff --git a/modules/audio_processing/aec3/echo_remover.cc b/modules/audio_processing/aec3/echo_remover.cc
index a2d5e36..e264d30 100644
--- a/modules/audio_processing/aec3/echo_remover.cc
+++ b/modules/audio_processing/aec3/echo_remover.cc
@@ -68,14 +68,14 @@
// signal.
void ProcessCapture(const EchoPathVariability& echo_path_variability,
bool capture_signal_saturation,
- const rtc::Optional<DelayEstimate>& external_delay,
+ const absl::optional<DelayEstimate>& external_delay,
RenderBuffer* render_buffer,
std::vector<std::vector<float>>* capture) override;
// Returns the internal delay estimate in blocks.
- rtc::Optional<int> Delay() const override {
+ absl::optional<int> Delay() const override {
// TODO(peah): Remove or reactivate this functionality.
- return rtc::nullopt;
+ return absl::nullopt;
}
// Updates the status on whether echo leakage is detected in the output of the
@@ -143,7 +143,7 @@
void EchoRemoverImpl::ProcessCapture(
const EchoPathVariability& echo_path_variability,
bool capture_signal_saturation,
- const rtc::Optional<DelayEstimate>& external_delay,
+ const absl::optional<DelayEstimate>& external_delay,
RenderBuffer* render_buffer,
std::vector<std::vector<float>>* capture) {
const std::vector<std::vector<float>>& x = render_buffer->Block(0);
diff --git a/modules/audio_processing/aec3/echo_remover.h b/modules/audio_processing/aec3/echo_remover.h
index 61d2999..710afac 100644
--- a/modules/audio_processing/aec3/echo_remover.h
+++ b/modules/audio_processing/aec3/echo_remover.h
@@ -13,9 +13,9 @@
#include <vector>
+#include "absl/types/optional.h"
#include "api/audio/echo_canceller3_config.h"
#include "api/audio/echo_control.h"
-#include "api/optional.h"
#include "modules/audio_processing/aec3/delay_estimate.h"
#include "modules/audio_processing/aec3/echo_path_variability.h"
#include "modules/audio_processing/aec3/render_buffer.h"
@@ -38,12 +38,12 @@
virtual void ProcessCapture(
const EchoPathVariability& echo_path_variability,
bool capture_signal_saturation,
- const rtc::Optional<DelayEstimate>& external_delay,
+ const absl::optional<DelayEstimate>& external_delay,
RenderBuffer* render_buffer,
std::vector<std::vector<float>>* capture) = 0;
// Returns the internal delay estimate in blocks.
- virtual rtc::Optional<int> Delay() const = 0;
+ virtual absl::optional<int> Delay() const = 0;
// Updates the status on whether echo leakage is detected in the output of the
// echo remover.
diff --git a/modules/audio_processing/aec3/echo_remover_unittest.cc b/modules/audio_processing/aec3/echo_remover_unittest.cc
index 8e131fe..04a2727 100644
--- a/modules/audio_processing/aec3/echo_remover_unittest.cc
+++ b/modules/audio_processing/aec3/echo_remover_unittest.cc
@@ -43,7 +43,7 @@
// Verifies the basic API call sequence
TEST(EchoRemover, BasicApiCalls) {
- rtc::Optional<DelayEstimate> delay_estimate;
+ absl::optional<DelayEstimate> delay_estimate;
for (auto rate : {8000, 16000, 32000, 48000}) {
SCOPED_TRACE(ProduceDebugText(rate));
std::unique_ptr<EchoRemover> remover(
@@ -84,7 +84,7 @@
// Verifies the check for the capture block size.
TEST(EchoRemover, WrongCaptureBlockSize) {
- rtc::Optional<DelayEstimate> delay_estimate;
+ absl::optional<DelayEstimate> delay_estimate;
for (auto rate : {8000, 16000, 32000, 48000}) {
SCOPED_TRACE(ProduceDebugText(rate));
std::unique_ptr<EchoRemover> remover(
@@ -106,7 +106,7 @@
// TODO(peah): Re-enable the test once the issue with memory leaks during DEATH
// tests on test bots has been fixed.c
TEST(EchoRemover, DISABLED_WrongCaptureNumBands) {
- rtc::Optional<DelayEstimate> delay_estimate;
+ absl::optional<DelayEstimate> delay_estimate;
for (auto rate : {16000, 32000, 48000}) {
SCOPED_TRACE(ProduceDebugText(rate));
std::unique_ptr<EchoRemover> remover(
@@ -127,7 +127,7 @@
// Verifies the check for non-null capture block.
TEST(EchoRemover, NullCapture) {
- rtc::Optional<DelayEstimate> delay_estimate;
+ absl::optional<DelayEstimate> delay_estimate;
std::unique_ptr<EchoRemover> remover(
EchoRemover::Create(EchoCanceller3Config(), 8000));
std::unique_ptr<RenderDelayBuffer> render_buffer(
@@ -147,7 +147,7 @@
TEST(EchoRemover, BasicEchoRemoval) {
constexpr int kNumBlocksToProcess = 500;
Random random_generator(42U);
- rtc::Optional<DelayEstimate> delay_estimate;
+ absl::optional<DelayEstimate> delay_estimate;
for (auto rate : {8000, 16000, 32000, 48000}) {
std::vector<std::vector<float>> x(NumBandsForRate(rate),
std::vector<float>(kBlockSize, 0.f));
diff --git a/modules/audio_processing/aec3/filter_analyzer.h b/modules/audio_processing/aec3/filter_analyzer.h
index e47606c..3d65aec 100644
--- a/modules/audio_processing/aec3/filter_analyzer.h
+++ b/modules/audio_processing/aec3/filter_analyzer.h
@@ -13,9 +13,9 @@
#include <vector>
+#include "absl/types/optional.h"
#include "api/array_view.h"
#include "api/audio/echo_canceller3_config.h"
-#include "api/optional.h"
#include "modules/audio_processing/aec3/aec3_common.h"
#include "modules/audio_processing/aec3/cascaded_biquad_filter.h"
#include "modules/audio_processing/aec3/render_buffer.h"
diff --git a/modules/audio_processing/aec3/main_filter_update_gain_unittest.cc b/modules/audio_processing/aec3/main_filter_update_gain_unittest.cc
index 3d0a8c3..f398b84 100644
--- a/modules/audio_processing/aec3/main_filter_update_gain_unittest.cc
+++ b/modules/audio_processing/aec3/main_filter_update_gain_unittest.cc
@@ -68,7 +68,7 @@
RenderDelayBuffer::Create(config, 3));
AecState aec_state(config);
RenderSignalAnalyzer render_signal_analyzer(config);
- rtc::Optional<DelayEstimate> delay_estimate;
+ absl::optional<DelayEstimate> delay_estimate;
std::array<float, kFftLength> s_scratch;
std::array<float, kBlockSize> s;
FftData S;
diff --git a/modules/audio_processing/aec3/matched_filter.h b/modules/audio_processing/aec3/matched_filter.h
index 36c9cad..8add6fe3 100644
--- a/modules/audio_processing/aec3/matched_filter.h
+++ b/modules/audio_processing/aec3/matched_filter.h
@@ -15,8 +15,8 @@
#include <memory>
#include <vector>
+#include "absl/types/optional.h"
#include "api/array_view.h"
-#include "api/optional.h"
#include "modules/audio_processing/aec3/aec3_common.h"
#include "modules/audio_processing/aec3/downsampled_render_buffer.h"
#include "rtc_base/constructormagic.h"
diff --git a/modules/audio_processing/aec3/matched_filter_lag_aggregator.cc b/modules/audio_processing/aec3/matched_filter_lag_aggregator.cc
index 23cd71a..9cd2eb3 100644
--- a/modules/audio_processing/aec3/matched_filter_lag_aggregator.cc
+++ b/modules/audio_processing/aec3/matched_filter_lag_aggregator.cc
@@ -30,7 +30,7 @@
significant_candidate_found_ = false;
}
-rtc::Optional<DelayEstimate> MatchedFilterLagAggregator::Aggregate(
+absl::optional<DelayEstimate> MatchedFilterLagAggregator::Aggregate(
rtc::ArrayView<const MatchedFilter::LagEstimate> lag_estimates) {
// Choose the strongest lag estimate as the best one.
float best_accuracy = 0.f;
@@ -72,7 +72,7 @@
return DelayEstimate(DelayEstimate::Quality::kRefined, candidate);
}
}
- return rtc::nullopt;
+ return absl::nullopt;
}
} // namespace webrtc
diff --git a/modules/audio_processing/aec3/matched_filter_lag_aggregator.h b/modules/audio_processing/aec3/matched_filter_lag_aggregator.h
index 86968bd..fddcfbf 100644
--- a/modules/audio_processing/aec3/matched_filter_lag_aggregator.h
+++ b/modules/audio_processing/aec3/matched_filter_lag_aggregator.h
@@ -13,7 +13,7 @@
#include <vector>
-#include "api/optional.h"
+#include "absl/types/optional.h"
#include "modules/audio_processing/aec3/delay_estimate.h"
#include "modules/audio_processing/aec3/matched_filter.h"
#include "rtc_base/constructormagic.h"
@@ -33,7 +33,7 @@
void Reset();
// Aggregates the provided lag estimates.
- rtc::Optional<DelayEstimate> Aggregate(
+ absl::optional<DelayEstimate> Aggregate(
rtc::ArrayView<const MatchedFilter::LagEstimate> lag_estimates);
private:
diff --git a/modules/audio_processing/aec3/matched_filter_lag_aggregator_unittest.cc b/modules/audio_processing/aec3/matched_filter_lag_aggregator_unittest.cc
index 18b8829..97c7f5b 100644
--- a/modules/audio_processing/aec3/matched_filter_lag_aggregator_unittest.cc
+++ b/modules/audio_processing/aec3/matched_filter_lag_aggregator_unittest.cc
@@ -40,7 +40,7 @@
aggregator.Aggregate(lag_estimates);
}
- rtc::Optional<DelayEstimate> aggregated_lag =
+ absl::optional<DelayEstimate> aggregated_lag =
aggregator.Aggregate(lag_estimates);
EXPECT_TRUE(aggregated_lag);
EXPECT_EQ(kLag1, aggregated_lag->delay);
@@ -68,7 +68,7 @@
std::vector<MatchedFilter::LagEstimate> lag_estimates(1);
MatchedFilterLagAggregator aggregator(&data_dumper, 100);
- rtc::Optional<DelayEstimate> aggregated_lag;
+ absl::optional<DelayEstimate> aggregated_lag;
for (size_t k = 0; k < kNumLagsBeforeDetection; ++k) {
lag_estimates[0] = MatchedFilter::LagEstimate(1.f, true, 10, true);
aggregated_lag = aggregator.Aggregate(lag_estimates);
@@ -98,7 +98,7 @@
MatchedFilterLagAggregator aggregator(&data_dumper, kLag);
for (size_t k = 0; k < kNumLagsBeforeDetection * 10; ++k) {
lag_estimates[0] = MatchedFilter::LagEstimate(1.f, true, kLag, false);
- rtc::Optional<DelayEstimate> aggregated_lag =
+ absl::optional<DelayEstimate> aggregated_lag =
aggregator.Aggregate(lag_estimates);
EXPECT_FALSE(aggregated_lag);
EXPECT_EQ(kLag, aggregated_lag->delay);
@@ -114,7 +114,7 @@
ApmDataDumper data_dumper(0);
std::vector<MatchedFilter::LagEstimate> lag_estimates(1);
MatchedFilterLagAggregator aggregator(&data_dumper, std::max(kLag1, kLag2));
- rtc::Optional<DelayEstimate> aggregated_lag;
+ absl::optional<DelayEstimate> aggregated_lag;
for (size_t k = 0; k < kNumLagsBeforeDetection; ++k) {
lag_estimates[0] = MatchedFilter::LagEstimate(1.f, true, kLag1, true);
aggregated_lag = aggregator.Aggregate(lag_estimates);
diff --git a/modules/audio_processing/aec3/matched_filter_unittest.cc b/modules/audio_processing/aec3/matched_filter_unittest.cc
index e30c78c..c3c3a0d 100644
--- a/modules/audio_processing/aec3/matched_filter_unittest.cc
+++ b/modules/audio_processing/aec3/matched_filter_unittest.cc
@@ -183,7 +183,7 @@
auto lag_estimates = filter.GetLagEstimates();
// Find which lag estimate should be the most accurate.
- rtc::Optional<size_t> expected_most_accurate_lag_estimate;
+ absl::optional<size_t> expected_most_accurate_lag_estimate;
size_t alignment_shift_sub_blocks = 0;
for (size_t k = 0; k < config.delay.num_filters; ++k) {
if ((alignment_shift_sub_blocks + 3 * kWindowSizeSubBlocks / 4) *
diff --git a/modules/audio_processing/aec3/mock/mock_echo_remover.h b/modules/audio_processing/aec3/mock/mock_echo_remover.h
index 0acf139..0eb9508 100644
--- a/modules/audio_processing/aec3/mock/mock_echo_remover.h
+++ b/modules/audio_processing/aec3/mock/mock_echo_remover.h
@@ -13,7 +13,7 @@
#include <vector>
-#include "api/optional.h"
+#include "absl/types/optional.h"
#include "modules/audio_processing/aec3/echo_path_variability.h"
#include "modules/audio_processing/aec3/echo_remover.h"
#include "modules/audio_processing/aec3/render_buffer.h"
@@ -29,10 +29,10 @@
MOCK_METHOD5(ProcessCapture,
void(const EchoPathVariability& echo_path_variability,
bool capture_signal_saturation,
- const rtc::Optional<DelayEstimate>& delay_estimate,
+ const absl::optional<DelayEstimate>& delay_estimate,
RenderBuffer* render_buffer,
std::vector<std::vector<float>>* capture));
- MOCK_CONST_METHOD0(Delay, rtc::Optional<int>());
+ MOCK_CONST_METHOD0(Delay, absl::optional<int>());
MOCK_METHOD1(UpdateEchoLeakageStatus, void(bool leakage_detected));
MOCK_CONST_METHOD1(GetMetrics, void(EchoControl::Metrics* metrics));
};
diff --git a/modules/audio_processing/aec3/mock/mock_render_delay_controller.h b/modules/audio_processing/aec3/mock/mock_render_delay_controller.h
index fab2b65..776bdaa 100644
--- a/modules/audio_processing/aec3/mock/mock_render_delay_controller.h
+++ b/modules/audio_processing/aec3/mock/mock_render_delay_controller.h
@@ -11,8 +11,8 @@
#ifndef MODULES_AUDIO_PROCESSING_AEC3_MOCK_MOCK_RENDER_DELAY_CONTROLLER_H_
#define MODULES_AUDIO_PROCESSING_AEC3_MOCK_MOCK_RENDER_DELAY_CONTROLLER_H_
+#include "absl/types/optional.h"
#include "api/array_view.h"
-#include "api/optional.h"
#include "modules/audio_processing/aec3/downsampled_render_buffer.h"
#include "modules/audio_processing/aec3/render_delay_controller.h"
#include "test/gmock.h"
@@ -26,12 +26,12 @@
MOCK_METHOD0(Reset, void());
MOCK_METHOD0(LogRenderCall, void());
- MOCK_METHOD4(
- GetDelay,
- rtc::Optional<DelayEstimate>(const DownsampledRenderBuffer& render_buffer,
- size_t render_delay_buffer_delay,
- const rtc::Optional<int>& echo_remover_delay,
- rtc::ArrayView<const float> capture));
+ MOCK_METHOD4(GetDelay,
+ absl::optional<DelayEstimate>(
+ const DownsampledRenderBuffer& render_buffer,
+ size_t render_delay_buffer_delay,
+ const absl::optional<int>& echo_remover_delay,
+ rtc::ArrayView<const float> capture));
};
} // namespace test
diff --git a/modules/audio_processing/aec3/render_delay_buffer.cc b/modules/audio_processing/aec3/render_delay_buffer.cc
index b01593b..37a2378 100644
--- a/modules/audio_processing/aec3/render_delay_buffer.cc
+++ b/modules/audio_processing/aec3/render_delay_buffer.cc
@@ -77,8 +77,8 @@
MatrixBuffer blocks_;
VectorBuffer spectra_;
FftBuffer ffts_;
- rtc::Optional<size_t> delay_;
- rtc::Optional<int> internal_delay_;
+ absl::optional<size_t> delay_;
+ absl::optional<int> internal_delay_;
RenderBuffer echo_remover_buffer_;
DownsampledRenderBuffer low_rate_;
Decimator render_decimator_;
@@ -93,7 +93,7 @@
size_t render_call_counter_ = 0;
bool render_activity_ = false;
size_t render_activity_counter_ = 0;
- rtc::Optional<size_t> external_audio_buffer_delay_;
+ absl::optional<size_t> external_audio_buffer_delay_;
bool external_delay_verified_after_reset_ = false;
int LowRateBufferOffset() const { return DelayEstimatorOffset(config_) >> 1; }
@@ -120,7 +120,7 @@
}
// Increases the read indices for the render buffers.
-void IncreaseReadIndices(const rtc::Optional<int>& delay,
+void IncreaseReadIndices(const absl::optional<int>& delay,
int sub_block_size,
MatrixBuffer* blocks,
VectorBuffer* spectra,
@@ -147,7 +147,7 @@
// Checks for a render buffer underrun. If the delay is not specified, only the
// low rate buffer underrun is counted as the delay offset for the other buffers
// is unknown.
-bool RenderUnderrun(const rtc::Optional<int>& delay,
+bool RenderUnderrun(const absl::optional<int>& delay,
const MatrixBuffer& b,
const DownsampledRenderBuffer& l) {
return l.read == l.write || (delay && b.read == b.write);
@@ -243,8 +243,8 @@
ApplyDelay(config_.delay.default_delay);
// Unset the delays which are set by SetDelay.
- delay_ = rtc::nullopt;
- internal_delay_ = rtc::nullopt;
+ delay_ = absl::nullopt;
+ internal_delay_ = absl::nullopt;
}
}
diff --git a/modules/audio_processing/aec3/render_delay_buffer.h b/modules/audio_processing/aec3/render_delay_buffer.h
index e361628..a6d6874 100644
--- a/modules/audio_processing/aec3/render_delay_buffer.h
+++ b/modules/audio_processing/aec3/render_delay_buffer.h
@@ -15,9 +15,9 @@
#include <array>
#include <vector>
+#include "absl/types/optional.h"
#include "api/array_view.h"
#include "api/audio/echo_canceller3_config.h"
-#include "api/optional.h"
#include "modules/audio_processing/aec3/aec3_common.h"
#include "modules/audio_processing/aec3/downsampled_render_buffer.h"
#include "modules/audio_processing/aec3/fft_data.h"
diff --git a/modules/audio_processing/aec3/render_delay_controller.cc b/modules/audio_processing/aec3/render_delay_controller.cc
index 7a40c46..8adf5f5 100644
--- a/modules/audio_processing/aec3/render_delay_controller.cc
+++ b/modules/audio_processing/aec3/render_delay_controller.cc
@@ -50,10 +50,10 @@
~RenderDelayControllerImpl() override;
void Reset() override;
void LogRenderCall() override;
- rtc::Optional<DelayEstimate> GetDelay(
+ absl::optional<DelayEstimate> GetDelay(
const DownsampledRenderBuffer& render_buffer,
size_t render_delay_buffer_delay,
- const rtc::Optional<int>& echo_remover_delay,
+ const absl::optional<int>& echo_remover_delay,
rtc::ArrayView<const float> capture) override;
private:
@@ -63,14 +63,14 @@
const int hysteresis_limit_1_blocks_;
const int hysteresis_limit_2_blocks_;
const int skew_hysteresis_blocks_;
- rtc::Optional<DelayEstimate> delay_;
+ absl::optional<DelayEstimate> delay_;
EchoPathDelayEstimator delay_estimator_;
std::vector<float> delay_buf_;
int delay_buf_index_ = 0;
RenderDelayControllerMetrics metrics_;
SkewEstimator skew_estimator_;
- rtc::Optional<DelayEstimate> delay_samples_;
- rtc::Optional<int> skew_;
+ absl::optional<DelayEstimate> delay_samples_;
+ absl::optional<int> skew_;
int previous_offset_blocks_ = 0;
int skew_shift_reporting_counter_ = 0;
size_t capture_call_counter_ = 0;
@@ -80,7 +80,7 @@
};
DelayEstimate ComputeBufferDelay(
- const rtc::Optional<DelayEstimate>& current_delay,
+ const absl::optional<DelayEstimate>& current_delay,
int delay_headroom_blocks,
int hysteresis_limit_1_blocks,
int hysteresis_limit_2_blocks,
@@ -142,9 +142,9 @@
RenderDelayControllerImpl::~RenderDelayControllerImpl() = default;
void RenderDelayControllerImpl::Reset() {
- delay_ = rtc::nullopt;
- delay_samples_ = rtc::nullopt;
- skew_ = rtc::nullopt;
+ delay_ = absl::nullopt;
+ delay_samples_ = absl::nullopt;
+ skew_ = absl::nullopt;
previous_offset_blocks_ = 0;
std::fill(delay_buf_.begin(), delay_buf_.end(), 0.f);
delay_estimator_.Reset(false);
@@ -157,10 +157,10 @@
skew_estimator_.LogRenderCall();
}
-rtc::Optional<DelayEstimate> RenderDelayControllerImpl::GetDelay(
+absl::optional<DelayEstimate> RenderDelayControllerImpl::GetDelay(
const DownsampledRenderBuffer& render_buffer,
size_t render_delay_buffer_delay,
- const rtc::Optional<int>& echo_remover_delay,
+ const absl::optional<int>& echo_remover_delay,
rtc::ArrayView<const float> capture) {
RTC_DCHECK_EQ(kBlockSize, capture.size());
++capture_call_counter_;
@@ -185,7 +185,7 @@
delay_buf_index_ = (delay_buf_index_ + kBlockSize) % delay_buf_.size();
// Compute the latest skew update.
- rtc::Optional<int> skew = skew_estimator_.GetSkewFromCapture();
+ absl::optional<int> skew = skew_estimator_.GetSkewFromCapture();
if (delay_samples) {
// TODO(peah): Refactor the rest of the code to assume a kRefined estimate
@@ -241,11 +241,11 @@
// Log any changes in the skew.
skew_shift_reporting_counter_ =
std::max(0, skew_shift_reporting_counter_ - 1);
- rtc::Optional<int> skew_shift =
+ absl::optional<int> skew_shift =
skew_shift_reporting_counter_ == 0 &&
previous_offset_blocks_ != offset_blocks
- ? rtc::Optional<int>(offset_blocks - previous_offset_blocks_)
- : rtc::nullopt;
+ ? absl::optional<int>(offset_blocks - previous_offset_blocks_)
+ : absl::nullopt;
previous_offset_blocks_ = offset_blocks;
if (skew_shift) {
RTC_LOG(LS_WARNING) << "API call skew shift of " << *skew_shift
@@ -261,8 +261,8 @@
hysteresis_limit_2_blocks_, offset_blocks, *delay_samples_);
}
- metrics_.Update(delay_samples_ ? rtc::Optional<size_t>(delay_samples_->delay)
- : rtc::nullopt,
+ metrics_.Update(delay_samples_ ? absl::optional<size_t>(delay_samples_->delay)
+ : absl::nullopt,
delay_ ? delay_->delay : 0, skew_shift);
data_dumper_->DumpRaw("aec3_render_delay_controller_delay",
diff --git a/modules/audio_processing/aec3/render_delay_controller.h b/modules/audio_processing/aec3/render_delay_controller.h
index 1e1df0d..ddd9548 100644
--- a/modules/audio_processing/aec3/render_delay_controller.h
+++ b/modules/audio_processing/aec3/render_delay_controller.h
@@ -11,9 +11,9 @@
#ifndef MODULES_AUDIO_PROCESSING_AEC3_RENDER_DELAY_CONTROLLER_H_
#define MODULES_AUDIO_PROCESSING_AEC3_RENDER_DELAY_CONTROLLER_H_
+#include "absl/types/optional.h"
#include "api/array_view.h"
#include "api/audio/echo_canceller3_config.h"
-#include "api/optional.h"
#include "modules/audio_processing/aec3/delay_estimate.h"
#include "modules/audio_processing/aec3/downsampled_render_buffer.h"
#include "modules/audio_processing/aec3/render_delay_buffer.h"
@@ -36,10 +36,10 @@
virtual void LogRenderCall() = 0;
// Aligns the render buffer content with the capture signal.
- virtual rtc::Optional<DelayEstimate> GetDelay(
+ virtual absl::optional<DelayEstimate> GetDelay(
const DownsampledRenderBuffer& render_buffer,
size_t render_delay_buffer_delay,
- const rtc::Optional<int>& echo_remover_delay,
+ const absl::optional<int>& echo_remover_delay,
rtc::ArrayView<const float> capture) = 0;
};
} // namespace webrtc
diff --git a/modules/audio_processing/aec3/render_delay_controller_metrics.cc b/modules/audio_processing/aec3/render_delay_controller_metrics.cc
index 2da2227..09db339 100644
--- a/modules/audio_processing/aec3/render_delay_controller_metrics.cc
+++ b/modules/audio_processing/aec3/render_delay_controller_metrics.cc
@@ -43,9 +43,9 @@
RenderDelayControllerMetrics::RenderDelayControllerMetrics() = default;
void RenderDelayControllerMetrics::Update(
- rtc::Optional<size_t> delay_samples,
+ absl::optional<size_t> delay_samples,
size_t buffer_delay_blocks,
- rtc::Optional<int> skew_shift_blocks) {
+ absl::optional<int> skew_shift_blocks) {
++call_counter_;
if (!initial_update) {
diff --git a/modules/audio_processing/aec3/render_delay_controller_metrics.h b/modules/audio_processing/aec3/render_delay_controller_metrics.h
index 8c8845e..1cfe899 100644
--- a/modules/audio_processing/aec3/render_delay_controller_metrics.h
+++ b/modules/audio_processing/aec3/render_delay_controller_metrics.h
@@ -11,7 +11,7 @@
#ifndef MODULES_AUDIO_PROCESSING_AEC3_RENDER_DELAY_CONTROLLER_METRICS_H_
#define MODULES_AUDIO_PROCESSING_AEC3_RENDER_DELAY_CONTROLLER_METRICS_H_
-#include "api/optional.h"
+#include "absl/types/optional.h"
#include "rtc_base/constructormagic.h"
namespace webrtc {
@@ -22,9 +22,9 @@
RenderDelayControllerMetrics();
// Updates the metric with new data.
- void Update(rtc::Optional<size_t> delay_samples,
+ void Update(absl::optional<size_t> delay_samples,
size_t buffer_delay_blocks,
- rtc::Optional<int> skew_shift_blocks);
+ absl::optional<int> skew_shift_blocks);
// Returns true if the metrics have just been reported, otherwise false.
bool MetricsReported() { return metrics_reported_; }
diff --git a/modules/audio_processing/aec3/render_delay_controller_metrics_unittest.cc b/modules/audio_processing/aec3/render_delay_controller_metrics_unittest.cc
index 1129f49..e867de4 100644
--- a/modules/audio_processing/aec3/render_delay_controller_metrics_unittest.cc
+++ b/modules/audio_processing/aec3/render_delay_controller_metrics_unittest.cc
@@ -9,7 +9,7 @@
*/
#include "modules/audio_processing/aec3/render_delay_controller_metrics.h"
-#include "api/optional.h"
+#include "absl/types/optional.h"
#include "modules/audio_processing/aec3/aec3_common.h"
#include "test/gtest.h"
@@ -22,10 +22,10 @@
for (int j = 0; j < 3; ++j) {
for (int k = 0; k < kMetricsReportingIntervalBlocks - 1; ++k) {
- metrics.Update(rtc::nullopt, 0, rtc::nullopt);
+ metrics.Update(absl::nullopt, 0, absl::nullopt);
EXPECT_FALSE(metrics.MetricsReported());
}
- metrics.Update(rtc::nullopt, 0, rtc::nullopt);
+ metrics.Update(absl::nullopt, 0, absl::nullopt);
EXPECT_TRUE(metrics.MetricsReported());
}
}
diff --git a/modules/audio_processing/aec3/render_delay_controller_unittest.cc b/modules/audio_processing/aec3/render_delay_controller_unittest.cc
index 2c9bbef..98d5b25 100644
--- a/modules/audio_processing/aec3/render_delay_controller_unittest.cc
+++ b/modules/audio_processing/aec3/render_delay_controller_unittest.cc
@@ -48,7 +48,7 @@
TEST(RenderDelayController, NoRenderSignal) {
std::vector<float> block(kBlockSize, 0.f);
EchoCanceller3Config config;
- rtc::Optional<int> echo_remover_delay_;
+ absl::optional<int> echo_remover_delay_;
for (size_t num_matched_filters = 4; num_matched_filters == 10;
num_matched_filters++) {
for (auto down_sampling_factor : kDownSamplingFactors) {
@@ -75,8 +75,8 @@
// Verifies the basic API call sequence.
TEST(RenderDelayController, BasicApiCalls) {
std::vector<float> capture_block(kBlockSize, 0.f);
- rtc::Optional<DelayEstimate> delay_blocks;
- rtc::Optional<int> echo_remover_delay;
+ absl::optional<DelayEstimate> delay_blocks;
+ absl::optional<int> echo_remover_delay;
for (size_t num_matched_filters = 4; num_matched_filters == 10;
num_matched_filters++) {
for (auto down_sampling_factor : kDownSamplingFactors) {
@@ -111,7 +111,7 @@
// simple timeshifts between the signals.
TEST(RenderDelayController, Alignment) {
Random random_generator(42U);
- rtc::Optional<int> echo_remover_delay;
+ absl::optional<int> echo_remover_delay;
std::vector<float> capture_block(kBlockSize, 0.f);
for (size_t num_matched_filters = 4; num_matched_filters == 10;
num_matched_filters++) {
@@ -125,7 +125,7 @@
NumBandsForRate(rate), std::vector<float>(kBlockSize, 0.f));
for (size_t delay_samples : {15, 50, 150, 200, 800, 4000}) {
- rtc::Optional<DelayEstimate> delay_blocks;
+ absl::optional<DelayEstimate> delay_blocks;
SCOPED_TRACE(ProduceDebugText(rate, delay_samples));
std::unique_ptr<RenderDelayBuffer> render_delay_buffer(
RenderDelayBuffer::Create(config, NumBandsForRate(rate)));
@@ -162,7 +162,7 @@
// delays.
TEST(RenderDelayController, NonCausalAlignment) {
Random random_generator(42U);
- rtc::Optional<int> echo_remover_delay;
+ absl::optional<int> echo_remover_delay;
for (size_t num_matched_filters = 4; num_matched_filters == 10;
num_matched_filters++) {
for (auto down_sampling_factor : kDownSamplingFactors) {
@@ -176,7 +176,7 @@
NumBandsForRate(rate), std::vector<float>(kBlockSize, 0.f));
for (int delay_samples : {-15, -50, -150, -200}) {
- rtc::Optional<DelayEstimate> delay_blocks;
+ absl::optional<DelayEstimate> delay_blocks;
SCOPED_TRACE(ProduceDebugText(rate, -delay_samples));
std::unique_ptr<RenderDelayBuffer> render_delay_buffer(
RenderDelayBuffer::Create(config, NumBandsForRate(rate)));
@@ -208,7 +208,7 @@
// simple timeshifts between the signals when there is jitter in the API calls.
TEST(RenderDelayController, AlignmentWithJitter) {
Random random_generator(42U);
- rtc::Optional<int> echo_remover_delay;
+ absl::optional<int> echo_remover_delay;
std::vector<float> capture_block(kBlockSize, 0.f);
for (size_t num_matched_filters = 4; num_matched_filters == 10;
num_matched_filters++) {
@@ -220,7 +220,7 @@
std::vector<std::vector<float>> render_block(
NumBandsForRate(rate), std::vector<float>(kBlockSize, 0.f));
for (size_t delay_samples : {15, 50, 300, 800}) {
- rtc::Optional<DelayEstimate> delay_blocks;
+ absl::optional<DelayEstimate> delay_blocks;
SCOPED_TRACE(ProduceDebugText(rate, delay_samples));
std::unique_ptr<RenderDelayBuffer> render_delay_buffer(
RenderDelayBuffer::Create(config, NumBandsForRate(rate)));
@@ -296,7 +296,7 @@
TEST(RenderDelayController, WrongCaptureSize) {
std::vector<float> block(kBlockSize - 1, 0.f);
EchoCanceller3Config config;
- rtc::Optional<int> echo_remover_delay;
+ absl::optional<int> echo_remover_delay;
for (auto rate : {8000, 16000, 32000, 48000}) {
SCOPED_TRACE(ProduceDebugText(rate));
std::unique_ptr<RenderDelayBuffer> render_delay_buffer(
diff --git a/modules/audio_processing/aec3/render_signal_analyzer.cc b/modules/audio_processing/aec3/render_signal_analyzer.cc
index 10b68b0..50c34ce 100644
--- a/modules/audio_processing/aec3/render_signal_analyzer.cc
+++ b/modules/audio_processing/aec3/render_signal_analyzer.cc
@@ -23,7 +23,7 @@
// Identifies local bands with narrow characteristics.
void IdentifySmallNarrowBandRegions(
const RenderBuffer& render_buffer,
- const rtc::Optional<size_t>& delay_partitions,
+ const absl::optional<size_t>& delay_partitions,
std::array<size_t, kFftLengthBy2 - 1>* narrow_band_counters) {
if (!delay_partitions) {
narrow_band_counters->fill(0);
@@ -43,7 +43,7 @@
// Identifies whether the signal has a single strong narrow-band component.
void IdentifyStrongNarrowBandComponent(const RenderBuffer& render_buffer,
int strong_peak_freeze_duration,
- rtc::Optional<int>* narrow_peak_band,
+ absl::optional<int>* narrow_peak_band,
size_t* narrow_peak_counter) {
const auto X2_latest = render_buffer.Spectrum(0);
@@ -83,7 +83,7 @@
if (*narrow_peak_band &&
++(*narrow_peak_counter) >
static_cast<size_t>(strong_peak_freeze_duration)) {
- *narrow_peak_band = rtc::nullopt;
+ *narrow_peak_band = absl::nullopt;
}
}
}
@@ -98,7 +98,7 @@
void RenderSignalAnalyzer::Update(
const RenderBuffer& render_buffer,
- const rtc::Optional<size_t>& delay_partitions) {
+ const absl::optional<size_t>& delay_partitions) {
// Identify bands of narrow nature.
IdentifySmallNarrowBandRegions(render_buffer, delay_partitions,
&narrow_band_counters_);
diff --git a/modules/audio_processing/aec3/render_signal_analyzer.h b/modules/audio_processing/aec3/render_signal_analyzer.h
index 8cd2172..c603c92 100644
--- a/modules/audio_processing/aec3/render_signal_analyzer.h
+++ b/modules/audio_processing/aec3/render_signal_analyzer.h
@@ -14,8 +14,8 @@
#include <array>
#include <memory>
+#include "absl/types/optional.h"
#include "api/audio/echo_canceller3_config.h"
-#include "api/optional.h"
#include "modules/audio_processing/aec3/aec3_common.h"
#include "modules/audio_processing/aec3/render_buffer.h"
#include "rtc_base/constructormagic.h"
@@ -30,7 +30,7 @@
// Updates the render signal analysis with the most recent render signal.
void Update(const RenderBuffer& render_buffer,
- const rtc::Optional<size_t>& delay_partitions);
+ const absl::optional<size_t>& delay_partitions);
// Returns true if the render signal is poorly exciting.
bool PoorSignalExcitation() const {
@@ -44,12 +44,12 @@
void MaskRegionsAroundNarrowBands(
std::array<float, kFftLengthBy2Plus1>* v) const;
- rtc::Optional<int> NarrowPeakBand() const { return narrow_peak_band_; }
+ absl::optional<int> NarrowPeakBand() const { return narrow_peak_band_; }
private:
const int strong_peak_freeze_duration_;
std::array<size_t, kFftLengthBy2 - 1> narrow_band_counters_;
- rtc::Optional<int> narrow_peak_band_;
+ absl::optional<int> narrow_peak_band_;
size_t narrow_peak_counter_;
RTC_DISALLOW_COPY_AND_ASSIGN(RenderSignalAnalyzer);
diff --git a/modules/audio_processing/aec3/render_signal_analyzer_unittest.cc b/modules/audio_processing/aec3/render_signal_analyzer_unittest.cc
index 5191874..f9b1955 100644
--- a/modules/audio_processing/aec3/render_signal_analyzer_unittest.cc
+++ b/modules/audio_processing/aec3/render_signal_analyzer_unittest.cc
@@ -73,7 +73,7 @@
render_delay_buffer->PrepareCaptureProcessing();
analyzer.Update(*render_delay_buffer->GetRenderBuffer(),
- rtc::Optional<size_t>(0));
+ absl::optional<size_t>(0));
}
mask.fill(1.f);
@@ -112,7 +112,7 @@
render_delay_buffer->PrepareCaptureProcessing();
analyzer.Update(*render_delay_buffer->GetRenderBuffer(),
- known_delay ? rtc::Optional<size_t>(0) : rtc::nullopt);
+ known_delay ? absl::optional<size_t>(0) : absl::nullopt);
}
};
diff --git a/modules/audio_processing/aec3/residual_echo_estimator_unittest.cc b/modules/audio_processing/aec3/residual_echo_estimator_unittest.cc
index 7f9ad8d..30f3ddc 100644
--- a/modules/audio_processing/aec3/residual_echo_estimator_unittest.cc
+++ b/modules/audio_processing/aec3/residual_echo_estimator_unittest.cc
@@ -63,7 +63,7 @@
Random random_generator(42U);
std::array<float, kBlockSize> s;
Aec3Fft fft;
- rtc::Optional<DelayEstimate> delay_estimate;
+ absl::optional<DelayEstimate> delay_estimate;
for (auto& H2_k : H2) {
H2_k.fill(0.01f);
diff --git a/modules/audio_processing/aec3/skew_estimator.cc b/modules/audio_processing/aec3/skew_estimator.cc
index 5a453a0..310e4e9 100644
--- a/modules/audio_processing/aec3/skew_estimator.cc
+++ b/modules/audio_processing/aec3/skew_estimator.cc
@@ -28,7 +28,7 @@
std::fill(skew_history_.begin(), skew_history_.end(), 0);
}
-rtc::Optional<int> SkewEstimator::GetSkewFromCapture() {
+absl::optional<int> SkewEstimator::GetSkewFromCapture() {
--skew_;
skew_sum_ += skew_ - skew_history_[next_index_];
@@ -40,7 +40,7 @@
const int bias = static_cast<int>(skew_history_.size()) >> 1;
const int average = (skew_sum_ + bias) >> skew_history_size_log2_;
- return sufficient_skew_stored_ ? rtc::Optional<int>(average) : rtc::nullopt;
+ return sufficient_skew_stored_ ? absl::optional<int>(average) : absl::nullopt;
}
} // namespace webrtc
diff --git a/modules/audio_processing/aec3/skew_estimator.h b/modules/audio_processing/aec3/skew_estimator.h
index 2afcd76..ff25260 100644
--- a/modules/audio_processing/aec3/skew_estimator.h
+++ b/modules/audio_processing/aec3/skew_estimator.h
@@ -13,7 +13,7 @@
#include <vector>
-#include "api/optional.h"
+#include "absl/types/optional.h"
#include "rtc_base/constructormagic.h"
namespace webrtc {
@@ -32,7 +32,7 @@
// Updates and computes the skew at a capture call. Returns an optional which
// is non-null if a reliable skew has been found.
- rtc::Optional<int> GetSkewFromCapture();
+ absl::optional<int> GetSkewFromCapture();
private:
const int skew_history_size_log2_;
diff --git a/modules/audio_processing/aec3/skew_estimator_unittest.cc b/modules/audio_processing/aec3/skew_estimator_unittest.cc
index 168470a..3e8c13e 100644
--- a/modules/audio_processing/aec3/skew_estimator_unittest.cc
+++ b/modules/audio_processing/aec3/skew_estimator_unittest.cc
@@ -30,7 +30,7 @@
estimator.LogRenderCall();
- rtc::Optional<int> skew;
+ absl::optional<int> skew;
for (int k = 0; k < kNumSkews; ++k) {
estimator.LogRenderCall();
skew = estimator.GetSkewFromCapture();
@@ -63,7 +63,7 @@
estimator.LogRenderCall();
- rtc::Optional<int> skew;
+ absl::optional<int> skew;
for (int k = 0; k < kNumSkews; ++k) {
estimator.LogRenderCall();
skew = estimator.GetSkewFromCapture();
@@ -85,7 +85,7 @@
EXPECT_FALSE(skew);
}
- rtc::Optional<int> skew;
+ absl::optional<int> skew;
skew = estimator.GetSkewFromCapture();
for (int k = 0; k < kNumSkews; ++k) {
@@ -128,7 +128,7 @@
SkewEstimator estimator(kNumSkewsLog2);
- rtc::Optional<int> skew;
+ absl::optional<int> skew;
for (int k = 0; k < kNumSkews; ++k) {
if (k == kNumSkews - 1) {
// Reverse call order once.
diff --git a/modules/audio_processing/aec3/subtractor_unittest.cc b/modules/audio_processing/aec3/subtractor_unittest.cc
index 097d7e8..3c896ee 100644
--- a/modules/audio_processing/aec3/subtractor_unittest.cc
+++ b/modules/audio_processing/aec3/subtractor_unittest.cc
@@ -33,7 +33,7 @@
config.filter.main.length_blocks = config.filter.shadow.length_blocks =
filter_length_blocks;
Subtractor subtractor(config, &data_dumper, DetectOptimization());
- rtc::Optional<DelayEstimate> delay_estimate;
+ absl::optional<DelayEstimate> delay_estimate;
std::vector<std::vector<float>> x(3, std::vector<float>(kBlockSize, 0.f));
std::vector<float> y(kBlockSize, 0.f);
std::array<float, kBlockSize> x_old;
diff --git a/modules/audio_processing/aec3/suppression_gain.cc b/modules/audio_processing/aec3/suppression_gain.cc
index 1328601..2098fc2 100644
--- a/modules/audio_processing/aec3/suppression_gain.cc
+++ b/modules/audio_processing/aec3/suppression_gain.cc
@@ -54,7 +54,7 @@
// Computes the gain to apply for the bands beyond the first band.
float UpperBandsGain(
- const rtc::Optional<int>& narrow_peak_band,
+ const absl::optional<int>& narrow_peak_band,
bool saturated_echo,
const std::vector<std::vector<float>>& render,
const std::array<float, kFftLengthBy2Plus1>& low_band_gain) {
@@ -415,7 +415,7 @@
// Compute gain for the lower band.
bool low_noise_render = low_render_detector_.Detect(render);
- const rtc::Optional<int> narrow_peak_band =
+ const absl::optional<int> narrow_peak_band =
render_signal_analyzer.NarrowPeakBand();
LowerBandGain(low_noise_render, aec_state, nearend_spectrum, echo_spectrum,
comfort_noise_spectrum, low_band_gain);
diff --git a/modules/audio_processing/aec3/suppression_gain_unittest.cc b/modules/audio_processing/aec3/suppression_gain_unittest.cc
index 128c61e..7e5ee9f 100644
--- a/modules/audio_processing/aec3/suppression_gain_unittest.cc
+++ b/modules/audio_processing/aec3/suppression_gain_unittest.cc
@@ -78,7 +78,7 @@
Subtractor subtractor(config, &data_dumper, DetectOptimization());
std::unique_ptr<RenderDelayBuffer> render_delay_buffer(
RenderDelayBuffer::Create(config, 3));
- rtc::Optional<DelayEstimate> delay_estimate;
+ absl::optional<DelayEstimate> delay_estimate;
// Ensure that a strong noise is detected to mask any echoes.
E2.fill(10.f);
diff --git a/modules/audio_processing/audio_processing_impl.cc b/modules/audio_processing/audio_processing_impl.cc
index 71fefe4..2c36a7c 100644
--- a/modules/audio_processing/audio_processing_impl.cc
+++ b/modules/audio_processing/audio_processing_impl.cc
@@ -1677,15 +1677,15 @@
Error::kNoError) {
if (metrics.divergent_filter_fraction != -1.0f) {
stats.divergent_filter_fraction =
- rtc::Optional<double>(metrics.divergent_filter_fraction);
+ absl::optional<double>(metrics.divergent_filter_fraction);
}
if (metrics.echo_return_loss.instant != -100) {
stats.echo_return_loss =
- rtc::Optional<double>(metrics.echo_return_loss.instant);
+ absl::optional<double>(metrics.echo_return_loss.instant);
}
if (metrics.echo_return_loss_enhancement.instant != -100) {
- stats.echo_return_loss_enhancement =
- rtc::Optional<double>(metrics.echo_return_loss_enhancement.instant);
+ stats.echo_return_loss_enhancement = absl::optional<double>(
+ metrics.echo_return_loss_enhancement.instant);
}
}
if (config_.residual_echo_detector.enabled) {
@@ -1702,10 +1702,10 @@
&delay_median, &delay_std, &fraction_poor_delays) ==
Error::kNoError) {
if (delay_median >= 0) {
- stats.delay_median_ms = rtc::Optional<int32_t>(delay_median);
+ stats.delay_median_ms = absl::optional<int32_t>(delay_median);
}
if (delay_std >= 0) {
- stats.delay_standard_deviation_ms = rtc::Optional<int32_t>(delay_std);
+ stats.delay_standard_deviation_ms = absl::optional<int32_t>(delay_std);
}
}
}
diff --git a/modules/audio_processing/beamformer/array_util.cc b/modules/audio_processing/beamformer/array_util.cc
index e853559..0e461e9 100644
--- a/modules/audio_processing/beamformer/array_util.cc
+++ b/modules/audio_processing/beamformer/array_util.cc
@@ -56,7 +56,7 @@
return std::abs(DotProduct(a, b)) < kMaxDotProduct;
}
-rtc::Optional<Point> GetDirectionIfLinear(
+absl::optional<Point> GetDirectionIfLinear(
const std::vector<Point>& array_geometry) {
RTC_DCHECK_GT(array_geometry.size(), 1);
const Point first_pair_direction =
@@ -65,13 +65,13 @@
const Point pair_direction =
PairDirection(array_geometry[i - 1], array_geometry[i]);
if (!AreParallel(first_pair_direction, pair_direction)) {
- return rtc::nullopt;
+ return absl::nullopt;
}
}
return first_pair_direction;
}
-rtc::Optional<Point> GetNormalIfPlanar(
+absl::optional<Point> GetNormalIfPlanar(
const std::vector<Point>& array_geometry) {
RTC_DCHECK_GT(array_geometry.size(), 1);
const Point first_pair_direction =
@@ -86,30 +86,30 @@
}
}
if (is_linear) {
- return rtc::nullopt;
+ return absl::nullopt;
}
const Point normal_direction =
CrossProduct(first_pair_direction, pair_direction);
for (; i < array_geometry.size(); ++i) {
pair_direction = PairDirection(array_geometry[i - 1], array_geometry[i]);
if (!ArePerpendicular(normal_direction, pair_direction)) {
- return rtc::nullopt;
+ return absl::nullopt;
}
}
return normal_direction;
}
-rtc::Optional<Point> GetArrayNormalIfExists(
+absl::optional<Point> GetArrayNormalIfExists(
const std::vector<Point>& array_geometry) {
- const rtc::Optional<Point> direction = GetDirectionIfLinear(array_geometry);
+ const absl::optional<Point> direction = GetDirectionIfLinear(array_geometry);
if (direction) {
return Point(direction->y(), -direction->x(), 0.f);
}
- const rtc::Optional<Point> normal = GetNormalIfPlanar(array_geometry);
+ const absl::optional<Point> normal = GetNormalIfPlanar(array_geometry);
if (normal && normal->z() < kMaxDotProduct) {
return normal;
}
- return rtc::nullopt;
+ return absl::nullopt;
}
Point AzimuthToPoint(float azimuth) {
diff --git a/modules/audio_processing/beamformer/array_util.h b/modules/audio_processing/beamformer/array_util.h
index f234929..8e69f81 100644
--- a/modules/audio_processing/beamformer/array_util.h
+++ b/modules/audio_processing/beamformer/array_util.h
@@ -14,7 +14,7 @@
#include <cmath>
#include <vector>
-#include "api/optional.h"
+#include "absl/types/optional.h"
namespace webrtc {
@@ -59,16 +59,16 @@
// If the given array geometry is linear it returns the direction without
// normalizing.
-rtc::Optional<Point> GetDirectionIfLinear(
+absl::optional<Point> GetDirectionIfLinear(
const std::vector<Point>& array_geometry);
// If the given array geometry is planar it returns the normal without
// normalizing.
-rtc::Optional<Point> GetNormalIfPlanar(
+absl::optional<Point> GetNormalIfPlanar(
const std::vector<Point>& array_geometry);
// Returns the normal of an array if it has one and it is in the xy-plane.
-rtc::Optional<Point> GetArrayNormalIfExists(
+absl::optional<Point> GetArrayNormalIfExists(
const std::vector<Point>& array_geometry);
// The resulting Point will be in the xy-plane.
diff --git a/modules/audio_processing/beamformer/nonlinear_beamformer.h b/modules/audio_processing/beamformer/nonlinear_beamformer.h
index 5b79dc4..9ae28ed 100644
--- a/modules/audio_processing/beamformer/nonlinear_beamformer.h
+++ b/modules/audio_processing/beamformer/nonlinear_beamformer.h
@@ -164,7 +164,7 @@
const std::vector<Point> array_geometry_;
// The normal direction of the array if it has one and it is in the xy-plane.
- const rtc::Optional<Point> array_normal_;
+ const absl::optional<Point> array_normal_;
// Minimum spacing between microphone pairs.
const float min_mic_spacing_;
diff --git a/modules/audio_processing/echo_detector/circular_buffer.cc b/modules/audio_processing/echo_detector/circular_buffer.cc
index 0c6cc8a..a6d10ed 100644
--- a/modules/audio_processing/echo_detector/circular_buffer.cc
+++ b/modules/audio_processing/echo_detector/circular_buffer.cc
@@ -28,9 +28,9 @@
RTC_DCHECK_LE(nr_elements_in_buffer_, buffer_.size());
}
-rtc::Optional<float> CircularBuffer::Pop() {
+absl::optional<float> CircularBuffer::Pop() {
if (nr_elements_in_buffer_ == 0) {
- return rtc::nullopt;
+ return absl::nullopt;
}
const size_t index =
(buffer_.size() + next_insertion_index_ - nr_elements_in_buffer_) %
diff --git a/modules/audio_processing/echo_detector/circular_buffer.h b/modules/audio_processing/echo_detector/circular_buffer.h
index 53d4afb..9f5cdfa 100644
--- a/modules/audio_processing/echo_detector/circular_buffer.h
+++ b/modules/audio_processing/echo_detector/circular_buffer.h
@@ -13,7 +13,7 @@
#include <vector>
-#include "api/optional.h"
+#include "absl/types/optional.h"
namespace webrtc {
@@ -24,7 +24,7 @@
~CircularBuffer();
void Push(float value);
- rtc::Optional<float> Pop();
+ absl::optional<float> Pop();
size_t Size() const { return nr_elements_in_buffer_; }
// This function fills the buffer with zeros, but does not change its size.
void Clear();
diff --git a/modules/audio_processing/echo_detector/circular_buffer_unittest.cc b/modules/audio_processing/echo_detector/circular_buffer_unittest.cc
index 657bd05..0fa2a2b 100644
--- a/modules/audio_processing/echo_detector/circular_buffer_unittest.cc
+++ b/modules/audio_processing/echo_detector/circular_buffer_unittest.cc
@@ -46,7 +46,7 @@
TEST(CircularBufferTests, ReadFromEmpty) {
CircularBuffer test_buffer(3);
- EXPECT_EQ(rtc::nullopt, test_buffer.Pop());
+ EXPECT_EQ(absl::nullopt, test_buffer.Pop());
}
} // namespace webrtc
diff --git a/modules/audio_processing/gain_control_impl.cc b/modules/audio_processing/gain_control_impl.cc
index e550ebb..8be261c 100644
--- a/modules/audio_processing/gain_control_impl.cc
+++ b/modules/audio_processing/gain_control_impl.cc
@@ -10,7 +10,7 @@
#include "modules/audio_processing/gain_control_impl.h"
-#include "api/optional.h"
+#include "absl/types/optional.h"
#include "modules/audio_processing/agc/legacy/gain_control.h"
#include "modules/audio_processing/audio_buffer.h"
#include "modules/audio_processing/logging/apm_data_dumper.h"
@@ -80,7 +80,7 @@
Handle* state_;
// TODO(peah): Remove the optional once the initialization is moved into the
// ctor.
- rtc::Optional<int> capture_level_;
+ absl::optional<int> capture_level_;
RTC_DISALLOW_COPY_AND_ASSIGN(GainController);
};
diff --git a/modules/audio_processing/gain_control_impl.h b/modules/audio_processing/gain_control_impl.h
index 2674506..959422f 100644
--- a/modules/audio_processing/gain_control_impl.h
+++ b/modules/audio_processing/gain_control_impl.h
@@ -86,8 +86,8 @@
std::vector<std::unique_ptr<GainController>> gain_controllers_;
- rtc::Optional<size_t> num_proc_channels_ RTC_GUARDED_BY(crit_capture_);
- rtc::Optional<int> sample_rate_hz_ RTC_GUARDED_BY(crit_capture_);
+ absl::optional<size_t> num_proc_channels_ RTC_GUARDED_BY(crit_capture_);
+ absl::optional<int> sample_rate_hz_ RTC_GUARDED_BY(crit_capture_);
static int instance_counter_;
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(GainControlImpl);
diff --git a/modules/audio_processing/include/audio_processing.h b/modules/audio_processing/include/audio_processing.h
index e4fb9b2..d5bdeea 100644
--- a/modules/audio_processing/include/audio_processing.h
+++ b/modules/audio_processing/include/audio_processing.h
@@ -22,9 +22,9 @@
#include <string.h>
#include <vector>
+#include "absl/types/optional.h"
#include "api/audio/echo_canceller3_config.h"
#include "api/audio/echo_control.h"
-#include "api/optional.h"
#include "modules/audio_processing/beamformer/array_util.h"
#include "modules/audio_processing/include/audio_generator.h"
#include "modules/audio_processing/include/audio_processing_statistics.h"
diff --git a/modules/audio_processing/include/audio_processing_statistics.h b/modules/audio_processing/include/audio_processing_statistics.h
index 05c5905..237d23c 100644
--- a/modules/audio_processing/include/audio_processing_statistics.h
+++ b/modules/audio_processing/include/audio_processing_statistics.h
@@ -11,7 +11,7 @@
#ifndef MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_STATISTICS_H_
#define MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_STATISTICS_H_
-#include "api/optional.h"
+#include "absl/types/optional.h"
namespace webrtc {
// This version of the stats uses Optionals, it will replace the regular
@@ -23,12 +23,12 @@
// AEC Statistics.
// ERL = 10log_10(P_far / P_echo)
- rtc::Optional<double> echo_return_loss;
+ absl::optional<double> echo_return_loss;
// ERLE = 10log_10(P_echo / P_out)
- rtc::Optional<double> echo_return_loss_enhancement;
+ absl::optional<double> echo_return_loss_enhancement;
// Fraction of time that the AEC linear filter is divergent, in a 1-second
// non-overlapped aggregation window.
- rtc::Optional<double> divergent_filter_fraction;
+ absl::optional<double> divergent_filter_fraction;
// The delay metrics consists of the delay median and standard deviation. It
// also consists of the fraction of delay estimates that can make the echo
@@ -37,18 +37,18 @@
// second. Note that if there are several clients pulling metrics from
// |GetStatistics()| during a session the first call from any of them will
// change to one second aggregation window for all.
- rtc::Optional<int32_t> delay_median_ms;
- rtc::Optional<int32_t> delay_standard_deviation_ms;
+ absl::optional<int32_t> delay_median_ms;
+ absl::optional<int32_t> delay_standard_deviation_ms;
// Residual echo detector likelihood.
- rtc::Optional<double> residual_echo_likelihood;
+ absl::optional<double> residual_echo_likelihood;
// Maximum residual echo likelihood from the last time period.
- rtc::Optional<double> residual_echo_likelihood_recent_max;
+ absl::optional<double> residual_echo_likelihood_recent_max;
// The instantaneous delay estimate produced in the AEC. The unit is in
// milliseconds and the value is the instantaneous value at the time of the
// call to |GetStatistics()|.
- rtc::Optional<int32_t> delay_ms;
+ absl::optional<int32_t> delay_ms;
};
} // namespace webrtc
diff --git a/modules/audio_processing/residual_echo_detector.cc b/modules/audio_processing/residual_echo_detector.cc
index f506579..aec545a 100644
--- a/modules/audio_processing/residual_echo_detector.cc
+++ b/modules/audio_processing/residual_echo_detector.cc
@@ -90,7 +90,7 @@
}
// Get the next render value.
- const rtc::Optional<float> buffered_render_power = render_buffer_.Pop();
+ const absl::optional<float> buffered_render_power = render_buffer_.Pop();
if (!buffered_render_power) {
// This can happen in a few cases: at the start of a call, due to a glitch
// or due to clock drift. The excess capture value will be ignored.
diff --git a/modules/audio_processing/rms_level.cc b/modules/audio_processing/rms_level.cc
index 55db226..727ecfc 100644
--- a/modules/audio_processing/rms_level.cc
+++ b/modules/audio_processing/rms_level.cc
@@ -54,7 +54,7 @@
sum_square_ = 0.f;
sample_count_ = 0;
max_sum_square_ = 0.f;
- block_size_ = rtc::nullopt;
+ block_size_ = absl::nullopt;
}
void RmsLevel::Analyze(rtc::ArrayView<const int16_t> data) {
@@ -88,7 +88,7 @@
RmsLevel::Levels RmsLevel::AverageAndPeak() {
// Note that block_size_ should by design always be non-empty when
- // sample_count_ != 0. Also, the * operator of rtc::Optional enforces this
+ // sample_count_ != 0. Also, the * operator of absl::optional enforces this
// with a DCHECK.
Levels levels = (sample_count_ == 0)
? Levels{RmsLevel::kMinLevelDb, RmsLevel::kMinLevelDb}
diff --git a/modules/audio_processing/rms_level.h b/modules/audio_processing/rms_level.h
index 6fe22fd..ae124b7 100644
--- a/modules/audio_processing/rms_level.h
+++ b/modules/audio_processing/rms_level.h
@@ -11,8 +11,8 @@
#ifndef MODULES_AUDIO_PROCESSING_RMS_LEVEL_H_
#define MODULES_AUDIO_PROCESSING_RMS_LEVEL_H_
+#include "absl/types/optional.h"
#include "api/array_view.h"
-#include "api/optional.h"
#include "typedefs.h" // NOLINT(build/include)
namespace webrtc {
@@ -66,7 +66,7 @@
float sum_square_;
size_t sample_count_;
float max_sum_square_;
- rtc::Optional<size_t> block_size_;
+ absl::optional<size_t> block_size_;
};
} // namespace webrtc
diff --git a/modules/audio_processing/test/audio_processing_simulator.h b/modules/audio_processing/test/audio_processing_simulator.h
index a98f8fc..522f778 100644
--- a/modules/audio_processing/test/audio_processing_simulator.h
+++ b/modules/audio_processing/test/audio_processing_simulator.h
@@ -17,7 +17,7 @@
#include <memory>
#include <string>
-#include "api/optional.h"
+#include "absl/types/optional.h"
#include "common_audio/channel_buffer.h"
#include "modules/audio_processing/include/audio_processing.h"
#include "modules/audio_processing/test/fake_recording_device.h"
@@ -34,63 +34,63 @@
SimulationSettings();
SimulationSettings(const SimulationSettings&);
~SimulationSettings();
- rtc::Optional<int> stream_delay;
- rtc::Optional<bool> use_stream_delay;
- rtc::Optional<int> stream_drift_samples;
- rtc::Optional<int> output_sample_rate_hz;
- rtc::Optional<int> output_num_channels;
- rtc::Optional<int> reverse_output_sample_rate_hz;
- rtc::Optional<int> reverse_output_num_channels;
- rtc::Optional<std::string> output_filename;
- rtc::Optional<std::string> reverse_output_filename;
- rtc::Optional<std::string> input_filename;
- rtc::Optional<std::string> reverse_input_filename;
- rtc::Optional<std::string> artificial_nearend_filename;
- rtc::Optional<bool> use_aec;
- rtc::Optional<bool> use_aecm;
- rtc::Optional<bool> use_ed; // Residual Echo Detector.
- rtc::Optional<std::string> ed_graph_output_filename;
- rtc::Optional<bool> use_agc;
- rtc::Optional<bool> use_agc2;
- rtc::Optional<bool> use_pre_amplifier;
- rtc::Optional<bool> use_hpf;
- rtc::Optional<bool> use_ns;
- rtc::Optional<bool> use_ts;
- rtc::Optional<bool> use_bf;
- rtc::Optional<bool> use_ie;
- rtc::Optional<bool> use_vad;
- rtc::Optional<bool> use_le;
- rtc::Optional<bool> use_all;
- rtc::Optional<int> aec_suppression_level;
- rtc::Optional<bool> use_delay_agnostic;
- rtc::Optional<bool> use_extended_filter;
- rtc::Optional<bool> use_drift_compensation;
- rtc::Optional<bool> use_aec3;
- rtc::Optional<bool> use_experimental_agc;
- rtc::Optional<int> aecm_routing_mode;
- rtc::Optional<bool> use_aecm_comfort_noise;
- rtc::Optional<int> agc_mode;
- rtc::Optional<int> agc_target_level;
- rtc::Optional<bool> use_agc_limiter;
- rtc::Optional<int> agc_compression_gain;
+ absl::optional<int> stream_delay;
+ absl::optional<bool> use_stream_delay;
+ absl::optional<int> stream_drift_samples;
+ absl::optional<int> output_sample_rate_hz;
+ absl::optional<int> output_num_channels;
+ absl::optional<int> reverse_output_sample_rate_hz;
+ absl::optional<int> reverse_output_num_channels;
+ absl::optional<std::string> output_filename;
+ absl::optional<std::string> reverse_output_filename;
+ absl::optional<std::string> input_filename;
+ absl::optional<std::string> reverse_input_filename;
+ absl::optional<std::string> artificial_nearend_filename;
+ absl::optional<bool> use_aec;
+ absl::optional<bool> use_aecm;
+ absl::optional<bool> use_ed; // Residual Echo Detector.
+ absl::optional<std::string> ed_graph_output_filename;
+ absl::optional<bool> use_agc;
+ absl::optional<bool> use_agc2;
+ absl::optional<bool> use_pre_amplifier;
+ absl::optional<bool> use_hpf;
+ absl::optional<bool> use_ns;
+ absl::optional<bool> use_ts;
+ absl::optional<bool> use_bf;
+ absl::optional<bool> use_ie;
+ absl::optional<bool> use_vad;
+ absl::optional<bool> use_le;
+ absl::optional<bool> use_all;
+ absl::optional<int> aec_suppression_level;
+ absl::optional<bool> use_delay_agnostic;
+ absl::optional<bool> use_extended_filter;
+ absl::optional<bool> use_drift_compensation;
+ absl::optional<bool> use_aec3;
+ absl::optional<bool> use_experimental_agc;
+ absl::optional<int> aecm_routing_mode;
+ absl::optional<bool> use_aecm_comfort_noise;
+ absl::optional<int> agc_mode;
+ absl::optional<int> agc_target_level;
+ absl::optional<bool> use_agc_limiter;
+ absl::optional<int> agc_compression_gain;
float agc2_fixed_gain_db;
float pre_amplifier_gain_factor;
- rtc::Optional<int> vad_likelihood;
- rtc::Optional<int> ns_level;
- rtc::Optional<bool> use_refined_adaptive_filter;
+ absl::optional<int> vad_likelihood;
+ absl::optional<int> ns_level;
+ absl::optional<bool> use_refined_adaptive_filter;
int initial_mic_level;
bool simulate_mic_gain = false;
- rtc::Optional<int> simulated_mic_kind;
+ absl::optional<int> simulated_mic_kind;
bool report_performance = false;
bool report_bitexactness = false;
bool use_verbose_logging = false;
bool discard_all_settings_in_aecdump = true;
- rtc::Optional<std::string> aec_dump_input_filename;
- rtc::Optional<std::string> aec_dump_output_filename;
+ absl::optional<std::string> aec_dump_input_filename;
+ absl::optional<std::string> aec_dump_output_filename;
bool fixed_interface = false;
bool store_intermediate_output = false;
- rtc::Optional<std::string> custom_call_order_filename;
- rtc::Optional<std::string> aec3_settings_filename;
+ absl::optional<std::string> custom_call_order_filename;
+ absl::optional<std::string> aec3_settings_filename;
};
// Holds a few statistics about a series of TickIntervals.
diff --git a/modules/audio_processing/test/audioproc_float_impl.cc b/modules/audio_processing/test/audioproc_float_impl.cc
index bfaa136..6a3f316 100644
--- a/modules/audio_processing/test/audioproc_float_impl.cc
+++ b/modules/audio_processing/test/audioproc_float_impl.cc
@@ -184,19 +184,19 @@
DEFINE_bool(help, false, "Print this message");
void SetSettingIfSpecified(const std::string& value,
- rtc::Optional<std::string>* parameter) {
+ absl::optional<std::string>* parameter) {
if (value.compare("") != 0) {
*parameter = value;
}
}
-void SetSettingIfSpecified(int value, rtc::Optional<int>* parameter) {
+void SetSettingIfSpecified(int value, absl::optional<int>* parameter) {
if (value != kParameterNotSpecifiedValue) {
*parameter = value;
}
}
-void SetSettingIfFlagSet(int32_t flag, rtc::Optional<bool>* parameter) {
+void SetSettingIfFlagSet(int32_t flag, absl::optional<bool>* parameter) {
if (flag == 0) {
*parameter = false;
} else if (flag == 1) {
diff --git a/modules/audio_processing/test/conversational_speech/BUILD.gn b/modules/audio_processing/test/conversational_speech/BUILD.gn
index b1cb079..d292604 100644
--- a/modules/audio_processing/test/conversational_speech/BUILD.gn
+++ b/modules/audio_processing/test/conversational_speech/BUILD.gn
@@ -69,11 +69,11 @@
"../../../..:webrtc_common",
"../../../../:typedefs",
"../../../../api:array_view",
- "../../../../api:optional",
"../../../../common_audio",
"../../../../rtc_base:rtc_base_approved",
"../../../../test:fileutils",
"../../../../test:test_support",
"//testing/gtest",
+ "//third_party/abseil-cpp/absl/types:optional",
]
}
diff --git a/modules/audio_processing/test/conversational_speech/generator_unittest.cc b/modules/audio_processing/test/conversational_speech/generator_unittest.cc
index 3a05762..5ef11db 100644
--- a/modules/audio_processing/test/conversational_speech/generator_unittest.cc
+++ b/modules/audio_processing/test/conversational_speech/generator_unittest.cc
@@ -42,7 +42,7 @@
#include <memory>
#include <vector>
-#include "api/optional.h"
+#include "absl/types/optional.h"
#include "common_audio/wav_file.h"
#include "modules/audio_processing/test/conversational_speech/config.h"
#include "modules/audio_processing/test/conversational_speech/mock_wavreader_factory.h"
@@ -149,7 +149,7 @@
void DeleteFolderAndContents(const std::string& dir) {
if (!DirExists(dir)) { return; }
- rtc::Optional<std::vector<std::string>> dir_content = ReadDirectory(dir);
+ absl::optional<std::vector<std::string>> dir_content = ReadDirectory(dir);
EXPECT_TRUE(dir_content);
for (const auto& path : *dir_content) {
if (DirExists(path)) {
diff --git a/modules/audio_processing/test/debug_dump_replayer.cc b/modules/audio_processing/test/debug_dump_replayer.cc
index 262f347..bc95cfd 100644
--- a/modules/audio_processing/test/debug_dump_replayer.cc
+++ b/modules/audio_processing/test/debug_dump_replayer.cc
@@ -49,9 +49,9 @@
}
// Get next event that has not run.
-rtc::Optional<audioproc::Event> DebugDumpReplayer::GetNextEvent() const {
+absl::optional<audioproc::Event> DebugDumpReplayer::GetNextEvent() const {
if (!has_next_event_)
- return rtc::nullopt;
+ return absl::nullopt;
else
return next_event_;
}
diff --git a/modules/audio_processing/test/debug_dump_replayer.h b/modules/audio_processing/test/debug_dump_replayer.h
index 4cd961d..aa5d727 100644
--- a/modules/audio_processing/test/debug_dump_replayer.h
+++ b/modules/audio_processing/test/debug_dump_replayer.h
@@ -34,7 +34,7 @@
bool SetDumpFile(const std::string& filename);
// Return next event.
- rtc::Optional<audioproc::Event> GetNextEvent() const;
+ absl::optional<audioproc::Event> GetNextEvent() const;
// Run the next event. Returns true if succeeded.
bool RunNextEvent();
diff --git a/modules/audio_processing/test/debug_dump_test.cc b/modules/audio_processing/test/debug_dump_test.cc
index 4d3be48..d90d14f 100644
--- a/modules/audio_processing/test/debug_dump_test.cc
+++ b/modules/audio_processing/test/debug_dump_test.cc
@@ -275,8 +275,8 @@
void DebugDumpTest::VerifyDebugDump(const std::string& in_filename) {
ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(in_filename));
- while (const rtc::Optional<audioproc::Event> event =
- debug_dump_replayer_.GetNextEvent()) {
+ while (const absl::optional<audioproc::Event> event =
+ debug_dump_replayer_.GetNextEvent()) {
debug_dump_replayer_.RunNextEvent();
if (event->type() == audioproc::Event::STREAM) {
const audioproc::Stream* msg = &event->stream();
@@ -388,7 +388,7 @@
ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name()));
- while (const rtc::Optional<audioproc::Event> event =
+ while (const absl::optional<audioproc::Event> event =
debug_dump_replayer_.GetNextEvent()) {
debug_dump_replayer_.RunNextEvent();
if (event->type() == audioproc::Event::CONFIG) {
@@ -416,7 +416,7 @@
ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name()));
- while (const rtc::Optional<audioproc::Event> event =
+ while (const absl::optional<audioproc::Event> event =
debug_dump_replayer_.GetNextEvent()) {
debug_dump_replayer_.RunNextEvent();
if (event->type() == audioproc::Event::CONFIG) {
@@ -444,7 +444,7 @@
ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name()));
- while (const rtc::Optional<audioproc::Event> event =
+ while (const absl::optional<audioproc::Event> event =
debug_dump_replayer_.GetNextEvent()) {
debug_dump_replayer_.RunNextEvent();
if (event->type() == audioproc::Event::CONFIG) {
@@ -472,7 +472,7 @@
ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name()));
- while (const rtc::Optional<audioproc::Event> event =
+ while (const absl::optional<audioproc::Event> event =
debug_dump_replayer_.GetNextEvent()) {
debug_dump_replayer_.RunNextEvent();
if (event->type() == audioproc::Event::CONFIG) {
@@ -497,7 +497,7 @@
ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name()));
- while (const rtc::Optional<audioproc::Event> event =
+ while (const absl::optional<audioproc::Event> event =
debug_dump_replayer_.GetNextEvent()) {
debug_dump_replayer_.RunNextEvent();
if (event->type() == audioproc::Event::CONFIG) {
@@ -520,7 +520,7 @@
ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(generator.dump_file_name()));
- while (const rtc::Optional<audioproc::Event> event =
+ while (const absl::optional<audioproc::Event> event =
debug_dump_replayer_.GetNextEvent()) {
debug_dump_replayer_.RunNextEvent();
if (event->type() == audioproc::Event::CONFIG) {
diff --git a/modules/audio_processing/test/fake_recording_device.cc b/modules/audio_processing/test/fake_recording_device.cc
index 3260ec1..9c6ea51 100644
--- a/modules/audio_processing/test/fake_recording_device.cc
+++ b/modules/audio_processing/test/fake_recording_device.cc
@@ -12,7 +12,7 @@
#include <algorithm>
-#include "api/optional.h"
+#include "absl/types/optional.h"
#include "rtc_base/logging.h"
#include "rtc_base/ptr_util.h"
@@ -44,7 +44,7 @@
// Mic level to simulate.
int mic_level_;
// Optional mic level to undo.
- rtc::Optional<int> undo_mic_level_;
+ absl::optional<int> undo_mic_level_;
};
namespace {
diff --git a/modules/audio_processing/test/performance_timer.h b/modules/audio_processing/test/performance_timer.h
index 1c862dc..b6e0da7 100644
--- a/modules/audio_processing/test/performance_timer.h
+++ b/modules/audio_processing/test/performance_timer.h
@@ -13,7 +13,7 @@
#include <vector>
-#include "api/optional.h"
+#include "absl/types/optional.h"
#include "system_wrappers/include/clock.h"
namespace webrtc {
@@ -37,7 +37,7 @@
private:
webrtc::Clock* clock_;
- rtc::Optional<int64_t> start_timestamp_us_;
+ absl::optional<int64_t> start_timestamp_us_;
std::vector<int64_t> timestamps_us_;
};