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

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

Issue 2685783014: Replace NULL with nullptr in all C++ files. (Closed)
Patch Set: Fixing android. Created 3 years, 10 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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 26 matching lines...) Expand all
37 switch (err) { 37 switch (err) {
38 case AEC_UNSUPPORTED_FUNCTION_ERROR: 38 case AEC_UNSUPPORTED_FUNCTION_ERROR:
39 return AudioProcessing::kUnsupportedFunctionError; 39 return AudioProcessing::kUnsupportedFunctionError;
40 case AEC_BAD_PARAMETER_ERROR: 40 case AEC_BAD_PARAMETER_ERROR:
41 return AudioProcessing::kBadParameterError; 41 return AudioProcessing::kBadParameterError;
42 case AEC_BAD_PARAMETER_WARNING: 42 case AEC_BAD_PARAMETER_WARNING:
43 return AudioProcessing::kBadStreamParameterWarning; 43 return AudioProcessing::kBadStreamParameterWarning;
44 default: 44 default:
45 // AEC_UNSPECIFIED_ERROR 45 // AEC_UNSPECIFIED_ERROR
46 // AEC_UNINITIALIZED_ERROR 46 // AEC_UNINITIALIZED_ERROR
47 // AEC_NULL_POINTER_ERROR 47 // AEC_null_POINTER_ERROR
48 return AudioProcessing::kUnspecifiedError; 48 return AudioProcessing::kUnspecifiedError;
49 } 49 }
50 } 50 }
51 51
52 } // namespace 52 } // namespace
53 53
54 struct EchoCancellationImpl::StreamProperties { 54 struct EchoCancellationImpl::StreamProperties {
55 StreamProperties() = delete; 55 StreamProperties() = delete;
56 StreamProperties(int sample_rate_hz, 56 StreamProperties(int sample_rate_hz,
57 size_t num_reverse_channels, 57 size_t num_reverse_channels,
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 269
270 bool EchoCancellationImpl::are_metrics_enabled() const { 270 bool EchoCancellationImpl::are_metrics_enabled() const {
271 rtc::CritScope cs(crit_capture_); 271 rtc::CritScope cs(crit_capture_);
272 return enabled_ && metrics_enabled_; 272 return enabled_ && metrics_enabled_;
273 } 273 }
274 274
275 // TODO(ajm): we currently just use the metrics from the first AEC. Think more 275 // TODO(ajm): we currently just use the metrics from the first AEC. Think more
276 // aboue the best way to extend this to multi-channel. 276 // aboue the best way to extend this to multi-channel.
277 int EchoCancellationImpl::GetMetrics(Metrics* metrics) { 277 int EchoCancellationImpl::GetMetrics(Metrics* metrics) {
278 rtc::CritScope cs(crit_capture_); 278 rtc::CritScope cs(crit_capture_);
279 if (metrics == NULL) { 279 if (metrics == nullptr) {
280 return AudioProcessing::kNullPointerError; 280 return AudioProcessing::kNullPointerError;
281 } 281 }
282 282
283 if (!enabled_ || !metrics_enabled_) { 283 if (!enabled_ || !metrics_enabled_) {
284 return AudioProcessing::kNotEnabledError; 284 return AudioProcessing::kNotEnabledError;
285 } 285 }
286 286
287 AecMetrics my_metrics; 287 AecMetrics my_metrics;
288 memset(&my_metrics, 0, sizeof(my_metrics)); 288 memset(&my_metrics, 0, sizeof(my_metrics));
289 memset(metrics, 0, sizeof(Metrics)); 289 memset(metrics, 0, sizeof(Metrics));
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 // TODO(bjornv): How should we handle the multi-channel case? 358 // TODO(bjornv): How should we handle the multi-channel case?
359 int EchoCancellationImpl::GetDelayMetrics(int* median, int* std) { 359 int EchoCancellationImpl::GetDelayMetrics(int* median, int* std) {
360 rtc::CritScope cs(crit_capture_); 360 rtc::CritScope cs(crit_capture_);
361 float fraction_poor_delays = 0; 361 float fraction_poor_delays = 0;
362 return GetDelayMetrics(median, std, &fraction_poor_delays); 362 return GetDelayMetrics(median, std, &fraction_poor_delays);
363 } 363 }
364 364
365 int EchoCancellationImpl::GetDelayMetrics(int* median, int* std, 365 int EchoCancellationImpl::GetDelayMetrics(int* median, int* std,
366 float* fraction_poor_delays) { 366 float* fraction_poor_delays) {
367 rtc::CritScope cs(crit_capture_); 367 rtc::CritScope cs(crit_capture_);
368 if (median == NULL) { 368 if (median == nullptr) {
369 return AudioProcessing::kNullPointerError; 369 return AudioProcessing::kNullPointerError;
370 } 370 }
371 if (std == NULL) { 371 if (std == nullptr) {
372 return AudioProcessing::kNullPointerError; 372 return AudioProcessing::kNullPointerError;
373 } 373 }
374 374
375 if (!enabled_ || !delay_logging_enabled_) { 375 if (!enabled_ || !delay_logging_enabled_) {
376 return AudioProcessing::kNotEnabledError; 376 return AudioProcessing::kNotEnabledError;
377 } 377 }
378 378
379 const int err = WebRtcAec_GetDelayMetrics(cancellers_[0]->state(), median, 379 const int err = WebRtcAec_GetDelayMetrics(cancellers_[0]->state(), median,
380 std, fraction_poor_delays); 380 std, fraction_poor_delays);
381 if (err != AudioProcessing::kNoError) { 381 if (err != AudioProcessing::kNoError) {
382 return MapError(err); 382 return MapError(err);
383 } 383 }
384 384
385 return AudioProcessing::kNoError; 385 return AudioProcessing::kNoError;
386 } 386 }
387 387
388 struct AecCore* EchoCancellationImpl::aec_core() const { 388 struct AecCore* EchoCancellationImpl::aec_core() const {
389 rtc::CritScope cs(crit_capture_); 389 rtc::CritScope cs(crit_capture_);
390 if (!enabled_) { 390 if (!enabled_) {
391 return NULL; 391 return nullptr;
392 } 392 }
393 return WebRtcAec_aec_core(cancellers_[0]->state()); 393 return WebRtcAec_aec_core(cancellers_[0]->state());
394 } 394 }
395 395
396 void EchoCancellationImpl::Initialize(int sample_rate_hz, 396 void EchoCancellationImpl::Initialize(int sample_rate_hz,
397 size_t num_reverse_channels, 397 size_t num_reverse_channels,
398 size_t num_output_channels, 398 size_t num_output_channels,
399 size_t num_proc_channels) { 399 size_t num_proc_channels) {
400 rtc::CritScope cs_render(crit_render_); 400 rtc::CritScope cs_render(crit_render_);
401 rtc::CritScope cs_capture(crit_capture_); 401 rtc::CritScope cs_capture(crit_capture_);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 return error; 493 return error;
494 } 494 }
495 495
496 size_t EchoCancellationImpl::NumCancellersRequired( 496 size_t EchoCancellationImpl::NumCancellersRequired(
497 size_t num_output_channels, 497 size_t num_output_channels,
498 size_t num_reverse_channels) { 498 size_t num_reverse_channels) {
499 return num_output_channels * num_reverse_channels; 499 return num_output_channels * num_reverse_channels;
500 } 500 }
501 501
502 } // namespace webrtc 502 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698