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-Commit-Position: refs/heads/master@{#14026}
This commit is contained in:
peah 2016-09-01 08:58:21 -07:00 committed by Commit bot
parent a0e60e8550
commit f28a389446
6 changed files with 49 additions and 46 deletions

View File

@ -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,

View File

@ -39,6 +39,10 @@ declare_args() {
# 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

View File

@ -11,9 +11,6 @@ import("//third_party/protobuf/proto_library.gni")
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 @@ source_set("audio_processing") {
"../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 @@ if (current_cpu == "x86" || current_cpu == "x64") {
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 @@ if (rtc_build_with_neon) {
"../../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" ]
}
}
}

View File

@ -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',],
}],
],
}],

View File

@ -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 @@ std::string FormFileName(const char* name,
} // 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(int instance_index) {}
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");

View File

@ -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 @@ class ApmDataDumper {
// 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 @@ class ApmDataDumper {
// 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 @@ class ApmDataDumper {
}
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 @@ class ApmDataDumper {
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 @@ class ApmDataDumper {
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>>