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

Side by Side Diff: webrtc/modules/audio_processing/agc/agc_manager_direct.cc

Issue 1522053002: Remove unused and rarely used LOG_ macros. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years 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) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 max_compression_gain_ = kMaxCompressionGain; 161 max_compression_gain_ = kMaxCompressionGain;
162 target_compression_ = kDefaultCompressionGain; 162 target_compression_ = kDefaultCompressionGain;
163 compression_ = target_compression_; 163 compression_ = target_compression_;
164 compression_accumulator_ = compression_; 164 compression_accumulator_ = compression_;
165 capture_muted_ = false; 165 capture_muted_ = false;
166 check_volume_on_next_process_ = true; 166 check_volume_on_next_process_ = true;
167 // TODO(bjornv): Investigate if we need to reset |startup_| as well. For 167 // TODO(bjornv): Investigate if we need to reset |startup_| as well. For
168 // example, what happens when we change devices. 168 // example, what happens when we change devices.
169 169
170 if (gctrl_->set_mode(GainControl::kFixedDigital) != 0) { 170 if (gctrl_->set_mode(GainControl::kFixedDigital) != 0) {
171 LOG_FERR1(LS_ERROR, set_mode, GainControl::kFixedDigital); 171 LOG(LS_ERROR) << "set_mode(GainControl::kFixedDigital) failed.";
172 return -1; 172 return -1;
173 } 173 }
174 if (gctrl_->set_target_level_dbfs(2) != 0) { 174 if (gctrl_->set_target_level_dbfs(2) != 0) {
175 LOG_FERR1(LS_ERROR, set_target_level_dbfs, 2); 175 LOG(LS_ERROR) << "set_target_level_dbfs(2) failed.";
176 return -1; 176 return -1;
177 } 177 }
178 if (gctrl_->set_compression_gain_db(kDefaultCompressionGain) != 0) { 178 if (gctrl_->set_compression_gain_db(kDefaultCompressionGain) != 0) {
179 LOG_FERR1(LS_ERROR, set_compression_gain_db, kDefaultCompressionGain); 179 LOG(LS_ERROR) << "set_compression_gain_db(kDefaultCompressionGain) failed.";
180 return -1; 180 return -1;
181 } 181 }
182 if (gctrl_->enable_limiter(true) != 0) { 182 if (gctrl_->enable_limiter(true) != 0) {
183 LOG_FERR1(LS_ERROR, enable_limiter, true); 183 LOG(LS_ERROR) << "enable_limiter(true) failed.";
184 return -1; 184 return -1;
185 } 185 }
186 return 0; 186 return 0;
187 } 187 }
188 188
189 void AgcManagerDirect::AnalyzePreProcess(int16_t* audio, 189 void AgcManagerDirect::AnalyzePreProcess(int16_t* audio,
190 int num_channels, 190 int num_channels,
191 size_t samples_per_channel) { 191 size_t samples_per_channel) {
192 size_t length = num_channels * samples_per_channel; 192 size_t length = num_channels * samples_per_channel;
193 if (capture_muted_) { 193 if (capture_muted_) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 } 237 }
238 238
239 if (check_volume_on_next_process_) { 239 if (check_volume_on_next_process_) {
240 check_volume_on_next_process_ = false; 240 check_volume_on_next_process_ = false;
241 // We have to wait until the first process call to check the volume, 241 // We have to wait until the first process call to check the volume,
242 // because Chromium doesn't guarantee it to be valid any earlier. 242 // because Chromium doesn't guarantee it to be valid any earlier.
243 CheckVolumeAndReset(); 243 CheckVolumeAndReset();
244 } 244 }
245 245
246 if (agc_->Process(audio, length, sample_rate_hz) != 0) { 246 if (agc_->Process(audio, length, sample_rate_hz) != 0) {
247 LOG_FERR0(LS_ERROR, Agc::Process); 247 LOG(LS_ERROR) << "Agc::Process failed";
248 assert(false); 248 assert(false);
249 } 249 }
250 250
251 UpdateGain(); 251 UpdateGain();
252 UpdateCompressor(); 252 UpdateCompressor();
253 253
254 file_postproc_->Write(audio, length); 254 file_postproc_->Write(audio, length);
255 } 255 }
256 256
257 void AgcManagerDirect::SetLevel(int new_level) { 257 void AgcManagerDirect::SetLevel(int new_level) {
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 if (std::fabs(compression_accumulator_ - nearest_neighbor) < 427 if (std::fabs(compression_accumulator_ - nearest_neighbor) <
428 kCompressionGainStep / 2) { 428 kCompressionGainStep / 2) {
429 new_compression = nearest_neighbor; 429 new_compression = nearest_neighbor;
430 } 430 }
431 431
432 // Set the new compression gain. 432 // Set the new compression gain.
433 if (new_compression != compression_) { 433 if (new_compression != compression_) {
434 compression_ = new_compression; 434 compression_ = new_compression;
435 compression_accumulator_ = new_compression; 435 compression_accumulator_ = new_compression;
436 if (gctrl_->set_compression_gain_db(compression_) != 0) { 436 if (gctrl_->set_compression_gain_db(compression_) != 0) {
437 LOG_FERR1(LS_ERROR, set_compression_gain_db, compression_); 437 LOG(LS_ERROR) << "set_compression_gain_db(" << compression_
438 << ") failed.";
438 } 439 }
439 } 440 }
440 } 441 }
441 442
442 } // namespace webrtc 443 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/acm2/acm_resampler.cc ('k') | webrtc/system_wrappers/include/logging.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698