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