Original CL: https://codereview.webrtc.org/2433153003/, commit 8b8d3e4c30e8ea3846b58dfd36d1fd35a7799df4.

Revert CL: https://codereview.webrtc.org/2456333002/, commit 48dfab5c58119a4e65c52506ed55f8de79725bcf.

The new function on the APM interface is no longer pure virtual.

BUG=webrtc:6525
TBR=solenberg@webrtc.org,peah@webrtc.org

Review-Url: https://codereview.webrtc.org/2458993002
Cr-Commit-Position: refs/heads/master@{#14827}
This commit is contained in:
ivoc
2016-10-28 07:55:33 -07:00
committed by Commit bot
parent 1e45cc6ee0
commit 3e9a537601
8 changed files with 138 additions and 26 deletions

View File

@ -472,6 +472,75 @@ class AudioProcessing {
// specific member variables are reset.
virtual void UpdateHistogramsOnCallEnd() = 0;
// TODO(ivoc): Remove when the calling code no longer uses the old Statistics
// API.
struct Statistic {
int instant = 0; // Instantaneous value.
int average = 0; // Long-term average.
int maximum = 0; // Long-term maximum.
int minimum = 0; // Long-term minimum.
};
struct Stat {
void Set(const Statistic& other) {
Set(other.instant, other.average, other.maximum, other.minimum);
}
void Set(float instant, float average, float maximum, float minimum) {
RTC_DCHECK_LE(instant, maximum);
RTC_DCHECK_GE(instant, minimum);
RTC_DCHECK_LE(average, maximum);
RTC_DCHECK_GE(average, minimum);
instant_ = instant;
average_ = average;
maximum_ = maximum;
minimum_ = minimum;
}
float instant() const { return instant_; }
float average() const { return average_; }
float maximum() const { return maximum_; }
float minimum() const { return minimum_; }
private:
float instant_ = 0.0f; // Instantaneous value.
float average_ = 0.0f; // Long-term average.
float maximum_ = 0.0f; // Long-term maximum.
float minimum_ = 0.0f; // Long-term minimum.
};
struct AudioProcessingStatistics {
// AEC Statistics.
// RERL = ERL + ERLE
Stat residual_echo_return_loss;
// ERL = 10log_10(P_far / P_echo)
Stat echo_return_loss;
// ERLE = 10log_10(P_echo / P_out)
Stat echo_return_loss_enhancement;
// (Pre non-linear processing suppression) A_NLP = 10log_10(P_echo / P_a)
Stat a_nlp;
// Fraction of time that the AEC linear filter is divergent, in a 1-second
// non-overlapped aggregation window.
float divergent_filter_fraction = 0.0f;
// The delay metrics consists of the delay median and standard deviation. It
// also consists of the fraction of delay estimates that can make the echo
// cancellation perform poorly. The values are aggregated until the first
// call to |GetStatistics()| and afterwards aggregated and updated every
// second. Note that if there are several clients pulling metrics from
// |GetStatistics()| during a session the first call from any of them will
// change to one second aggregation window for all.
int delay_median = 0;
int delay_standard_deviation = 0;
float fraction_poor_delays = 0.0f;
// Residual echo detector likelihood. This value is not yet calculated and
// is currently always set to zero.
// TODO(ivoc): Implement this stat.
float residual_echo_likelihood = 0.0f;
};
// TODO(ivoc): Make this pure virtual when all subclasses have been updated.
virtual AudioProcessingStatistics GetStatistics() const;
// These provide access to the component interfaces and should never return
// NULL. The pointers will be valid for the lifetime of the APM instance.
// The memory for these objects is entirely managed internally.
@ -483,13 +552,6 @@ class AudioProcessing {
virtual NoiseSuppression* noise_suppression() const = 0;
virtual VoiceDetection* voice_detection() const = 0;
struct Statistic {
int instant; // Instantaneous value.
int average; // Long-term average.
int maximum; // Long-term maximum.
int minimum; // Long-term minimum.
};
enum Error {
// Fatal errors.
kNoError = 0,
@ -711,6 +773,7 @@ class EchoCancellation {
float divergent_filter_fraction;
};
// Deprecated. Use GetStatistics on the AudioProcessing interface instead.
// TODO(ajm): discuss the metrics update period.
virtual int GetMetrics(Metrics* metrics) = 0;
@ -727,8 +790,9 @@ class EchoCancellation {
// Note that if there are several clients pulling metrics from
// |GetDelayMetrics()| during a session the first call from any of them will
// change to one second aggregation window for all.
// TODO(bjornv): Deprecated, remove.
// Deprecated. Use GetStatistics on the AudioProcessing interface instead.
virtual int GetDelayMetrics(int* median, int* std) = 0;
// Deprecated. Use GetStatistics on the AudioProcessing interface instead.
virtual int GetDelayMetrics(int* median, int* std,
float* fraction_poor_delays) = 0;