Backed out changeset 7b4feb3d3a39 (bug 1024288) for compilation errors; CLOSED TREE

This commit is contained in:
Ed Morley 2014-06-12 17:41:12 +01:00
Родитель 226523e5a8
Коммит f1343cd304
6 изменённых файлов: 36 добавлений и 155 удалений

Просмотреть файл

@ -43,7 +43,7 @@ gyp_vars = {
# (for vp8) chromium sets to 0 also # (for vp8) chromium sets to 0 also
'use_temporal_layers': 0, 'use_temporal_layers': 0,
# Creates AEC internal sample dump files in current directory # Creates AEC internal sample dump files in current directory
'aec_debug_dump': 1, # 'aec_debug_dump': 1,
# codec enable/disables: # codec enable/disables:
'include_g711': 1, 'include_g711': 1,

Просмотреть файл

@ -28,9 +28,6 @@
#include "webrtc/system_wrappers/interface/cpu_features_wrapper.h" #include "webrtc/system_wrappers/interface/cpu_features_wrapper.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"
extern int AECDebug();
void OpenCoreDebugFiles(AecCore* aec, int *instance_count);
// Buffer size (samples) // Buffer size (samples)
static const size_t kBufSizePartitions = 250; // 1 second of audio in 16 kHz. static const size_t kBufSizePartitions = 250; // 1 second of audio in 16 kHz.
@ -214,9 +211,17 @@ int WebRtcAec_CreateAec(AecCore** aecInst) {
aec = NULL; aec = NULL;
return -1; return -1;
} }
aec->outLinearFile = aec->outFile = aec->nearFile = aec->farFile = NULL; {
aec->debugWritten = 0; char filename[64];
OpenCoreDebugFiles(aec, &webrtc_aec_instance_count); sprintf(filename, "aec_far%d.pcm", webrtc_aec_instance_count);
aec->farFile = fopen(filename, "wb");
sprintf(filename, "aec_near%d.pcm", webrtc_aec_instance_count);
aec->nearFile = fopen(filename, "wb");
sprintf(filename, "aec_out%d.pcm", webrtc_aec_instance_count);
aec->outFile = fopen(filename, "wb");
sprintf(filename, "aec_out_linear%d.pcm", webrtc_aec_instance_count);
aec->outLinearFile = fopen(filename, "wb");
}
#endif #endif
aec->delay_estimator_farend = aec->delay_estimator_farend =
WebRtc_CreateDelayEstimatorFarend(PART_LEN1, kHistorySizeBlocks); WebRtc_CreateDelayEstimatorFarend(PART_LEN1, kHistorySizeBlocks);
@ -251,13 +256,10 @@ int WebRtcAec_FreeAec(AecCore* aec) {
WebRtc_FreeBuffer(aec->far_buf_windowed); WebRtc_FreeBuffer(aec->far_buf_windowed);
#ifdef WEBRTC_AEC_DEBUG_DUMP #ifdef WEBRTC_AEC_DEBUG_DUMP
WebRtc_FreeBuffer(aec->far_time_buf); WebRtc_FreeBuffer(aec->far_time_buf);
if (aec->farFile) { fclose(aec->farFile);
// we don't let one be open and not the others fclose(aec->nearFile);
fclose(aec->farFile); fclose(aec->outFile);
fclose(aec->nearFile); fclose(aec->outLinearFile);
fclose(aec->outFile);
fclose(aec->outLinearFile);
}
#endif #endif
WebRtc_FreeDelayEstimator(aec->delay_estimator); WebRtc_FreeDelayEstimator(aec->delay_estimator);
WebRtc_FreeDelayEstimatorFarend(aec->delay_estimator_farend); WebRtc_FreeDelayEstimatorFarend(aec->delay_estimator_farend);
@ -846,15 +848,8 @@ static void ProcessBlock(AecCore* aec) {
int16_t farend[PART_LEN]; int16_t farend[PART_LEN];
int16_t* farend_ptr = NULL; int16_t* farend_ptr = NULL;
WebRtc_ReadBuffer(aec->far_time_buf, (void**)&farend_ptr, farend, 1); WebRtc_ReadBuffer(aec->far_time_buf, (void**)&farend_ptr, farend, 1);
OpenCoreDebugFiles(aec, &webrtc_aec_instance_count); (void)fwrite(farend_ptr, sizeof(int16_t), PART_LEN, aec->farFile);
if (aec->farFile) { (void)fwrite(nearend_ptr, sizeof(int16_t), PART_LEN, aec->nearFile);
(void)fwrite(farend_ptr, sizeof(int16_t), PART_LEN, aec->farFile);
(void)fwrite(nearend_ptr, sizeof(int16_t), PART_LEN, aec->nearFile);
aec->debugWritten += sizeof(int16_t) * PART_LEN;
if (aec->debugWritten >= AECDebugMaxSize()) {
AECDebugEnable(0);
}
}
} }
#endif #endif
@ -1011,11 +1006,8 @@ static void ProcessBlock(AecCore* aec) {
WEBRTC_SPL_WORD16_MAX, e[i], WEBRTC_SPL_WORD16_MIN); WEBRTC_SPL_WORD16_MAX, e[i], WEBRTC_SPL_WORD16_MIN);
} }
OpenCoreDebugFiles(aec, &webrtc_aec_instance_count); (void)fwrite(eInt16, sizeof(int16_t), PART_LEN, aec->outLinearFile);
if (aec->outLinearFile) { (void)fwrite(output, sizeof(int16_t), PART_LEN, aec->outFile);
(void)fwrite(eInt16, sizeof(int16_t), PART_LEN, aec->outLinearFile);
(void)fwrite(output, sizeof(int16_t), PART_LEN, aec->outFile);
}
} }
#endif #endif
} }
@ -1719,47 +1711,3 @@ static void TimeToFrequency(float time_data[PART_LEN2],
} }
} }
#ifdef WEBRTC_AEC_DEBUG_DUMP
void
OpenCoreDebugFiles(AecCore* aec,
int *instance_count)
{
int error = 0;
// XXX If this impacts performance (opening files here), move file open
// to Trace::set_aec_debug(), and just grab them here
if (AECDebug() && !aec->farFile) {
char filename[128];
if (!aec->farFile) {
sprintf(filename, "aec_far%d.pcm", webrtc_aec_instance_count);
aec->farFile = fopen(filename, "wb");
sprintf(filename, "aec_near%d.pcm", webrtc_aec_instance_count);
aec->nearFile = fopen(filename, "wb");
sprintf(filename, "aec_out%d.pcm", webrtc_aec_instance_count);
aec->outFile = fopen(filename, "wb");
sprintf(filename, "aec_out_linear%d.pcm", webrtc_aec_instance_count);
aec->outLinearFile = fopen(filename, "wb");
aec->debugWritten = 0;
if (!aec->outLinearFile || !aec->outFile || !aec->nearFile || !aec->farFile) {
error = 1;
}
}
}
if (error ||
(!AECDebug() && aec->farFile)) {
if (aec->farFile) {
fclose(aec->farFile);
}
if (aec->nearFile) {
fclose(aec->nearFile);
}
if (aec->outFile) {
fclose(aec->outFile);
}
if (aec->outLinearFile) {
fclose(aec->outLinearFile);
}
aec->outLinearFile = aec->outFile = aec->nearFile = aec->farFile = NULL;
aec->debugWritten = 0;
}
}
#endif

Просмотреть файл

@ -133,7 +133,6 @@ struct AecCore {
FILE* nearFile; FILE* nearFile;
FILE* outFile; FILE* outFile;
FILE* outLinearFile; FILE* outLinearFile;
uint32_t debugWritten;
#endif #endif
}; };

Просмотреть файл

@ -27,8 +27,6 @@
#include "webrtc/modules/audio_processing/utility/ring_buffer.h" #include "webrtc/modules/audio_processing/utility/ring_buffer.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"
extern int AECDebug();
// Measured delays [ms] // Measured delays [ms]
// Device Chrome GTP // Device Chrome GTP
// MacBook Air 10 // MacBook Air 10
@ -167,9 +165,16 @@ int32_t WebRtcAec_Create(void** aecInst) {
aecpc = NULL; aecpc = NULL;
return -1; return -1;
} }
aecpc->bufFile = aecpc->skewFile = aecpc->delayFile = NULL; {
OpenDebugFiles(aecpc, &webrtc_aec_instance_count); char filename[64];
sprintf(filename, "aec_buf%d.dat", webrtc_aec_instance_count);
aecpc->bufFile = fopen(filename, "wb");
sprintf(filename, "aec_skew%d.dat", webrtc_aec_instance_count);
aecpc->skewFile = fopen(filename, "wb");
sprintf(filename, "aec_delay%d.dat", webrtc_aec_instance_count);
aecpc->delayFile = fopen(filename, "wb");
webrtc_aec_instance_count++;
}
#endif #endif
return 0; return 0;
@ -186,12 +191,9 @@ int32_t WebRtcAec_Free(void* aecInst) {
#ifdef WEBRTC_AEC_DEBUG_DUMP #ifdef WEBRTC_AEC_DEBUG_DUMP
WebRtc_FreeBuffer(aecpc->far_pre_buf_s16); WebRtc_FreeBuffer(aecpc->far_pre_buf_s16);
if (aecpc->bufFile) { fclose(aecpc->bufFile);
// we don't let one be open and not the others fclose(aecpc->skewFile);
fclose(aecpc->bufFile); fclose(aecpc->delayFile);
fclose(aecpc->skewFile);
fclose(aecpc->delayFile);
}
#endif #endif
WebRtcAec_FreeAec(aecpc->aec); WebRtcAec_FreeAec(aecpc->aec);
@ -437,12 +439,9 @@ int32_t WebRtcAec_Process(void* aecInst,
{ {
int16_t far_buf_size_ms = (int16_t)(WebRtcAec_system_delay(aecpc->aec) / int16_t far_buf_size_ms = (int16_t)(WebRtcAec_system_delay(aecpc->aec) /
(sampMsNb * aecpc->rate_factor)); (sampMsNb * aecpc->rate_factor));
OpenDebugFiles(aecpc, &webrtc_aec_instance_count); (void)fwrite(&far_buf_size_ms, 2, 1, aecpc->bufFile);
if (aecpc->bufFile) { (void)fwrite(
(void)fwrite(&far_buf_size_ms, 2, 1, aecpc->bufFile);
(void)fwrite(
&aecpc->knownDelay, sizeof(aecpc->knownDelay), 1, aecpc->delayFile); &aecpc->knownDelay, sizeof(aecpc->knownDelay), 1, aecpc->delayFile);
}
} }
#endif #endif
@ -679,10 +678,7 @@ static int ProcessNormal(aecpc_t* aecpc,
} }
#ifdef WEBRTC_AEC_DEBUG_DUMP #ifdef WEBRTC_AEC_DEBUG_DUMP
OpenDebugFiles(aecpc, &webrtc_aec_instance_count); (void)fwrite(&aecpc->skew, sizeof(aecpc->skew), 1, aecpc->skewFile);
if (aecpc->skewFile) {
(void)fwrite(&aecpc->skew, sizeof(aecpc->skew), 1, aecpc->skewFile);
}
#endif #endif
} }
} }
@ -972,43 +968,3 @@ static void EstBufDelayExtended(aecpc_t* self) {
self->knownDelay = WEBRTC_SPL_MAX((int)self->filtDelay - 256, 0); self->knownDelay = WEBRTC_SPL_MAX((int)self->filtDelay - 256, 0);
} }
} }
#ifdef WEBRTC_AEC_DEBUG_DUMP
void
OpenDebugFiles(aecpc_t* aecpc,
int *instance_count)
{
int error = 0;
// XXX If this impacts performance (opening files here), move file open
// to Trace::set_aec_debug(), and just grab them here
if (AECDebug() && !aecpc->bufFile) {
char filename[128];
sprintf(filename, "aec_buf%d.dat", *instance_count);
aecpc->bufFile = fopen(filename, "wb");
sprintf(filename, "aec_skew%d.dat", *instance_count);
aecpc->skewFile = fopen(filename, "wb");
sprintf(filename, "aec_delay%d.dat", *instance_count);
aecpc->delayFile = fopen(filename, "wb");
if (!aecpc->bufFile || !aecpc->skewFile || !aecpc->delayFile) {
error = 1;
} else {
(*instance_count)++;
}
}
if (error ||
(!AECDebug() && aecpc->bufFile)) {
if (aecpc->bufFile) {
fclose(aecpc->bufFile);
}
if (aecpc->skewFile) {
fclose(aecpc->skewFile);
}
if (aecpc->delayFile) {
fclose(aecpc->delayFile);
}
aecpc->bufFile = aecpc->skewFile = aecpc->delayFile = NULL;
}
}
#endif

Просмотреть файл

@ -54,12 +54,6 @@ class Trace {
// Returns what type of messages are written to the trace file. // Returns what type of messages are written to the trace file.
static uint32_t level_filter() { return level_filter_; } static uint32_t level_filter() { return level_filter_; }
// Enable dumping of AEC inputs and outputs. Can be changed in mid-call
static void set_aec_debug(bool enable) { aec_debug_ = enable; }
static void set_aec_debug_size(uint32_t size) { aec_debug_size_ = size; }
static bool aec_debug() { return aec_debug_; }
static uint32_t aec_debug_size() { return aec_debug_size_; }
// Sets the file name. If add_file_counter is false the same file will be // Sets the file name. If add_file_counter is false the same file will be
// reused when it fills up. If it's true a new file with incremented name // reused when it fills up. If it's true a new file with incremented name
// will be used. // will be used.
@ -91,16 +85,8 @@ class Trace {
private: private:
static uint32_t level_filter_; static uint32_t level_filter_;
static bool aec_debug_;
static uint32_t aec_debug_size_;
}; };
} // namespace webrtc } // namespace webrtc
extern "C" {
extern int AECDebug();
extern uint32_t AECDebugMaxSize();
extern void AECDebugEnable(uint32_t enable);
}
#endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_TRACE_H_ #endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_TRACE_H_

Просмотреть файл

@ -29,20 +29,12 @@
#pragma warning(disable:4355) #pragma warning(disable:4355)
#endif // _WIN32 #endif // _WIN32
extern "C" {
int AECDebug() { return (int) webrtc::Trace::aec_debug(); }
uint32_t AECDebugMaxSize() { return webrtc::Trace::aec_debug_size(); }
void AECDebugEnable(uint32_t enable) { webrtc::Trace::set_aec_debug(!!enable); }
}
namespace webrtc { namespace webrtc {
const int Trace::kBoilerplateLength = 71; const int Trace::kBoilerplateLength = 71;
const int Trace::kTimestampPosition = 13; const int Trace::kTimestampPosition = 13;
const int Trace::kTimestampLength = 12; const int Trace::kTimestampLength = 12;
uint32_t Trace::level_filter_ = kTraceDefault; uint32_t Trace::level_filter_ = kTraceDefault;
bool Trace::aec_debug_ = false;
uint32_t Trace::aec_debug_size_ = 4*1024*1024;
// Construct On First Use idiom. Avoids "static initialization order fiasco". // Construct On First Use idiom. Avoids "static initialization order fiasco".
TraceImpl* TraceImpl::StaticInstance(CountOperation count_operation, TraceImpl* TraceImpl::StaticInstance(CountOperation count_operation,