1 /*
2  *  Copyright (c) 2012 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_AEC_ECHO_CANCELLATION_INTERNAL_H_
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC_ECHO_CANCELLATION_INTERNAL_H_
13 
14 #include "webrtc/common_audio/ring_buffer.h"
15 #include "webrtc/modules/audio_processing/aec/aec_core.h"
16 
17 typedef struct {
18   int delayCtr;
19   int sampFreq;
20   int splitSampFreq;
21   int scSampFreq;
22   float sampFactor;  // scSampRate / sampFreq
23   short skewMode;
24   int bufSizeStart;
25   int knownDelay;
26   int rate_factor;
27 
28   short initFlag;  // indicates if AEC has been initialized
29 
30   // Variables used for averaging far end buffer size
31   short counter;
32   int sum;
33   short firstVal;
34   short checkBufSizeCtr;
35 
36   // Variables used for delay shifts
37   short msInSndCardBuf;
38   short filtDelay;  // Filtered delay estimate.
39   int timeForDelayChange;
40   int startup_phase;
41   int checkBuffSize;
42   short lastDelayDiff;
43 
44 #ifdef WEBRTC_AEC_DEBUG_DUMP
45   FILE* bufFile;
46   FILE* delayFile;
47   FILE* skewFile;
48 #endif
49 
50   // Structures
51   void* resampler;
52 
53   int skewFrCtr;
54   int resample;  // if the skew is small enough we don't resample
55   int highSkewCtr;
56   float skew;
57 
58   RingBuffer* far_pre_buf;  // Time domain far-end pre-buffer.
59 
60   int farend_started;
61 
62   AecCore* aec;
63 } Aec;
64 
65 #endif  // WEBRTC_MODULES_AUDIO_PROCESSING_AEC_ECHO_CANCELLATION_INTERNAL_H_
66