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(const Statistic& other) { | |
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 | |
540 // These provide access to the component interfaces and should never return | 472 // These provide access to the component interfaces and should never return |
541 // NULL. The pointers will be valid for the lifetime of the APM instance. | 473 // NULL. The pointers will be valid for the lifetime of the APM instance. |
542 // The memory for these objects is entirely managed internally. | 474 // The memory for these objects is entirely managed internally. |
543 virtual EchoCancellation* echo_cancellation() const = 0; | 475 virtual EchoCancellation* echo_cancellation() const = 0; |
544 virtual EchoControlMobile* echo_control_mobile() const = 0; | 476 virtual EchoControlMobile* echo_control_mobile() const = 0; |
545 virtual GainControl* gain_control() const = 0; | 477 virtual GainControl* gain_control() const = 0; |
546 virtual HighPassFilter* high_pass_filter() const = 0; | 478 virtual HighPassFilter* high_pass_filter() const = 0; |
547 virtual LevelEstimator* level_estimator() const = 0; | 479 virtual LevelEstimator* level_estimator() const = 0; |
548 virtual NoiseSuppression* noise_suppression() const = 0; | 480 virtual NoiseSuppression* noise_suppression() const = 0; |
549 virtual VoiceDetection* voice_detection() const = 0; | 481 virtual VoiceDetection* voice_detection() const = 0; |
550 | 482 |
| 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 |
551 enum Error { | 490 enum Error { |
552 // Fatal errors. | 491 // Fatal errors. |
553 kNoError = 0, | 492 kNoError = 0, |
554 kUnspecifiedError = -1, | 493 kUnspecifiedError = -1, |
555 kCreationFailedError = -2, | 494 kCreationFailedError = -2, |
556 kUnsupportedComponentError = -3, | 495 kUnsupportedComponentError = -3, |
557 kUnsupportedFunctionError = -4, | 496 kUnsupportedFunctionError = -4, |
558 kNullPointerError = -5, | 497 kNullPointerError = -5, |
559 kBadParameterError = -6, | 498 kBadParameterError = -6, |
560 kBadSampleRateError = -7, | 499 kBadSampleRateError = -7, |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 AudioProcessing::Statistic echo_return_loss_enhancement; | 701 AudioProcessing::Statistic echo_return_loss_enhancement; |
763 | 702 |
764 // (Pre non-linear processing suppression) A_NLP = 10log_10(P_echo / P_a) | 703 // (Pre non-linear processing suppression) A_NLP = 10log_10(P_echo / P_a) |
765 AudioProcessing::Statistic a_nlp; | 704 AudioProcessing::Statistic a_nlp; |
766 | 705 |
767 // Fraction of time that the AEC linear filter is divergent, in a 1-second | 706 // Fraction of time that the AEC linear filter is divergent, in a 1-second |
768 // non-overlapped aggregation window. | 707 // non-overlapped aggregation window. |
769 float divergent_filter_fraction; | 708 float divergent_filter_fraction; |
770 }; | 709 }; |
771 | 710 |
772 // Deprecated. Use GetStatistics on the AudioProcessing interface instead. | |
773 // TODO(ajm): discuss the metrics update period. | 711 // TODO(ajm): discuss the metrics update period. |
774 virtual int GetMetrics(Metrics* metrics) = 0; | 712 virtual int GetMetrics(Metrics* metrics) = 0; |
775 | 713 |
776 // Enables computation and logging of delay values. Statistics are obtained | 714 // Enables computation and logging of delay values. Statistics are obtained |
777 // through |GetDelayMetrics()|. | 715 // through |GetDelayMetrics()|. |
778 virtual int enable_delay_logging(bool enable) = 0; | 716 virtual int enable_delay_logging(bool enable) = 0; |
779 virtual bool is_delay_logging_enabled() const = 0; | 717 virtual bool is_delay_logging_enabled() const = 0; |
780 | 718 |
781 // The delay metrics consists of the delay |median| and the delay standard | 719 // The delay metrics consists of the delay |median| and the delay standard |
782 // deviation |std|. It also consists of the fraction of delay estimates | 720 // deviation |std|. It also consists of the fraction of delay estimates |
783 // |fraction_poor_delays| that can make the echo cancellation perform poorly. | 721 // |fraction_poor_delays| that can make the echo cancellation perform poorly. |
784 // The values are aggregated until the first call to |GetDelayMetrics()| and | 722 // The values are aggregated until the first call to |GetDelayMetrics()| and |
785 // afterwards aggregated and updated every second. | 723 // afterwards aggregated and updated every second. |
786 // Note that if there are several clients pulling metrics from | 724 // Note that if there are several clients pulling metrics from |
787 // |GetDelayMetrics()| during a session the first call from any of them will | 725 // |GetDelayMetrics()| during a session the first call from any of them will |
788 // change to one second aggregation window for all. | 726 // change to one second aggregation window for all. |
789 // Deprecated. Use GetStatistics on the AudioProcessing interface instead. | 727 // TODO(bjornv): Deprecated, remove. |
790 virtual int GetDelayMetrics(int* median, int* std) = 0; | 728 virtual int GetDelayMetrics(int* median, int* std) = 0; |
791 // Deprecated. Use GetStatistics on the AudioProcessing interface instead. | |
792 virtual int GetDelayMetrics(int* median, int* std, | 729 virtual int GetDelayMetrics(int* median, int* std, |
793 float* fraction_poor_delays) = 0; | 730 float* fraction_poor_delays) = 0; |
794 | 731 |
795 // Returns a pointer to the low level AEC component. In case of multiple | 732 // Returns a pointer to the low level AEC component. In case of multiple |
796 // channels, the pointer to the first one is returned. A NULL pointer is | 733 // channels, the pointer to the first one is returned. A NULL pointer is |
797 // returned when the AEC component is disabled or has not been initialized | 734 // returned when the AEC component is disabled or has not been initialized |
798 // successfully. | 735 // successfully. |
799 virtual struct AecCore* aec_core() const = 0; | 736 virtual struct AecCore* aec_core() const = 0; |
800 | 737 |
801 protected: | 738 protected: |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1061 // This does not impact the size of frames passed to |ProcessStream()|. | 998 // This does not impact the size of frames passed to |ProcessStream()|. |
1062 virtual int set_frame_size_ms(int size) = 0; | 999 virtual int set_frame_size_ms(int size) = 0; |
1063 virtual int frame_size_ms() const = 0; | 1000 virtual int frame_size_ms() const = 0; |
1064 | 1001 |
1065 protected: | 1002 protected: |
1066 virtual ~VoiceDetection() {} | 1003 virtual ~VoiceDetection() {} |
1067 }; | 1004 }; |
1068 } // namespace webrtc | 1005 } // namespace webrtc |
1069 | 1006 |
1070 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ | 1007 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ |
OLD | NEW |