Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(839)

Side by Side Diff: webrtc/modules/audio_processing/level_controller/level_controller.cc

Issue 2292863002: Introduced new scheme for controlling the functionality inside the audio processing module (Closed)
Patch Set: Changes in response to reviewer comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 [](float a, float b) { return std::abs(a) < std::abs(b); }); 65 [](float a, float b) { return std::abs(a) < std::abs(b); });
66 peak_level = std::max(*channel_peak_level, peak_level); 66 peak_level = std::max(*channel_peak_level, peak_level);
67 } 67 }
68 return peak_level; 68 return peak_level;
69 } 69 }
70 70
71 const int kMetricsFrameInterval = 1000; 71 const int kMetricsFrameInterval = 1000;
72 72
73 } // namespace 73 } // namespace
74 74
75 bool AudioProcessing::Config::LevelController::Validate() const {
the sun 2016/08/30 18:05:35 How about a static function in LevelController ins
peah-webrtc 2016/08/31 08:08:32 That sounds good! Done.
76 return true;
77 }
78
75 int LevelController::instance_count_ = 0; 79 int LevelController::instance_count_ = 0;
76 80
77 void LevelController::Metrics::Initialize(int sample_rate_hz) { 81 void LevelController::Metrics::Initialize(int sample_rate_hz) {
78 RTC_DCHECK(sample_rate_hz == AudioProcessing::kSampleRate8kHz || 82 RTC_DCHECK(sample_rate_hz == AudioProcessing::kSampleRate8kHz ||
79 sample_rate_hz == AudioProcessing::kSampleRate16kHz || 83 sample_rate_hz == AudioProcessing::kSampleRate16kHz ||
80 sample_rate_hz == AudioProcessing::kSampleRate32kHz || 84 sample_rate_hz == AudioProcessing::kSampleRate32kHz ||
81 sample_rate_hz == AudioProcessing::kSampleRate48kHz); 85 sample_rate_hz == AudioProcessing::kSampleRate48kHz);
82 86
83 Reset(); 87 Reset();
84 frame_length_ = rtc::CheckedDivExact(sample_rate_hz, 100); 88 frame_length_ = rtc::CheckedDivExact(sample_rate_hz, 100);
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 data_dumper_->DumpRaw("lc_selected_gain", 1, &last_gain_); 260 data_dumper_->DumpRaw("lc_selected_gain", 1, &last_gain_);
257 data_dumper_->DumpRaw("lc_noise_energy", 1, &noise_energy); 261 data_dumper_->DumpRaw("lc_noise_energy", 1, &noise_energy);
258 data_dumper_->DumpRaw("lc_peak_level", 1, &long_term_peak_level); 262 data_dumper_->DumpRaw("lc_peak_level", 1, &long_term_peak_level);
259 data_dumper_->DumpRaw("lc_saturating_gain", 1, &saturating_gain); 263 data_dumper_->DumpRaw("lc_saturating_gain", 1, &saturating_gain);
260 264
261 data_dumper_->DumpWav("lc_output", audio->num_frames(), 265 data_dumper_->DumpWav("lc_output", audio->num_frames(),
262 audio->channels_f()[0], *sample_rate_hz_, 1); 266 audio->channels_f()[0], *sample_rate_hz_, 1);
263 } 267 }
264 268
265 } // namespace webrtc 269 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698