Moved the place for the aec_debug_dump build flag and changed the name to apm_debug_dump
Currently, the aec_debug_dump buildflag can and is used to store data in the whole of
the audio processing module. Therefore a more appropriate name is apm_debug_dump which
also matches the names of the data dumping functionality. This CL makes that name change.
The CL also changes the WEBRTC_AEC_DEBUG_DUMP define to
WEBRTC_APM_DEBUG_DUMP == 1
Furthermore, this CL moves the buildflag to a more appropriate place.
BUG=webrtc:5298
Review-Url: https://codereview.webrtc.org/2300813004
Cr-Original-Commit-Position: refs/heads/master@{#14026}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: f28a3894465f5f78a61064f35bf7939da61ee225
diff --git a/build/common.gypi b/build/common.gypi
index c4a548f..a2db0c8 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -121,6 +121,10 @@
# Disable the code for the intelligibility enhancer by default.
'enable_intelligibility_enhancer%': 0,
+ # Selects whether debug dumps for the audio processing module
+ # should be generated.
+ 'apm_debug_dump%': 0,
+
# Disable these to not build components which can be externally provided.
'build_expat%': 1,
'build_json%': 1,
diff --git a/build/webrtc.gni b/build/webrtc.gni
index a6282b8..25d7258 100644
--- a/build/webrtc.gni
+++ b/build/webrtc.gni
@@ -39,6 +39,10 @@
# Disable the code for the intelligibility enhancer by default.
rtc_enable_intelligibility_enhancer = false
+ # Selects whether debug dumps for the audio processing module
+ # should be generated.
+ apm_debug_dump = false
+
# Disable these to not build components which can be externally provided.
rtc_build_expat = true
rtc_build_json = true
diff --git a/modules/audio_processing/BUILD.gn b/modules/audio_processing/BUILD.gn
index 2626b7e..fcbb44a 100644
--- a/modules/audio_processing/BUILD.gn
+++ b/modules/audio_processing/BUILD.gn
@@ -11,9 +11,6 @@
import("../../build/webrtc.gni")
declare_args() {
- # Outputs some low-level debug files.
- aec_debug_dump = false
-
# Disables the usual mode where we trust the reported system delay
# values the AEC receives. The corresponding define is set appropriately
# in the code, but it can be force-enabled here for testing.
@@ -163,10 +160,10 @@
"../audio_coding:isac",
]
- if (aec_debug_dump) {
- defines += [ "WEBRTC_AEC_DEBUG_DUMP=1" ]
+ if (apm_debug_dump) {
+ defines += [ "WEBRTC_APM_DEBUG_DUMP=1" ]
} else {
- defines += [ "WEBRTC_AEC_DEBUG_DUMP=0" ]
+ defines += [ "WEBRTC_APM_DEBUG_DUMP=0" ]
}
if (aec_untrusted_delay_for_testing) {
@@ -270,10 +267,10 @@
configs += [ "../..:common_config" ]
public_configs = [ "../..:common_inherited_config" ]
- if (aec_debug_dump) {
- defines = [ "WEBRTC_AEC_DEBUG_DUMP=1" ]
+ if (apm_debug_dump) {
+ defines = [ "WEBRTC_APM_DEBUG_DUMP=1" ]
} else {
- defines = [ "WEBRTC_AEC_DEBUG_DUMP=0" ]
+ defines = [ "WEBRTC_APM_DEBUG_DUMP=0" ]
}
}
}
@@ -311,10 +308,10 @@
"../../common_audio",
]
- if (aec_debug_dump) {
- defines = [ "WEBRTC_AEC_DEBUG_DUMP=1" ]
+ if (apm_debug_dump) {
+ defines = [ "WEBRTC_APM_DEBUG_DUMP=1" ]
} else {
- defines = [ "WEBRTC_AEC_DEBUG_DUMP=0" ]
+ defines = [ "WEBRTC_APM_DEBUG_DUMP=0" ]
}
}
}
diff --git a/modules/audio_processing/audio_processing.gypi b/modules/audio_processing/audio_processing.gypi
index 14e1b66..cbd4fdf 100644
--- a/modules/audio_processing/audio_processing.gypi
+++ b/modules/audio_processing/audio_processing.gypi
@@ -9,8 +9,6 @@
{
'variables': {
'shared_generated_dir': '<(SHARED_INTERMEDIATE_DIR)/audio_processing/asm_offsets',
- # Outputs some low-level debug files.
- 'aec_debug_dump%': 0,
},
'targets': [
{
@@ -165,10 +163,10 @@
'voice_detection_impl.h',
],
'conditions': [
- ['aec_debug_dump==1', {
- 'defines': ['WEBRTC_AEC_DEBUG_DUMP=1',],
+ ['apm_debug_dump==1', {
+ 'defines': ['WEBRTC_APM_DEBUG_DUMP=1',],
}, {
- 'defines': ['WEBRTC_AEC_DEBUG_DUMP=0',],
+ 'defines': ['WEBRTC_APM_DEBUG_DUMP=0',],
}],
['aec_untrusted_delay_for_testing==1', {
'defines': ['WEBRTC_UNTRUSTED_DELAY',],
@@ -278,10 +276,10 @@
'aec/aec_rdft_sse2.cc',
],
'conditions': [
- ['aec_debug_dump==1', {
- 'defines': ['WEBRTC_AEC_DEBUG_DUMP=1',],
+ ['apm_debug_dump==1', {
+ 'defines': ['WEBRTC_APM_DEBUG_DUMP=1',],
}, {
- 'defines': ['WEBRTC_AEC_DEBUG_DUMP=0',],
+ 'defines': ['WEBRTC_APM_DEBUG_DUMP=0',],
}],
['os_posix==1', {
'cflags': [ '-msse2', ],
@@ -308,11 +306,11 @@
'ns/nsx_core_neon.c',
],
'conditions': [
- ['aec_debug_dump==1', {
- 'defines': ['WEBRTC_AEC_DEBUG_DUMP=1',],
+ ['apm_debug_dump==1', {
+ 'defines': ['WEBRTC_APM_DEBUG_DUMP=1',],
}],
- ['aec_debug_dump==0', {
- 'defines': ['WEBRTC_AEC_DEBUG_DUMP=0',],
+ ['apm_debug_dump==0', {
+ 'defines': ['WEBRTC_APM_DEBUG_DUMP=0',],
}],
],
}],
diff --git a/modules/audio_processing/logging/apm_data_dumper.cc b/modules/audio_processing/logging/apm_data_dumper.cc
index 3202006..66ec517 100644
--- a/modules/audio_processing/logging/apm_data_dumper.cc
+++ b/modules/audio_processing/logging/apm_data_dumper.cc
@@ -15,16 +15,16 @@
#include "webrtc/base/stringutils.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"
+#if !defined(WEBRTC_APM_DEBUG_DUMP) || \
+ (WEBRTC_APM_DEBUG_DUMP != 0 && WEBRTC_APM_DEBUG_DUMP != 1)
+#error "Set WEBRTC_APM_DEBUG_DUMP to either 0 or 1"
#endif
namespace webrtc {
namespace {
-#if WEBRTC_AEC_DEBUG_DUMP == 1
+#if WEBRTC_APM_DEBUG_DUMP == 1
std::string FormFileName(const char* name,
int instance_index,
int reinit_index,
@@ -37,7 +37,7 @@
} // namespace
-#if WEBRTC_AEC_DEBUG_DUMP == 1
+#if WEBRTC_APM_DEBUG_DUMP == 1
ApmDataDumper::ApmDataDumper(int instance_index)
: instance_index_(instance_index) {}
#else
@@ -46,7 +46,7 @@
ApmDataDumper::~ApmDataDumper() {}
-#if WEBRTC_AEC_DEBUG_DUMP == 1
+#if WEBRTC_APM_DEBUG_DUMP == 1
FILE* ApmDataDumper::GetRawFile(const char* name) {
std::string filename =
FormFileName(name, instance_index_, recording_set_index_, ".dat");
diff --git a/modules/audio_processing/logging/apm_data_dumper.h b/modules/audio_processing/logging/apm_data_dumper.h
index 230c6b3..691c4ce 100644
--- a/modules/audio_processing/logging/apm_data_dumper.h
+++ b/modules/audio_processing/logging/apm_data_dumper.h
@@ -22,14 +22,14 @@
#include "webrtc/common_audio/wav_file.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"
+#if !defined(WEBRTC_APM_DEBUG_DUMP) || \
+ (WEBRTC_APM_DEBUG_DUMP != 0 && WEBRTC_APM_DEBUG_DUMP != 1)
+#error "Set WEBRTC_APM_DEBUG_DUMP to either 0 or 1"
#endif
namespace webrtc {
-#if WEBRTC_AEC_DEBUG_DUMP == 1
+#if WEBRTC_APM_DEBUG_DUMP == 1
// Functor used to use as a custom deleter in the map of file pointers to raw
// files.
struct RawFileCloseFunctor {
@@ -50,7 +50,7 @@
// Reinitializes the data dumping such that new versions
// of all files being dumped to are created.
void InitiateNewSetOfRecordings() {
-#if WEBRTC_AEC_DEBUG_DUMP == 1
+#if WEBRTC_APM_DEBUG_DUMP == 1
++recording_set_index_;
#endif
}
@@ -58,20 +58,20 @@
// Methods for performing dumping of data of various types into
// various formats.
void DumpRaw(const char* name, int v_length, const float* v) {
-#if WEBRTC_AEC_DEBUG_DUMP == 1
+#if WEBRTC_APM_DEBUG_DUMP == 1
FILE* file = GetRawFile(name);
fwrite(v, sizeof(v[0]), v_length, file);
#endif
}
void DumpRaw(const char* name, rtc::ArrayView<const float> v) {
-#if WEBRTC_AEC_DEBUG_DUMP == 1
+#if WEBRTC_APM_DEBUG_DUMP == 1
DumpRaw(name, v.size(), v.data());
#endif
}
void DumpRaw(const char* name, int v_length, const bool* v) {
-#if WEBRTC_AEC_DEBUG_DUMP == 1
+#if WEBRTC_APM_DEBUG_DUMP == 1
FILE* file = GetRawFile(name);
for (int k = 0; k < v_length; ++k) {
int16_t value = static_cast<int16_t>(v[k]);
@@ -81,33 +81,33 @@
}
void DumpRaw(const char* name, rtc::ArrayView<const bool> v) {
-#if WEBRTC_AEC_DEBUG_DUMP == 1
+#if WEBRTC_APM_DEBUG_DUMP == 1
DumpRaw(name, v.size(), v.data());
#endif
}
void DumpRaw(const char* name, int v_length, const int16_t* v) {
-#if WEBRTC_AEC_DEBUG_DUMP == 1
+#if WEBRTC_APM_DEBUG_DUMP == 1
FILE* file = GetRawFile(name);
fwrite(v, sizeof(v[0]), v_length, file);
#endif
}
void DumpRaw(const char* name, rtc::ArrayView<const int16_t> v) {
-#if WEBRTC_AEC_DEBUG_DUMP == 1
+#if WEBRTC_APM_DEBUG_DUMP == 1
DumpRaw(name, v.size(), v.data());
#endif
}
void DumpRaw(const char* name, int v_length, const int32_t* v) {
-#if WEBRTC_AEC_DEBUG_DUMP == 1
+#if WEBRTC_APM_DEBUG_DUMP == 1
FILE* file = GetRawFile(name);
fwrite(v, sizeof(v[0]), v_length, file);
#endif
}
void DumpRaw(const char* name, rtc::ArrayView<const int32_t> v) {
-#if WEBRTC_AEC_DEBUG_DUMP == 1
+#if WEBRTC_APM_DEBUG_DUMP == 1
DumpRaw(name, v.size(), v.data());
#endif
}
@@ -117,7 +117,7 @@
const float* v,
int sample_rate_hz,
int num_channels) {
-#if WEBRTC_AEC_DEBUG_DUMP == 1
+#if WEBRTC_APM_DEBUG_DUMP == 1
WavWriter* file = GetWavFile(name, sample_rate_hz, num_channels);
file->WriteSamples(v, v_length);
#endif
@@ -127,13 +127,13 @@
rtc::ArrayView<const float> v,
int sample_rate_hz,
int num_channels) {
-#if WEBRTC_AEC_DEBUG_DUMP == 1
+#if WEBRTC_APM_DEBUG_DUMP == 1
DumpWav(name, v.size(), v.data(), sample_rate_hz, num_channels);
#endif
}
private:
-#if WEBRTC_AEC_DEBUG_DUMP == 1
+#if WEBRTC_APM_DEBUG_DUMP == 1
const int instance_index_;
int recording_set_index_ = 0;
std::unordered_map<std::string, std::unique_ptr<FILE, RawFileCloseFunctor>>