Optional: Use nullopt and implicit construction in /modules/audio_processing
Changes places where we explicitly construct an Optional to instead use nullopt or the requisite value type only. This CL was uploaded by git cl split. R=henrik.lundin@webrtc.org Bug: None Change-Id: I733a83f702fe11884d229a1713cfac952727bde8 Reviewed-on: https://webrtc-review.googlesource.com/23601 Commit-Queue: Oskar Sundbom <ossu@webrtc.org> Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20786}
This commit is contained in:
committed by
Commit Bot
parent
28dfeb7f24
commit
aa8b67da9d
@ -186,39 +186,39 @@ DEFINE_bool(help, false, "Print this message");
|
||||
void SetSettingIfSpecified(const std::string& value,
|
||||
rtc::Optional<std::string>* parameter) {
|
||||
if (value.compare("") != 0) {
|
||||
*parameter = rtc::Optional<std::string>(value);
|
||||
*parameter = value;
|
||||
}
|
||||
}
|
||||
|
||||
void SetSettingIfSpecified(int value, rtc::Optional<int>* parameter) {
|
||||
if (value != kParameterNotSpecifiedValue) {
|
||||
*parameter = rtc::Optional<int>(value);
|
||||
*parameter = value;
|
||||
}
|
||||
}
|
||||
|
||||
void SetSettingIfFlagSet(int32_t flag, rtc::Optional<bool>* parameter) {
|
||||
if (flag == 0) {
|
||||
*parameter = rtc::Optional<bool>(false);
|
||||
*parameter = false;
|
||||
} else if (flag == 1) {
|
||||
*parameter = rtc::Optional<bool>(true);
|
||||
*parameter = true;
|
||||
}
|
||||
}
|
||||
|
||||
SimulationSettings CreateSettings() {
|
||||
SimulationSettings settings;
|
||||
if (FLAG_all_default) {
|
||||
settings.use_le = rtc::Optional<bool>(true);
|
||||
settings.use_vad = rtc::Optional<bool>(true);
|
||||
settings.use_ie = rtc::Optional<bool>(false);
|
||||
settings.use_bf = rtc::Optional<bool>(false);
|
||||
settings.use_ts = rtc::Optional<bool>(true);
|
||||
settings.use_ns = rtc::Optional<bool>(true);
|
||||
settings.use_hpf = rtc::Optional<bool>(true);
|
||||
settings.use_agc = rtc::Optional<bool>(true);
|
||||
settings.use_agc2 = rtc::Optional<bool>(false);
|
||||
settings.use_aec = rtc::Optional<bool>(true);
|
||||
settings.use_aecm = rtc::Optional<bool>(false);
|
||||
settings.use_ed = rtc::Optional<bool>(false);
|
||||
settings.use_le = true;
|
||||
settings.use_vad = true;
|
||||
settings.use_ie = false;
|
||||
settings.use_bf = false;
|
||||
settings.use_ts = true;
|
||||
settings.use_ns = true;
|
||||
settings.use_hpf = true;
|
||||
settings.use_agc = true;
|
||||
settings.use_agc2 = false;
|
||||
settings.use_aec = true;
|
||||
settings.use_aecm = false;
|
||||
settings.use_ed = false;
|
||||
}
|
||||
SetSettingIfSpecified(FLAG_dump_input, &settings.aec_dump_input_filename);
|
||||
SetSettingIfSpecified(FLAG_dump_output, &settings.aec_dump_output_filename);
|
||||
|
||||
@ -51,9 +51,9 @@ bool DebugDumpReplayer::SetDumpFile(const std::string& filename) {
|
||||
// Get next event that has not run.
|
||||
rtc::Optional<audioproc::Event> DebugDumpReplayer::GetNextEvent() const {
|
||||
if (!has_next_event_)
|
||||
return rtc::Optional<audioproc::Event>();
|
||||
return rtc::nullopt;
|
||||
else
|
||||
return rtc::Optional<audioproc::Event>(next_event_);
|
||||
return next_event_;
|
||||
}
|
||||
|
||||
// Run the next event. Returns the event type.
|
||||
|
||||
@ -34,9 +34,7 @@ class FakeRecordingDeviceWorker {
|
||||
: mic_level_(initial_mic_level) {}
|
||||
int mic_level() const { return mic_level_; }
|
||||
void set_mic_level(const int level) { mic_level_ = level; }
|
||||
void set_undo_mic_level(const int level) {
|
||||
undo_mic_level_ = rtc::Optional<int>(level);
|
||||
}
|
||||
void set_undo_mic_level(const int level) { undo_mic_level_ = level; }
|
||||
virtual ~FakeRecordingDeviceWorker() = default;
|
||||
virtual void ModifyBufferInt16(AudioFrame* buffer) = 0;
|
||||
virtual void ModifyBufferFloat(ChannelBuffer<float>* buffer) = 0;
|
||||
|
||||
@ -27,7 +27,7 @@ PerformanceTimer::PerformanceTimer(int num_frames_to_process)
|
||||
PerformanceTimer::~PerformanceTimer() = default;
|
||||
|
||||
void PerformanceTimer::StartTimer() {
|
||||
start_timestamp_us_ = rtc::Optional<int64_t>(clock_->TimeInMicroseconds());
|
||||
start_timestamp_us_ = clock_->TimeInMicroseconds();
|
||||
}
|
||||
|
||||
void PerformanceTimer::StopTimer() {
|
||||
|
||||
Reference in New Issue
Block a user