Index: webrtc/modules/audio_processing/aec/echo_cancellation.cc |
diff --git a/webrtc/modules/audio_processing/aec/echo_cancellation.cc b/webrtc/modules/audio_processing/aec/echo_cancellation.cc |
index 6b1758a15ade7ce3c8fcb6b559524c3bf1f24e5c..9aa17fcf805c068268873adc44f30bf557744495 100644 |
--- a/webrtc/modules/audio_processing/aec/echo_cancellation.cc |
+++ b/webrtc/modules/audio_processing/aec/echo_cancellation.cc |
@@ -14,9 +14,6 @@ |
#include "webrtc/modules/audio_processing/aec/echo_cancellation.h" |
#include <math.h> |
-#if WEBRTC_AEC_DEBUG_DUMP == 1 |
-#include <stdio.h> |
-#endif |
#include <stdlib.h> |
#include <string.h> |
@@ -27,14 +24,9 @@ extern "C" { |
#include "webrtc/modules/audio_processing/aec/aec_core.h" |
#include "webrtc/modules/audio_processing/aec/aec_resampler.h" |
#include "webrtc/modules/audio_processing/aec/echo_cancellation_internal.h" |
+#include "webrtc/modules/audio_processing/logging/apm_data_dumper.h" |
#include "webrtc/typedefs.h" |
-// Check to verify that the define is properly set. |
-#if !defined(WEBRTC_AEC_DEBUG_DUMP) || \ |
- (WEBRTC_AEC_DEBUG_DUMP != 0 && WEBRTC_AEC_DEBUG_DUMP != 1) |
-#error "Set WEBRTC_AEC_DEBUG_DUMP to either 0 or 1" |
-#endif |
- |
namespace webrtc { |
// Measured delays [ms] |
@@ -128,6 +120,7 @@ static void ProcessExtended(Aec* self, |
void* WebRtcAec_Create() { |
Aec* aecpc = reinterpret_cast<Aec*>(malloc(sizeof(Aec))); |
+ aecpc->data_dumper.reset(new ApmDataDumper(aecpc->instance_count)); |
if (!aecpc) { |
return NULL; |
@@ -155,18 +148,7 @@ void* WebRtcAec_Create() { |
aecpc->initFlag = 0; |
-#if WEBRTC_AEC_DEBUG_DUMP == 1 |
- char filename[64]; |
- snprintf(filename, sizeof(filename), "aec_buf%d.dat", aecpc->instance_count); |
- aecpc->bufFile = fopen(filename, "wb"); |
- snprintf(filename, sizeof(filename), "aec_skew%d.dat", aecpc->instance_count); |
- aecpc->skewFile = fopen(filename, "wb"); |
- snprintf(filename, sizeof(filename), "aec_delay%d.dat", |
- aecpc->instance_count); |
- aecpc->delayFile = fopen(filename, "wb"); |
-#endif |
aecpc->instance_count++; |
- |
return aecpc; |
} |
@@ -179,12 +161,6 @@ void WebRtcAec_Free(void* aecInst) { |
WebRtc_FreeBuffer(aecpc->far_pre_buf); |
-#if WEBRTC_AEC_DEBUG_DUMP == 1 |
- fclose(aecpc->bufFile); |
- fclose(aecpc->skewFile); |
- fclose(aecpc->delayFile); |
-#endif |
- |
WebRtcAec_FreeAec(aecpc->aec); |
WebRtcAec_FreeResampler(aecpc->resampler); |
free(aecpc); |
@@ -192,6 +168,7 @@ void WebRtcAec_Free(void* aecInst) { |
int32_t WebRtcAec_Init(void* aecInst, int32_t sampFreq, int32_t scSampFreq) { |
Aec* aecpc = reinterpret_cast<Aec*>(aecInst); |
+ aecpc->data_dumper->InitiateNewSetOfRecordings(); |
AecConfig aecConfig; |
if (sampFreq != 8000 && sampFreq != 16000 && sampFreq != 32000 && |
@@ -376,15 +353,9 @@ int32_t WebRtcAec_Process(void* aecInst, |
msInSndCardBuf, skew); |
} |
-#if WEBRTC_AEC_DEBUG_DUMP == 1 |
- { |
- int16_t far_buf_size_ms = (int16_t)(WebRtcAec_system_delay(aecpc->aec) / |
- (sampMsNb * aecpc->rate_factor)); |
- (void)fwrite(&far_buf_size_ms, 2, 1, aecpc->bufFile); |
- (void)fwrite(&aecpc->knownDelay, sizeof(aecpc->knownDelay), 1, |
- aecpc->delayFile); |
- } |
-#endif |
+ int far_buf_size_samples = WebRtcAec_system_delay(aecpc->aec); |
+ aecpc->data_dumper->DumpRaw("aec_buf", 1, &far_buf_size_samples); |
hlundin-webrtc
2016/05/04 07:20:35
I don't know if the logged variable names are up f
peah-webrtc
2016/05/04 11:38:04
Absolutely! I for now kept the name that was there
|
+ aecpc->data_dumper->DumpRaw("aec_delay", 1, &aecpc->knownDelay); |
return retVal; |
} |
@@ -603,9 +574,7 @@ static int ProcessNormal(Aec* aecpc, |
aecpc->skew = maxSkewEst; |
} |
-#if WEBRTC_AEC_DEBUG_DUMP == 1 |
- (void)fwrite(&aecpc->skew, sizeof(aecpc->skew), 1, aecpc->skewFile); |
-#endif |
+ aecpc->data_dumper->DumpRaw("aec_skew", 1, &aecpc->skew); |
} |
} |