LCOV - code coverage report
Current view: top level - media/webrtc/trunk/webrtc/modules/audio_processing - residual_echo_detector.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 4 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 3 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  *  Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
       3             :  *
       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
       6             :  *  tree. An additional intellectual property rights grant can be found
       7             :  *  in the file PATENTS.  All contributing project authors may
       8             :  *  be found in the AUTHORS file in the root of the source tree.
       9             :  */
      10             : 
      11             : #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_RESIDUAL_ECHO_DETECTOR_H_
      12             : #define WEBRTC_MODULES_AUDIO_PROCESSING_RESIDUAL_ECHO_DETECTOR_H_
      13             : 
      14             : #include <vector>
      15             : 
      16             : #include "webrtc/base/array_view.h"
      17             : #include "webrtc/modules/audio_processing/echo_detector/circular_buffer.h"
      18             : #include "webrtc/modules/audio_processing/echo_detector/mean_variance_estimator.h"
      19             : #include "webrtc/modules/audio_processing/echo_detector/moving_max.h"
      20             : #include "webrtc/modules/audio_processing/echo_detector/normalized_covariance_estimator.h"
      21             : 
      22             : namespace webrtc {
      23             : 
      24             : class AudioBuffer;
      25             : class EchoDetector;
      26             : 
      27           0 : class ResidualEchoDetector {
      28             :  public:
      29             :   ResidualEchoDetector();
      30             :   ~ResidualEchoDetector();
      31             : 
      32             :   // This function should be called while holding the render lock.
      33             :   void AnalyzeRenderAudio(rtc::ArrayView<const float> render_audio);
      34             : 
      35             :   // This function should be called while holding the capture lock.
      36             :   void AnalyzeCaptureAudio(rtc::ArrayView<const float> capture_audio);
      37             : 
      38             :   // This function should be called while holding the capture lock.
      39             :   void Initialize();
      40             : 
      41             :   // This function is for testing purposes only.
      42             :   void SetReliabilityForTest(float value) { reliability_ = value; }
      43             : 
      44             :   static void PackRenderAudioBuffer(AudioBuffer* audio,
      45             :                                     std::vector<float>* packed_buffer);
      46             : 
      47             :   // This function should be called while holding the capture lock.
      48           0 :   float echo_likelihood() const { return echo_likelihood_; }
      49             : 
      50           0 :   float echo_likelihood_recent_max() const {
      51           0 :     return recent_likelihood_max_.max();
      52             :   }
      53             : 
      54             :  private:
      55             :   // Keep track if the |Process| function has been previously called.
      56             :   bool first_process_call_ = true;
      57             :   // Buffer for storing the power of incoming farend buffers. This is needed for
      58             :   // cases where calls to BufferFarend and Process are jittery.
      59             :   CircularBuffer render_buffer_;
      60             :   // Count how long ago it was that the size of |render_buffer_| was zero. This
      61             :   // value is also reset to zero when clock drift is detected and a value from
      62             :   // the renderbuffer is discarded, even though the buffer is not actually zero
      63             :   // at that point. This is done to avoid repeatedly removing elements in this
      64             :   // situation.
      65             :   size_t frames_since_zero_buffer_size_ = 0;
      66             : 
      67             :   // Circular buffers containing delayed versions of the power, mean and
      68             :   // standard deviation, for calculating the delayed covariance values.
      69             :   std::vector<float> render_power_;
      70             :   std::vector<float> render_power_mean_;
      71             :   std::vector<float> render_power_std_dev_;
      72             :   // Covariance estimates for different delay values.
      73             :   std::vector<NormalizedCovarianceEstimator> covariances_;
      74             :   // Index where next element should be inserted in all of the above circular
      75             :   // buffers.
      76             :   size_t next_insertion_index_ = 0;
      77             : 
      78             :   MeanVarianceEstimator render_statistics_;
      79             :   MeanVarianceEstimator capture_statistics_;
      80             :   // Current echo likelihood.
      81             :   float echo_likelihood_ = 0.f;
      82             :   // Reliability of the current likelihood.
      83             :   float reliability_ = 0.f;
      84             :   MovingMax recent_likelihood_max_;
      85             : };
      86             : 
      87             : }  // namespace webrtc
      88             : 
      89             : #endif  // WEBRTC_MODULES_AUDIO_PROCESSING_RESIDUAL_ECHO_DETECTOR_H_

Generated by: LCOV version 1.13