From f28a3894465f5f78a61064f35bf7939da61ee225 Mon Sep 17 00:00:00 2001 From: peah Date: Thu, 1 Sep 2016 08:58:21 -0700 Subject: [PATCH] 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} --- webrtc/build/common.gypi | 4 +++ webrtc/build/webrtc.gni | 4 +++ webrtc/modules/audio_processing/BUILD.gn | 21 ++++++------ .../audio_processing/audio_processing.gypi | 22 ++++++------- .../logging/apm_data_dumper.cc | 12 +++---- .../logging/apm_data_dumper.h | 32 +++++++++---------- 6 files changed, 49 insertions(+), 46 deletions(-) diff --git a/webrtc/build/common.gypi b/webrtc/build/common.gypi index c4a548f9ff..a2db0c8d56 100644 --- a/webrtc/build/common.gypi +++ b/webrtc/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/webrtc/build/webrtc.gni b/webrtc/build/webrtc.gni index a6282b84fe..25d7258268 100644 --- a/webrtc/build/webrtc.gni +++ b/webrtc/build/webrtc.gni @@ -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 diff --git a/webrtc/modules/audio_processing/BUILD.gn b/webrtc/modules/audio_processing/BUILD.gn index 2626b7ebff..fcbb44a831 100644 --- a/webrtc/modules/audio_processing/BUILD.gn +++ b/webrtc/modules/audio_processing/BUILD.gn @@ -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" ] } } } diff --git a/webrtc/modules/audio_processing/audio_processing.gypi b/webrtc/modules/audio_processing/audio_processing.gypi index 14e1b66862..cbd4fdf4a7 100644 --- a/webrtc/modules/audio_processing/audio_processing.gypi +++ b/webrtc/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/webrtc/modules/audio_processing/logging/apm_data_dumper.cc b/webrtc/modules/audio_processing/logging/apm_data_dumper.cc index 3202006d3c..66ec5178d0 100644 --- a/webrtc/modules/audio_processing/logging/apm_data_dumper.cc +++ b/webrtc/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 @@ 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"); diff --git a/webrtc/modules/audio_processing/logging/apm_data_dumper.h b/webrtc/modules/audio_processing/logging/apm_data_dumper.h index 230c6b3a3e..691c4cec5b 100644 --- a/webrtc/modules/audio_processing/logging/apm_data_dumper.h +++ b/webrtc/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 @@ 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 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(v[k]); @@ -81,33 +81,33 @@ class ApmDataDumper { } void DumpRaw(const char* name, rtc::ArrayView 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 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 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 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>