| Index: webrtc/modules/audio_processing/echo_detector/echo_detector.h
|
| diff --git a/webrtc/modules/audio_processing/echo_detector/echo_detector.h b/webrtc/modules/audio_processing/echo_detector/echo_detector.h
|
| index d9c8bd5d18799c23d277c3883126759a3566f20d..a9bae9d550c8d82a50a73fa3438a5f2527a518a3 100644
|
| --- a/webrtc/modules/audio_processing/echo_detector/echo_detector.h
|
| +++ b/webrtc/modules/audio_processing/echo_detector/echo_detector.h
|
| @@ -11,21 +11,56 @@
|
| #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_DETECTOR_ECHO_DETECTOR_H_
|
| #define WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_DETECTOR_ECHO_DETECTOR_H_
|
|
|
| -#include <stddef.h>
|
| +#include <vector>
|
| +
|
| #include "webrtc/base/array_view.h"
|
| +#include "webrtc/modules/audio_processing/echo_detector/circular_buffer.h"
|
| +#include "webrtc/modules/audio_processing/echo_detector/mean_variance_estimator.h"
|
| +#include "webrtc/modules/audio_processing/echo_detector/normalized_covariance_estimator.h"
|
|
|
| namespace webrtc {
|
|
|
| class EchoDetector {
|
| public:
|
| - EchoDetector() {}
|
| - ~EchoDetector() {}
|
| + EchoDetector();
|
| + ~EchoDetector();
|
| +
|
| + void BufferRender(rtc::ArrayView<const float> render);
|
| +
|
| + void Process(rtc::ArrayView<const float> capture);
|
| +
|
| + void Initialize();
|
| +
|
| + float echo_likelihood() const { return echo_likelihood_; }
|
|
|
| - void BufferFarend(const rtc::ArrayView<const float>& farend);
|
| + private:
|
| + // Keep track if the |Process| function has been previously called.
|
| + bool first_process_call_ = true;
|
| + // Buffer for storing the power of incoming farend buffers. This is needed for
|
| + // cases where calls to BufferFarend and Process are jittery.
|
| + CircularBuffer render_buffer_;
|
| + // Count how long ago it was that the size of |render_buffer_| was zero. This
|
| + // value is also reset to zero when clock drift is detected and a value from
|
| + // the renderbuffer is discarded, even though the buffer is not actually zero
|
| + // at that point. This is done to avoid repeatedly removing elements in this
|
| + // situation.
|
| + size_t frames_since_zero_buffer_size_ = 0;
|
|
|
| - void Process(const rtc::ArrayView<const float>& nearend);
|
| + // Circular buffers containing delayed versions of the power, mean and
|
| + // standard deviation, for calculating the delayed covariance values.
|
| + std::vector<float> render_power_;
|
| + std::vector<float> render_power_mean_;
|
| + std::vector<float> render_power_std_dev_;
|
| + // Covariance estimates for different delay values.
|
| + std::vector<NormalizedCovarianceEstimator> covariances_;
|
| + // Index where next element should be inserted in all of the above circular
|
| + // buffers.
|
| + size_t next_insertion_index_ = 0;
|
|
|
| - void Initialize(int sample_rate_hz);
|
| + MeanVarianceEstimator render_statistics_;
|
| + MeanVarianceEstimator capture_statistics_;
|
| + // Current echo likelihood.
|
| + float echo_likelihood_ = 0.f;
|
| };
|
|
|
| } // namespace webrtc
|
|
|