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}
This commit is contained in:
Danil Chapovalov
2018-06-19 10:50:11 +02:00
committed by Commit Bot
parent c66613daf7
commit db9f7ab9f9
65 changed files with 248 additions and 248 deletions

View File

@ -126,7 +126,6 @@ rtc_static_library("audio_processing") {
"../..: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 @@ rtc_static_library("audio_processing") {
"agc2:fixed_digital",
"agc2:gain_applier",
"vad",
"//third_party/abseil-cpp/absl/types:optional",
]
if (aec_untrusted_delay_for_testing) {
@ -187,7 +187,7 @@ rtc_source_set("audio_processing_statistics") {
"include/audio_processing_statistics.h",
]
deps = [
"../../api:optional",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -510,7 +510,6 @@ if (rtc_include_tests) {
"../..:typedefs",
"../..:webrtc_common",
"../../api:array_view",
"../../api:optional",
"../../api/audio:aec3_config",
"../../api/audio:aec3_factory",
"../../common_audio:common_audio",
@ -536,6 +535,7 @@ if (rtc_include_tests) {
"test/conversational_speech:unittest",
"vad:vad_unittests",
"//testing/gtest",
"//third_party/abseil-cpp/absl/types:optional",
]
defines = []
@ -650,11 +650,11 @@ if (rtc_include_tests) {
]
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 @@ if (rtc_include_tests) {
":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 @@ if (rtc_include_tests) {
"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 @@ if (rtc_include_tests) {
deps = [
":audio_processing",
"../../api:array_view",
"../../api:optional",
"../../api/audio:audio_frame_api",
"../../common_audio",
"../../rtc_base:checks",
@ -737,6 +736,7 @@ if (rtc_include_tests) {
"../../test:test_support",
"../audio_coding:neteq_input_audio_tools",
"//testing/gtest",
"//third_party/abseil-cpp/absl/types:optional",
]
}

View File

@ -112,7 +112,6 @@ rtc_static_library("aec3") {
"..: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 @@ rtc_static_library("aec3") {
"../../../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 @@ if (rtc_include_tests) {
"..: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 = []

View File

@ -325,7 +325,7 @@ TEST(AdaptiveFirFilter, FilterAndAdapt) {
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;

View File

@ -115,7 +115,7 @@ void AecState::HandleEchoPathChange(
}
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 @@ void AecState::Update(
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;

View File

@ -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 @@ class AecState {
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 @@ class AecState {
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 @@ class AecState {
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 @@ class AecState {
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;

View File

@ -22,7 +22,7 @@ TEST(AecState, NormalUsage) {
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 @@ TEST(AecState, ConvergedFilterDelay) {
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;

View File

@ -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 @@ class BlockProcessorImpl final : public BlockProcessor {
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::UpdateEchoLeakageStatus(bool leakage_detected) {
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;
}

View File

@ -42,7 +42,7 @@ void EchoAudibility::Update(const RenderBuffer& render_buffer,
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(

View File

@ -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 @@ class EchoAudibility {
// 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_;

View File

@ -61,11 +61,11 @@ void EchoPathDelayEstimator::Reset(bool soft_reset) {
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 @@ rtc::Optional<DelayEstimate> EchoPathDelayEstimator::EstimateDelay(
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());

View File

@ -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 @@ class EchoPathDelayEstimator {
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 @@ class EchoPathDelayEstimator {
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);

View File

@ -72,7 +72,7 @@ TEST(EchoPathDelayEstimator, DelayEstimation) {
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);

View File

@ -68,14 +68,14 @@ class EchoRemoverImpl final : public EchoRemover {
// 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::GetMetrics(EchoControl::Metrics* metrics) const {
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);

View File

@ -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 @@ class EchoRemover {
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.

View File

@ -43,7 +43,7 @@ std::string ProduceDebugText(int sample_rate_hz, int delay) {
// 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 @@ TEST(EchoRemover, DISABLED_WrongSampleRate) {
// 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 @@ TEST(EchoRemover, WrongCaptureBlockSize) {
// 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 @@ TEST(EchoRemover, DISABLED_WrongCaptureNumBands) {
// 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, NullCapture) {
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));

View File

@ -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"

View File

@ -68,7 +68,7 @@ void RunFilterUpdateTest(int num_blocks_to_process,
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;

View File

@ -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"

View File

@ -30,7 +30,7 @@ void MatchedFilterLagAggregator::Reset() {
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 @@ rtc::Optional<DelayEstimate> MatchedFilterLagAggregator::Aggregate(
return DelayEstimate(DelayEstimate::Quality::kRefined, candidate);
}
}
return rtc::nullopt;
return absl::nullopt;
}
} // namespace webrtc

View File

@ -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 @@ class MatchedFilterLagAggregator {
void Reset();
// Aggregates the provided lag estimates.
rtc::Optional<DelayEstimate> Aggregate(
absl::optional<DelayEstimate> Aggregate(
rtc::ArrayView<const MatchedFilter::LagEstimate> lag_estimates);
private:

View File

@ -40,7 +40,7 @@ TEST(MatchedFilterLagAggregator, MostAccurateLagChosen) {
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 @@ TEST(MatchedFilterLagAggregator,
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 @@ TEST(MatchedFilterLagAggregator,
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 @@ TEST(MatchedFilterLagAggregator, DISABLED_PersistentAggregatedLag) {
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);

View File

@ -183,7 +183,7 @@ TEST(MatchedFilter, LagEstimation) {
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) *

View File

@ -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 @@ class MockEchoRemover : public EchoRemover {
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));
};

View File

@ -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,11 +26,11 @@ class MockRenderDelayController : public RenderDelayController {
MOCK_METHOD0(Reset, void());
MOCK_METHOD0(LogRenderCall, void());
MOCK_METHOD4(
GetDelay,
rtc::Optional<DelayEstimate>(const DownsampledRenderBuffer& render_buffer,
MOCK_METHOD4(GetDelay,
absl::optional<DelayEstimate>(
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));
};

View File

@ -77,8 +77,8 @@ class RenderDelayBufferImpl final : public RenderDelayBuffer {
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 @@ class RenderDelayBufferImpl final : public RenderDelayBuffer {
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 @@ void IncreaseWriteIndices(int sub_block_size,
}
// 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 @@ bool RenderOverrun(const MatrixBuffer& b, const DownsampledRenderBuffer& l) {
// 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 @@ void RenderDelayBufferImpl::Reset() {
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;
}
}

View File

@ -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"

View File

@ -50,10 +50,10 @@ class RenderDelayControllerImpl final : public RenderDelayController {
~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 @@ class RenderDelayControllerImpl final : public RenderDelayController {
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 @@ class RenderDelayControllerImpl final : public RenderDelayController {
};
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(
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 @@ void RenderDelayControllerImpl::LogRenderCall() {
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 @@ rtc::Optional<DelayEstimate> RenderDelayControllerImpl::GetDelay(
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 @@ rtc::Optional<DelayEstimate> RenderDelayControllerImpl::GetDelay(
// 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 @@ rtc::Optional<DelayEstimate> RenderDelayControllerImpl::GetDelay(
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",

View File

@ -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 @@ class RenderDelayController {
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

View File

@ -43,9 +43,9 @@ constexpr int kMaxSkewShiftCount = 20;
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) {

View File

@ -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 @@ class RenderDelayControllerMetrics {
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_; }

View File

@ -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 @@ TEST(RenderDelayControllerMetrics, NormalUsage) {
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());
}
}

View File

@ -48,7 +48,7 @@ constexpr size_t kDownSamplingFactors[] = {2, 4, 8};
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 @@ TEST(RenderDelayController, NoRenderSignal) {
// 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 @@ TEST(RenderDelayController, BasicApiCalls) {
// 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 @@ TEST(RenderDelayController, Alignment) {
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 @@ TEST(RenderDelayController, Alignment) {
// 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 @@ TEST(RenderDelayController, NonCausalAlignment) {
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 @@ TEST(RenderDelayController, NonCausalAlignment) {
// 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 @@ TEST(RenderDelayController, AlignmentWithJitter) {
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, InitialHeadroom) {
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(

View File

@ -23,7 +23,7 @@ constexpr size_t kCounterThreshold = 5;
// 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 @@ void IdentifySmallNarrowBandRegions(
// 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 @@ void IdentifyStrongNarrowBandComponent(const RenderBuffer& render_buffer,
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 @@ RenderSignalAnalyzer::~RenderSignalAnalyzer() = default;
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_);

View File

@ -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 @@ class RenderSignalAnalyzer {
// 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 @@ class RenderSignalAnalyzer {
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);

View File

@ -73,7 +73,7 @@ TEST(RenderSignalAnalyzer, NoFalseDetectionOfNarrowBands) {
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 @@ TEST(RenderSignalAnalyzer, NarrowBandDetection) {
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);
}
};

View File

@ -63,7 +63,7 @@ TEST(ResidualEchoEstimator, DISABLED_BasicTest) {
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);

View File

@ -28,7 +28,7 @@ void SkewEstimator::Reset() {
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 @@ rtc::Optional<int> SkewEstimator::GetSkewFromCapture() {
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

View File

@ -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 @@ class SkewEstimator {
// 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_;

View File

@ -30,7 +30,7 @@ TEST(SkewEstimator, SkewChangeAdaptation) {
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 @@ TEST(SkewEstimator, SkewForSurplusRender) {
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 @@ TEST(SkewEstimator, SkewForSurplusCapture) {
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 @@ TEST(SkewEstimator, SkewRounding) {
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.

View File

@ -33,7 +33,7 @@ float RunSubtractorTest(int num_blocks_to_process,
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;

View File

@ -54,7 +54,7 @@ void AdjustForExternalFilters(std::array<float, kFftLengthBy2Plus1>* gain) {
// 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 @@ void SuppressionGain::GetGain(
// 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);

View File

@ -78,7 +78,7 @@ TEST(SuppressionGain, BasicGainComputation) {
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);

View File

@ -1677,15 +1677,15 @@ AudioProcessingStats AudioProcessingImpl::GetStatistics(
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 @@ AudioProcessingStats AudioProcessingImpl::GetStatistics(
&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);
}
}
}

View File

@ -56,7 +56,7 @@ bool ArePerpendicular(const Point& a, const Point& b) {
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 @@ rtc::Optional<Point> GetDirectionIfLinear(
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 @@ rtc::Optional<Point> GetNormalIfPlanar(
}
}
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) {

View File

@ -14,7 +14,7 @@
#include <cmath>
#include <vector>
#include "api/optional.h"
#include "absl/types/optional.h"
namespace webrtc {
@ -59,16 +59,16 @@ float GetMinimumSpacing(const std::vector<Point>& array_geometry);
// 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.

View File

@ -164,7 +164,7 @@ class NonlinearBeamformer : public LappedTransform::Callback {
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_;

View File

@ -28,9 +28,9 @@ void CircularBuffer::Push(float value) {
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_) %

View File

@ -13,7 +13,7 @@
#include <vector>
#include "api/optional.h"
#include "absl/types/optional.h"
namespace webrtc {
@ -24,7 +24,7 @@ struct CircularBuffer {
~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();

View File

@ -46,7 +46,7 @@ TEST(CircularBufferTests, OverflowTest) {
TEST(CircularBufferTests, ReadFromEmpty) {
CircularBuffer test_buffer(3);
EXPECT_EQ(rtc::nullopt, test_buffer.Pop());
EXPECT_EQ(absl::nullopt, test_buffer.Pop());
}
} // namespace webrtc

View File

@ -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 @@ class GainControlImpl::GainController {
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);
};

View File

@ -86,8 +86,8 @@ class GainControlImpl : public GainControl {
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);

View File

@ -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"

View File

@ -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 @@ struct AudioProcessingStats {
// 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 @@ struct AudioProcessingStats {
// 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

View File

@ -90,7 +90,7 @@ void ResidualEchoDetector::AnalyzeCaptureAudio(
}
// 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.

View File

@ -54,7 +54,7 @@ void RmsLevel::Reset() {
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 @@ int RmsLevel::Average() {
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}

View File

@ -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 @@ class RmsLevel {
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

View File

@ -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 @@ struct SimulationSettings {
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.

View File

@ -184,19 +184,19 @@ DEFINE_string(aec3_settings,
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) {

View File

@ -69,11 +69,11 @@ rtc_source_set("unittest") {
"../../../..: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",
]
}

View File

@ -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 CheckAudioTrackParams(const WavReaderFactory& wav_reader_factory,
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)) {

View File

@ -49,9 +49,9 @@ bool DebugDumpReplayer::SetDumpFile(const std::string& filename) {
}
// 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_;
}

View File

@ -34,7 +34,7 @@ class DebugDumpReplayer {
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();

View File

@ -275,7 +275,7 @@ class DebugDumpTest : public ::testing::Test {
void DebugDumpTest::VerifyDebugDump(const std::string& in_filename) {
ASSERT_TRUE(debug_dump_replayer_.SetDumpFile(in_filename));
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::STREAM) {
@ -388,7 +388,7 @@ TEST_F(DebugDumpTest, VerifyRefinedAdaptiveFilterExperimentalString) {
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 @@ TEST_F(DebugDumpTest, VerifyCombinedExperimentalStringInclusive) {
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 @@ TEST_F(DebugDumpTest, VerifyCombinedExperimentalStringExclusive) {
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 @@ TEST_F(DebugDumpTest, VerifyAec3ExperimentalString) {
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 @@ TEST_F(DebugDumpTest, VerifyAgcClippingLevelExperimentalString) {
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 @@ TEST_F(DebugDumpTest, VerifyEmptyExperimentalString) {
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) {

View File

@ -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 @@ class FakeRecordingDeviceWorker {
// 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 {

View File

@ -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 @@ class PerformanceTimer {
private:
webrtc::Clock* clock_;
rtc::Optional<int64_t> start_timestamp_us_;
absl::optional<int64_t> start_timestamp_us_;
std::vector<int64_t> timestamps_us_;
};