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 // TODO(ivoc): Remove when the calling code no longer uses the old Statistics | |
473 // API. | |
474 struct Statistic { | |
475 int instant = 0; // Instantaneous value. | |
476 int average = 0; // Long-term average. | |
477 int maximum = 0; // Long-term maximum. | |
478 int minimum = 0; // Long-term minimum. | |
479 }; | |
480 | |
481 struct Stat { | |
482 void Set(Statistic& other) { | |
the sun
2016/10/25 06:45:31
const &
| |
483 Set(other.instant, other.average, other.maximum, other.minimum); | |
484 } | |
485 void Set(float instant, float average, float maximum, float minimum) { | |
486 RTC_DCHECK_LE(instant, maximum); | |
487 RTC_DCHECK_GE(instant, minimum); | |
488 RTC_DCHECK_LE(average, maximum); | |
489 RTC_DCHECK_GE(average, minimum); | |
490 instant_ = instant; | |
491 average_ = average; | |
492 maximum_ = maximum; | |
493 minimum_ = minimum; | |
494 } | |
495 float instant() const { return instant_; } | |
496 float average() const { return average_; } | |
497 float maximum() const { return maximum_; } | |
498 float minimum() const { return minimum_; } | |
499 | |
500 private: | |
501 float instant_ = 0.0f; // Instantaneous value. | |
502 float average_ = 0.0f; // Long-term average. | |
503 float maximum_ = 0.0f; // Long-term maximum. | |
504 float minimum_ = 0.0f; // Long-term minimum. | |
505 }; | |
506 | |
507 struct AudioProcessingStatistics { | |
508 // AEC Statistics. | |
509 // RERL = ERL + ERLE | |
510 Stat residual_echo_return_loss; | |
511 // ERL = 10log_10(P_far / P_echo) | |
512 Stat echo_return_loss; | |
513 // ERLE = 10log_10(P_echo / P_out) | |
514 Stat echo_return_loss_enhancement; | |
515 // (Pre non-linear processing suppression) A_NLP = 10log_10(P_echo / P_a) | |
516 Stat a_nlp; | |
517 // Fraction of time that the AEC linear filter is divergent, in a 1-second | |
518 // non-overlapped aggregation window. | |
519 float divergent_filter_fraction = 0.0f; | |
520 | |
521 // The delay metrics consists of the delay median and standard deviation. It | |
522 // also consists of the fraction of delay estimates that can make the echo | |
523 // cancellation perform poorly. The values are aggregated until the first | |
524 // call to |GetStatistics()| and afterwards aggregated and updated every | |
525 // second. Note that if there are several clients pulling metrics from | |
526 // |GetStatistics()| during a session the first call from any of them will | |
527 // change to one second aggregation window for all. | |
528 int delay_median = 0; | |
529 int delay_standard_deviation = 0; | |
530 float fraction_poor_delays = 0.0f; | |
531 | |
532 // Residual echo detector likelihood. This value is not yet calculated and | |
533 // is currently always set to zero. | |
534 // TODO(ivoc): Implement this stat. | |
535 float residual_echo_likelihood = 0.0f; | |
536 }; | |
537 | |
538 virtual AudioProcessingStatistics GetStatistics() const = 0; | |
539 | |
472 // These provide access to the component interfaces and should never return | 540 // 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. | 541 // NULL. The pointers will be valid for the lifetime of the APM instance. |
474 // The memory for these objects is entirely managed internally. | 542 // The memory for these objects is entirely managed internally. |
475 virtual EchoCancellation* echo_cancellation() const = 0; | 543 virtual EchoCancellation* echo_cancellation() const = 0; |
476 virtual EchoControlMobile* echo_control_mobile() const = 0; | 544 virtual EchoControlMobile* echo_control_mobile() const = 0; |
477 virtual GainControl* gain_control() const = 0; | 545 virtual GainControl* gain_control() const = 0; |
478 virtual HighPassFilter* high_pass_filter() const = 0; | 546 virtual HighPassFilter* high_pass_filter() const = 0; |
479 virtual LevelEstimator* level_estimator() const = 0; | 547 virtual LevelEstimator* level_estimator() const = 0; |
480 virtual NoiseSuppression* noise_suppression() const = 0; | 548 virtual NoiseSuppression* noise_suppression() const = 0; |
481 virtual VoiceDetection* voice_detection() const = 0; | 549 virtual VoiceDetection* voice_detection() const = 0; |
482 | 550 |
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 { | 551 enum Error { |
491 // Fatal errors. | 552 // Fatal errors. |
492 kNoError = 0, | 553 kNoError = 0, |
493 kUnspecifiedError = -1, | 554 kUnspecifiedError = -1, |
494 kCreationFailedError = -2, | 555 kCreationFailedError = -2, |
495 kUnsupportedComponentError = -3, | 556 kUnsupportedComponentError = -3, |
496 kUnsupportedFunctionError = -4, | 557 kUnsupportedFunctionError = -4, |
497 kNullPointerError = -5, | 558 kNullPointerError = -5, |
498 kBadParameterError = -6, | 559 kBadParameterError = -6, |
499 kBadSampleRateError = -7, | 560 kBadSampleRateError = -7, |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
701 AudioProcessing::Statistic echo_return_loss_enhancement; | 762 AudioProcessing::Statistic echo_return_loss_enhancement; |
702 | 763 |
703 // (Pre non-linear processing suppression) A_NLP = 10log_10(P_echo / P_a) | 764 // (Pre non-linear processing suppression) A_NLP = 10log_10(P_echo / P_a) |
704 AudioProcessing::Statistic a_nlp; | 765 AudioProcessing::Statistic a_nlp; |
705 | 766 |
706 // Fraction of time that the AEC linear filter is divergent, in a 1-second | 767 // Fraction of time that the AEC linear filter is divergent, in a 1-second |
707 // non-overlapped aggregation window. | 768 // non-overlapped aggregation window. |
708 float divergent_filter_fraction; | 769 float divergent_filter_fraction; |
709 }; | 770 }; |
710 | 771 |
772 // Deprecated. Use GetStatistics on the AudioProcessing interface instead. | |
711 // TODO(ajm): discuss the metrics update period. | 773 // TODO(ajm): discuss the metrics update period. |
712 virtual int GetMetrics(Metrics* metrics) = 0; | 774 virtual int GetMetrics(Metrics* metrics) = 0; |
713 | 775 |
714 // Enables computation and logging of delay values. Statistics are obtained | 776 // Enables computation and logging of delay values. Statistics are obtained |
715 // through |GetDelayMetrics()|. | 777 // through |GetDelayMetrics()|. |
716 virtual int enable_delay_logging(bool enable) = 0; | 778 virtual int enable_delay_logging(bool enable) = 0; |
717 virtual bool is_delay_logging_enabled() const = 0; | 779 virtual bool is_delay_logging_enabled() const = 0; |
718 | 780 |
719 // The delay metrics consists of the delay |median| and the delay standard | 781 // The delay metrics consists of the delay |median| and the delay standard |
720 // deviation |std|. It also consists of the fraction of delay estimates | 782 // deviation |std|. It also consists of the fraction of delay estimates |
721 // |fraction_poor_delays| that can make the echo cancellation perform poorly. | 783 // |fraction_poor_delays| that can make the echo cancellation perform poorly. |
722 // The values are aggregated until the first call to |GetDelayMetrics()| and | 784 // The values are aggregated until the first call to |GetDelayMetrics()| and |
723 // afterwards aggregated and updated every second. | 785 // afterwards aggregated and updated every second. |
724 // Note that if there are several clients pulling metrics from | 786 // Note that if there are several clients pulling metrics from |
725 // |GetDelayMetrics()| during a session the first call from any of them will | 787 // |GetDelayMetrics()| during a session the first call from any of them will |
726 // change to one second aggregation window for all. | 788 // change to one second aggregation window for all. |
727 // TODO(bjornv): Deprecated, remove. | 789 // Deprecated. Use GetStatistics on the AudioProcessing interface instead. |
728 virtual int GetDelayMetrics(int* median, int* std) = 0; | 790 virtual int GetDelayMetrics(int* median, int* std) = 0; |
791 // Deprecated. Use GetStatistics on the AudioProcessing interface instead. | |
729 virtual int GetDelayMetrics(int* median, int* std, | 792 virtual int GetDelayMetrics(int* median, int* std, |
730 float* fraction_poor_delays) = 0; | 793 float* fraction_poor_delays) = 0; |
731 | 794 |
732 // Returns a pointer to the low level AEC component. In case of multiple | 795 // 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 | 796 // 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 | 797 // returned when the AEC component is disabled or has not been initialized |
735 // successfully. | 798 // successfully. |
736 virtual struct AecCore* aec_core() const = 0; | 799 virtual struct AecCore* aec_core() const = 0; |
737 | 800 |
738 protected: | 801 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()|. | 1061 // This does not impact the size of frames passed to |ProcessStream()|. |
999 virtual int set_frame_size_ms(int size) = 0; | 1062 virtual int set_frame_size_ms(int size) = 0; |
1000 virtual int frame_size_ms() const = 0; | 1063 virtual int frame_size_ms() const = 0; |
1001 | 1064 |
1002 protected: | 1065 protected: |
1003 virtual ~VoiceDetection() {} | 1066 virtual ~VoiceDetection() {} |
1004 }; | 1067 }; |
1005 } // namespace webrtc | 1068 } // namespace webrtc |
1006 | 1069 |
1007 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ | 1070 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ |
OLD | NEW |