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_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC_ECHO_CANCELLATION_H_ |
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC_ECHO_CANCELLATION_H_ | 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC_ECHO_CANCELLATION_H_ |
13 | 13 |
| 14 #include <memory> |
| 15 |
14 #include <stddef.h> | 16 #include <stddef.h> |
15 | 17 |
| 18 extern "C" { |
| 19 #include "webrtc/common_audio/ring_buffer.h" |
| 20 } |
| 21 #include "webrtc/modules/audio_processing/aec/aec_core.h" |
16 #include "webrtc/typedefs.h" | 22 #include "webrtc/typedefs.h" |
17 | 23 |
18 namespace webrtc { | 24 namespace webrtc { |
19 | 25 |
20 // Errors | 26 // Errors |
21 #define AEC_UNSPECIFIED_ERROR 12000 | 27 #define AEC_UNSPECIFIED_ERROR 12000 |
22 #define AEC_UNSUPPORTED_FUNCTION_ERROR 12001 | 28 #define AEC_UNSUPPORTED_FUNCTION_ERROR 12001 |
23 #define AEC_UNINITIALIZED_ERROR 12002 | 29 #define AEC_UNINITIALIZED_ERROR 12002 |
24 #define AEC_NULL_POINTER_ERROR 12003 | 30 #define AEC_NULL_POINTER_ERROR 12003 |
25 #define AEC_BAD_PARAMETER_ERROR 12004 | 31 #define AEC_BAD_PARAMETER_ERROR 12004 |
(...skipping 23 matching lines...) Expand all Loading... |
49 typedef struct { | 55 typedef struct { |
50 AecLevel rerl; | 56 AecLevel rerl; |
51 AecLevel erl; | 57 AecLevel erl; |
52 AecLevel erle; | 58 AecLevel erle; |
53 AecLevel aNlp; | 59 AecLevel aNlp; |
54 float divergent_filter_fraction; | 60 float divergent_filter_fraction; |
55 } AecMetrics; | 61 } AecMetrics; |
56 | 62 |
57 struct AecCore; | 63 struct AecCore; |
58 | 64 |
| 65 class ApmDataDumper; |
| 66 |
| 67 typedef struct Aec { |
| 68 std::unique_ptr<ApmDataDumper> data_dumper; |
| 69 |
| 70 int delayCtr; |
| 71 int sampFreq; |
| 72 int splitSampFreq; |
| 73 int scSampFreq; |
| 74 float sampFactor; // scSampRate / sampFreq |
| 75 short skewMode; |
| 76 int bufSizeStart; |
| 77 int knownDelay; |
| 78 int rate_factor; |
| 79 |
| 80 short initFlag; // indicates if AEC has been initialized |
| 81 |
| 82 // Variables used for averaging far end buffer size |
| 83 short counter; |
| 84 int sum; |
| 85 short firstVal; |
| 86 short checkBufSizeCtr; |
| 87 |
| 88 // Variables used for delay shifts |
| 89 short msInSndCardBuf; |
| 90 short filtDelay; // Filtered delay estimate. |
| 91 int timeForDelayChange; |
| 92 int startup_phase; |
| 93 int checkBuffSize; |
| 94 short lastDelayDiff; |
| 95 |
| 96 // Structures |
| 97 void* resampler; |
| 98 |
| 99 int skewFrCtr; |
| 100 int resample; // if the skew is small enough we don't resample |
| 101 int highSkewCtr; |
| 102 float skew; |
| 103 |
| 104 RingBuffer* far_pre_buf; // Time domain far-end pre-buffer. |
| 105 |
| 106 int farend_started; |
| 107 |
| 108 // Aec instance counter. |
| 109 static int instance_count; |
| 110 AecCore* aec; |
| 111 } Aec; |
| 112 |
59 /* | 113 /* |
60 * Allocates the memory needed by the AEC. The memory needs to be initialized | 114 * Allocates the memory needed by the AEC. The memory needs to be initialized |
61 * separately using the WebRtcAec_Init() function. Returns a pointer to the | 115 * separately using the WebRtcAec_Init() function. Returns a pointer to the |
62 * object or NULL on error. | 116 * object or NULL on error. |
63 */ | 117 */ |
64 void* WebRtcAec_Create(); | 118 void* WebRtcAec_Create(); |
65 | 119 |
66 /* | 120 /* |
67 * This function releases the memory allocated by WebRtcAec_Create(). | 121 * This function releases the memory allocated by WebRtcAec_Create(). |
68 * | 122 * |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 // - handle : Pointer to the AEC instance. | 287 // - handle : Pointer to the AEC instance. |
234 // | 288 // |
235 // Return value: | 289 // Return value: |
236 // - AecCore pointer : NULL for error. | 290 // - AecCore pointer : NULL for error. |
237 // | 291 // |
238 struct AecCore* WebRtcAec_aec_core(void* handle); | 292 struct AecCore* WebRtcAec_aec_core(void* handle); |
239 | 293 |
240 } // namespace webrtc | 294 } // namespace webrtc |
241 | 295 |
242 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC_ECHO_CANCELLATION_H_ | 296 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC_ECHO_CANCELLATION_H_ |
OLD | NEW |