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 ValueStatistic { | |
the sun
2016/10/24 15:15:43
How about "Stat"?
I'm thinking in the future we m
ivoc
2016/10/24 15:50:42
Sounds good.
| |
482 ValueStatistic() = default; | |
483 ValueStatistic(ValueStatistic& other) { | |
the sun
2016/10/24 15:15:44
why not "default"?
ivoc
2016/10/24 15:50:42
Turns out it's not actually necessary to define th
the sun
2016/10/25 06:44:12
have you tried building everywhere? clang complain
ivoc
2016/10/25 09:38:45
It seems to build fine on the trybots, so I guess
| |
484 instant_ = other.instant(); | |
485 average_ = other.average(); | |
486 maximum_ = other.maximum(); | |
487 minimum_ = other.minimum(); | |
488 } | |
489 ValueStatistic(Statistic& other) { | |
the sun
2016/10/24 15:15:43
Make the conversion explicit
ivoc
2016/10/24 15:50:42
I changed this into another Set function that take
the sun
2016/10/25 06:44:12
sgtm
| |
490 instant_ = other.instant; | |
491 average_ = other.average; | |
492 maximum_ = other.maximum; | |
493 minimum_ = other.minimum; | |
494 } | |
495 | |
496 void SetValues(float instant, float average, float maximum, float minimum) { | |
the sun
2016/10/24 15:15:44
nit: Just "Set"
ivoc
2016/10/24 15:50:42
Done.
| |
497 RTC_DCHECK_LE(instant, maximum); | |
498 RTC_DCHECK_GE(instant, minimum); | |
499 RTC_DCHECK_LE(average, maximum); | |
500 RTC_DCHECK_GE(average, minimum); | |
501 instant_ = instant; | |
502 average_ = average; | |
503 maximum_ = maximum; | |
504 minimum_ = minimum; | |
505 } | |
506 float instant() const { return instant_; } | |
507 float average() const { return average_; } | |
508 float maximum() const { return maximum_; } | |
509 float minimum() const { return minimum_; } | |
510 | |
511 private: | |
512 float instant_ = 0.0f; // Instantaneous value. | |
513 float average_ = 0.0f; // Long-term average. | |
514 float maximum_ = 0.0f; // Long-term maximum. | |
515 float minimum_ = 0.0f; // Long-term minimum. | |
516 }; | |
517 | |
518 struct AudioProcessingStatistics { | |
519 // AEC Statistics. | |
520 // RERL = ERL + ERLE | |
521 ValueStatistic residual_echo_return_loss; | |
522 // ERL = 10log_10(P_far / P_echo) | |
523 ValueStatistic echo_return_loss; | |
524 // ERLE = 10log_10(P_echo / P_out) | |
525 ValueStatistic echo_return_loss_enhancement; | |
526 // (Pre non-linear processing suppression) A_NLP = 10log_10(P_echo / P_a) | |
527 ValueStatistic a_nlp; | |
528 // Fraction of time that the AEC linear filter is divergent, in a 1-second | |
529 // non-overlapped aggregation window. | |
530 float divergent_filter_fraction = 0.0f; | |
531 | |
532 // The delay metrics consists of the delay median and standard deviation. It | |
533 // also consists of the fraction of delay estimates that can make the echo | |
534 // cancellation perform poorly. The values are aggregated until the first | |
535 // call to |GetStatistics()| and afterwards aggregated and updated every | |
536 // second. Note that if there are several clients pulling metrics from | |
537 // |GetStatistics()| during a session the first call from any of them will | |
538 // change to one second aggregation window for all. | |
539 int delay_median = 0; | |
540 int delay_standard_deviation = 0; | |
541 float fraction_poor_delays = 0.0f; | |
542 | |
543 // Residual echo detector likelihood. This value is not yet calculated and | |
544 // is currently always set to zero. | |
545 // TODO(ivoc): Implement this stat. | |
546 float residual_echo_likelihood = 0.0f; | |
547 }; | |
548 | |
549 virtual AudioProcessingStatistics GetStatistics() const = 0; | |
550 | |
472 // These provide access to the component interfaces and should never return | 551 // 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. | 552 // NULL. The pointers will be valid for the lifetime of the APM instance. |
474 // The memory for these objects is entirely managed internally. | 553 // The memory for these objects is entirely managed internally. |
475 virtual EchoCancellation* echo_cancellation() const = 0; | 554 virtual EchoCancellation* echo_cancellation() const = 0; |
476 virtual EchoControlMobile* echo_control_mobile() const = 0; | 555 virtual EchoControlMobile* echo_control_mobile() const = 0; |
477 virtual GainControl* gain_control() const = 0; | 556 virtual GainControl* gain_control() const = 0; |
478 virtual HighPassFilter* high_pass_filter() const = 0; | 557 virtual HighPassFilter* high_pass_filter() const = 0; |
479 virtual LevelEstimator* level_estimator() const = 0; | 558 virtual LevelEstimator* level_estimator() const = 0; |
480 virtual NoiseSuppression* noise_suppression() const = 0; | 559 virtual NoiseSuppression* noise_suppression() const = 0; |
481 virtual VoiceDetection* voice_detection() const = 0; | 560 virtual VoiceDetection* voice_detection() const = 0; |
482 | 561 |
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 { | 562 enum Error { |
491 // Fatal errors. | 563 // Fatal errors. |
492 kNoError = 0, | 564 kNoError = 0, |
493 kUnspecifiedError = -1, | 565 kUnspecifiedError = -1, |
494 kCreationFailedError = -2, | 566 kCreationFailedError = -2, |
495 kUnsupportedComponentError = -3, | 567 kUnsupportedComponentError = -3, |
496 kUnsupportedFunctionError = -4, | 568 kUnsupportedFunctionError = -4, |
497 kNullPointerError = -5, | 569 kNullPointerError = -5, |
498 kBadParameterError = -6, | 570 kBadParameterError = -6, |
499 kBadSampleRateError = -7, | 571 kBadSampleRateError = -7, |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
701 AudioProcessing::Statistic echo_return_loss_enhancement; | 773 AudioProcessing::Statistic echo_return_loss_enhancement; |
702 | 774 |
703 // (Pre non-linear processing suppression) A_NLP = 10log_10(P_echo / P_a) | 775 // (Pre non-linear processing suppression) A_NLP = 10log_10(P_echo / P_a) |
704 AudioProcessing::Statistic a_nlp; | 776 AudioProcessing::Statistic a_nlp; |
705 | 777 |
706 // Fraction of time that the AEC linear filter is divergent, in a 1-second | 778 // Fraction of time that the AEC linear filter is divergent, in a 1-second |
707 // non-overlapped aggregation window. | 779 // non-overlapped aggregation window. |
708 float divergent_filter_fraction; | 780 float divergent_filter_fraction; |
709 }; | 781 }; |
710 | 782 |
783 // Deprecated. Use GetStatistics on the AudioProcessing interface instead. | |
711 // TODO(ajm): discuss the metrics update period. | 784 // TODO(ajm): discuss the metrics update period. |
712 virtual int GetMetrics(Metrics* metrics) = 0; | 785 virtual int GetMetrics(Metrics* metrics) = 0; |
713 | 786 |
714 // Enables computation and logging of delay values. Statistics are obtained | 787 // Enables computation and logging of delay values. Statistics are obtained |
715 // through |GetDelayMetrics()|. | 788 // through |GetDelayMetrics()|. |
716 virtual int enable_delay_logging(bool enable) = 0; | 789 virtual int enable_delay_logging(bool enable) = 0; |
717 virtual bool is_delay_logging_enabled() const = 0; | 790 virtual bool is_delay_logging_enabled() const = 0; |
718 | 791 |
719 // The delay metrics consists of the delay |median| and the delay standard | 792 // The delay metrics consists of the delay |median| and the delay standard |
720 // deviation |std|. It also consists of the fraction of delay estimates | 793 // deviation |std|. It also consists of the fraction of delay estimates |
721 // |fraction_poor_delays| that can make the echo cancellation perform poorly. | 794 // |fraction_poor_delays| that can make the echo cancellation perform poorly. |
722 // The values are aggregated until the first call to |GetDelayMetrics()| and | 795 // The values are aggregated until the first call to |GetDelayMetrics()| and |
723 // afterwards aggregated and updated every second. | 796 // afterwards aggregated and updated every second. |
724 // Note that if there are several clients pulling metrics from | 797 // Note that if there are several clients pulling metrics from |
725 // |GetDelayMetrics()| during a session the first call from any of them will | 798 // |GetDelayMetrics()| during a session the first call from any of them will |
726 // change to one second aggregation window for all. | 799 // change to one second aggregation window for all. |
727 // TODO(bjornv): Deprecated, remove. | 800 // Deprecated. Use GetStatistics on the AudioProcessing interface instead. |
728 virtual int GetDelayMetrics(int* median, int* std) = 0; | 801 virtual int GetDelayMetrics(int* median, int* std) = 0; |
802 // Deprecated. Use GetStatistics on the AudioProcessing interface instead. | |
729 virtual int GetDelayMetrics(int* median, int* std, | 803 virtual int GetDelayMetrics(int* median, int* std, |
730 float* fraction_poor_delays) = 0; | 804 float* fraction_poor_delays) = 0; |
731 | 805 |
732 // Returns a pointer to the low level AEC component. In case of multiple | 806 // 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 | 807 // 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 | 808 // returned when the AEC component is disabled or has not been initialized |
735 // successfully. | 809 // successfully. |
736 virtual struct AecCore* aec_core() const = 0; | 810 virtual struct AecCore* aec_core() const = 0; |
737 | 811 |
738 protected: | 812 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()|. | 1072 // This does not impact the size of frames passed to |ProcessStream()|. |
999 virtual int set_frame_size_ms(int size) = 0; | 1073 virtual int set_frame_size_ms(int size) = 0; |
1000 virtual int frame_size_ms() const = 0; | 1074 virtual int frame_size_ms() const = 0; |
1001 | 1075 |
1002 protected: | 1076 protected: |
1003 virtual ~VoiceDetection() {} | 1077 virtual ~VoiceDetection() {} |
1004 }; | 1078 }; |
1005 } // namespace webrtc | 1079 } // namespace webrtc |
1006 | 1080 |
1007 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ | 1081 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ |
OLD | NEW |