Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 462 virtual int StartDebugRecordingForPlatformFile(rtc::PlatformFile handle) = 0; | 462 virtual int StartDebugRecordingForPlatformFile(rtc::PlatformFile handle) = 0; |
| 463 | 463 |
| 464 // Stops recording debugging information, and closes the file. Recording | 464 // Stops recording debugging information, and closes the file. Recording |
| 465 // cannot be resumed in the same file (without overwriting it). | 465 // cannot be resumed in the same file (without overwriting it). |
| 466 virtual int StopDebugRecording() = 0; | 466 virtual int StopDebugRecording() = 0; |
| 467 | 467 |
| 468 // Use to send UMA histograms at end of a call. Note that all histogram | 468 // Use to send UMA histograms at end of a call. Note that all histogram |
| 469 // specific member variables are reset. | 469 // specific member variables are reset. |
| 470 virtual void UpdateHistogramsOnCallEnd() = 0; | 470 virtual void UpdateHistogramsOnCallEnd() = 0; |
| 471 | 471 |
| 472 struct Statistic { | |
| 473 int instant; // Instantaneous value. | |
|
the sun
2016/10/24 08:26:58
Since you're changing the API, I think it'd be bet
ivoc
2016/10/24 14:15:49
I'm actually trying not to change the old statisti
| |
| 474 int average; // Long-term average. | |
| 475 int maximum; // Long-term maximum. | |
| 476 int minimum; // Long-term minimum. | |
| 477 }; | |
| 478 struct AudioProcessingStatistics { | |
| 479 // AEC Statistics. | |
| 480 // RERL = ERL + ERLE | |
| 481 Statistic residual_echo_return_loss = {0, 0, 0, 0}; | |
|
the sun
2016/10/24 08:26:58
With default init, no need for this (error-prone)
ivoc
2016/10/24 14:15:49
Good idea.
| |
| 482 // ERL = 10log_10(P_far / P_echo) | |
| 483 Statistic echo_return_loss = {0, 0, 0, 0}; | |
| 484 // ERLE = 10log_10(P_echo / P_out) | |
| 485 Statistic echo_return_loss_enhancement = {0, 0, 0, 0}; | |
| 486 // (Pre non-linear processing suppression) A_NLP = 10log_10(P_echo / P_a) | |
| 487 Statistic a_nlp = {0, 0, 0, 0}; | |
| 488 // Fraction of time that the AEC linear filter is divergent, in a 1-second | |
| 489 // non-overlapped aggregation window. | |
| 490 float divergent_filter_fraction = 0.0f; | |
| 491 | |
| 492 // The delay metrics consists of the delay median and standard deviation. It | |
| 493 // also consists of the fraction of delay estimates that can make the echo | |
| 494 // cancellation perform poorly. The values are aggregated until the first | |
| 495 // call to |GetStatistics()| and afterwards aggregated and updated every | |
| 496 // second. Note that if there are several clients pulling metrics from | |
| 497 // |GetStatistics()| during a session the first call from any of them will | |
| 498 // change to one second aggregation window for all. | |
| 499 int delay_median = 0; | |
| 500 int delay_standard_deviation = 0; | |
| 501 float fraction_poor_delays = 0.0f; | |
| 502 | |
| 503 // Residual echo detector likelihood. This value is not yet calculated and | |
| 504 // is currently always set to zero. | |
| 505 // TODO(ivoc): Implement this stat. | |
| 506 float residual_echo_likelihood = 0.0f; | |
| 507 }; | |
| 508 | |
| 509 virtual void SetStatisticsEnabled(bool enabled) = 0; | |
|
peah-webrtc
2016/10/21 07:02:45
Do we need to have an enable statistics method? Ca
the sun
2016/10/24 08:26:58
Agree, but are you sure they're not expensive?
peah-webrtc
2016/10/24 09:44:38
Almost, yes, in particular since
-The AEC metrics
ivoc
2016/10/24 14:15:49
Ok, I removed this function.
| |
| 510 virtual void GetStatistics(AudioProcessingStatistics* stats) const = 0; | |
| 511 | |
| 472 // These provide access to the component interfaces and should never return | 512 // These provide access to the component interfaces and should never return |
| 473 // NULL. The pointers will be valid for the lifetime of the APM instance. | 513 // NULL. The pointers will be valid for the lifetime of the APM instance. |
| 474 // The memory for these objects is entirely managed internally. | 514 // The memory for these objects is entirely managed internally. |
| 475 virtual EchoCancellation* echo_cancellation() const = 0; | 515 virtual EchoCancellation* echo_cancellation() const = 0; |
| 476 virtual EchoControlMobile* echo_control_mobile() const = 0; | 516 virtual EchoControlMobile* echo_control_mobile() const = 0; |
| 477 virtual GainControl* gain_control() const = 0; | 517 virtual GainControl* gain_control() const = 0; |
| 478 virtual HighPassFilter* high_pass_filter() const = 0; | 518 virtual HighPassFilter* high_pass_filter() const = 0; |
| 479 virtual LevelEstimator* level_estimator() const = 0; | 519 virtual LevelEstimator* level_estimator() const = 0; |
| 480 virtual NoiseSuppression* noise_suppression() const = 0; | 520 virtual NoiseSuppression* noise_suppression() const = 0; |
| 481 virtual VoiceDetection* voice_detection() const = 0; | 521 virtual VoiceDetection* voice_detection() const = 0; |
| 482 | 522 |
| 483 struct Statistic { | |
| 484 int instant; // Instantaneous value. | |
| 485 int average; // Long-term average. | |
| 486 int maximum; // Long-term maximum. | |
| 487 int minimum; // Long-term minimum. | |
| 488 }; | |
| 489 | |
| 490 enum Error { | 523 enum Error { |
| 491 // Fatal errors. | 524 // Fatal errors. |
| 492 kNoError = 0, | 525 kNoError = 0, |
| 493 kUnspecifiedError = -1, | 526 kUnspecifiedError = -1, |
| 494 kCreationFailedError = -2, | 527 kCreationFailedError = -2, |
| 495 kUnsupportedComponentError = -3, | 528 kUnsupportedComponentError = -3, |
| 496 kUnsupportedFunctionError = -4, | 529 kUnsupportedFunctionError = -4, |
| 497 kNullPointerError = -5, | 530 kNullPointerError = -5, |
| 498 kBadParameterError = -6, | 531 kBadParameterError = -6, |
| 499 kBadSampleRateError = -7, | 532 kBadSampleRateError = -7, |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 701 AudioProcessing::Statistic echo_return_loss_enhancement; | 734 AudioProcessing::Statistic echo_return_loss_enhancement; |
| 702 | 735 |
| 703 // (Pre non-linear processing suppression) A_NLP = 10log_10(P_echo / P_a) | 736 // (Pre non-linear processing suppression) A_NLP = 10log_10(P_echo / P_a) |
| 704 AudioProcessing::Statistic a_nlp; | 737 AudioProcessing::Statistic a_nlp; |
| 705 | 738 |
| 706 // Fraction of time that the AEC linear filter is divergent, in a 1-second | 739 // Fraction of time that the AEC linear filter is divergent, in a 1-second |
| 707 // non-overlapped aggregation window. | 740 // non-overlapped aggregation window. |
| 708 float divergent_filter_fraction; | 741 float divergent_filter_fraction; |
| 709 }; | 742 }; |
| 710 | 743 |
| 744 // Deprecated. Use GetStatistics on the AudioProcessing interface instead. | |
| 711 // TODO(ajm): discuss the metrics update period. | 745 // TODO(ajm): discuss the metrics update period. |
| 712 virtual int GetMetrics(Metrics* metrics) = 0; | 746 virtual int GetMetrics(Metrics* metrics) = 0; |
| 713 | 747 |
| 714 // Enables computation and logging of delay values. Statistics are obtained | 748 // Enables computation and logging of delay values. Statistics are obtained |
| 715 // through |GetDelayMetrics()|. | 749 // through |GetDelayMetrics()|. |
| 716 virtual int enable_delay_logging(bool enable) = 0; | 750 virtual int enable_delay_logging(bool enable) = 0; |
| 717 virtual bool is_delay_logging_enabled() const = 0; | 751 virtual bool is_delay_logging_enabled() const = 0; |
| 718 | 752 |
| 719 // The delay metrics consists of the delay |median| and the delay standard | 753 // The delay metrics consists of the delay |median| and the delay standard |
| 720 // deviation |std|. It also consists of the fraction of delay estimates | 754 // deviation |std|. It also consists of the fraction of delay estimates |
| 721 // |fraction_poor_delays| that can make the echo cancellation perform poorly. | 755 // |fraction_poor_delays| that can make the echo cancellation perform poorly. |
| 722 // The values are aggregated until the first call to |GetDelayMetrics()| and | 756 // The values are aggregated until the first call to |GetDelayMetrics()| and |
| 723 // afterwards aggregated and updated every second. | 757 // afterwards aggregated and updated every second. |
| 724 // Note that if there are several clients pulling metrics from | 758 // Note that if there are several clients pulling metrics from |
| 725 // |GetDelayMetrics()| during a session the first call from any of them will | 759 // |GetDelayMetrics()| during a session the first call from any of them will |
| 726 // change to one second aggregation window for all. | 760 // change to one second aggregation window for all. |
| 727 // TODO(bjornv): Deprecated, remove. | 761 // Deprecated. Use GetStatistics on the AudioProcessing interface instead. |
| 728 virtual int GetDelayMetrics(int* median, int* std) = 0; | 762 virtual int GetDelayMetrics(int* median, int* std) = 0; |
| 763 // Deprecated. Use GetStatistics on the AudioProcessing interface instead. | |
| 729 virtual int GetDelayMetrics(int* median, int* std, | 764 virtual int GetDelayMetrics(int* median, int* std, |
| 730 float* fraction_poor_delays) = 0; | 765 float* fraction_poor_delays) = 0; |
| 731 | 766 |
| 732 // Returns a pointer to the low level AEC component. In case of multiple | 767 // Returns a pointer to the low level AEC component. In case of multiple |
| 733 // channels, the pointer to the first one is returned. A NULL pointer is | 768 // channels, the pointer to the first one is returned. A NULL pointer is |
| 734 // returned when the AEC component is disabled or has not been initialized | 769 // returned when the AEC component is disabled or has not been initialized |
| 735 // successfully. | 770 // successfully. |
| 736 virtual struct AecCore* aec_core() const = 0; | 771 virtual struct AecCore* aec_core() const = 0; |
| 737 | 772 |
| 738 protected: | 773 protected: |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 998 // This does not impact the size of frames passed to |ProcessStream()|. | 1033 // This does not impact the size of frames passed to |ProcessStream()|. |
| 999 virtual int set_frame_size_ms(int size) = 0; | 1034 virtual int set_frame_size_ms(int size) = 0; |
| 1000 virtual int frame_size_ms() const = 0; | 1035 virtual int frame_size_ms() const = 0; |
| 1001 | 1036 |
| 1002 protected: | 1037 protected: |
| 1003 virtual ~VoiceDetection() {} | 1038 virtual ~VoiceDetection() {} |
| 1004 }; | 1039 }; |
| 1005 } // namespace webrtc | 1040 } // namespace webrtc |
| 1006 | 1041 |
| 1007 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ | 1042 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ |
| OLD | NEW |