Update audio_processing module
Corresponds to upstream commit 524e9b043e7e86fd72353b987c9d5f6a1ebf83e1 Update notes: * Pull in third party license file * Replace .gypi files with BUILD.gn to keep track of what changes upstream * Bunch of new filse pulled in as dependencies * Won't build yet due to changes needed on top of these
This commit is contained in:
86
webrtc/modules/audio_processing/logging/aec_logging.h
Normal file
86
webrtc/modules/audio_processing/logging/aec_logging.h
Normal file
@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_LOGGING_
|
||||
#define WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_LOGGING_
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "webrtc/modules/audio_processing/logging/aec_logging_file_handling.h"
|
||||
|
||||
// To enable AEC logging, invoke GYP with -Daec_debug_dump=1.
|
||||
#ifdef WEBRTC_AEC_DEBUG_DUMP
|
||||
// Dumps a wav data to file.
|
||||
#define RTC_AEC_DEBUG_WAV_WRITE(file, data, num_samples) \
|
||||
do { \
|
||||
rtc_WavWriteSamples(file, data, num_samples); \
|
||||
} while (0)
|
||||
|
||||
// (Re)opens a wav file for writing using the specified sample rate.
|
||||
#define RTC_AEC_DEBUG_WAV_REOPEN(name, instance_index, process_rate, \
|
||||
sample_rate, wav_file) \
|
||||
do { \
|
||||
WebRtcAec_ReopenWav(name, instance_index, process_rate, sample_rate, \
|
||||
wav_file); \
|
||||
} while (0)
|
||||
|
||||
// Closes a wav file.
|
||||
#define RTC_AEC_DEBUG_WAV_CLOSE(wav_file) \
|
||||
do { \
|
||||
rtc_WavClose(wav_file); \
|
||||
} while (0)
|
||||
|
||||
// Dumps a raw data to file.
|
||||
#define RTC_AEC_DEBUG_RAW_WRITE(file, data, data_size) \
|
||||
do { \
|
||||
(void) fwrite(data, data_size, 1, file); \
|
||||
} while (0)
|
||||
|
||||
// Opens a raw data file for writing using the specified sample rate.
|
||||
#define RTC_AEC_DEBUG_RAW_OPEN(name, instance_counter, file) \
|
||||
do { \
|
||||
WebRtcAec_RawFileOpen(name, instance_counter, file); \
|
||||
} while (0)
|
||||
|
||||
// Closes a raw data file.
|
||||
#define RTC_AEC_DEBUG_RAW_CLOSE(file) \
|
||||
do { \
|
||||
fclose(file); \
|
||||
} while (0)
|
||||
|
||||
#else // RTC_AEC_DEBUG_DUMP
|
||||
#define RTC_AEC_DEBUG_WAV_WRITE(file, data, num_samples) \
|
||||
do { \
|
||||
} while (0)
|
||||
|
||||
#define RTC_AEC_DEBUG_WAV_REOPEN(wav_file, name, instance_index, process_rate, \
|
||||
sample_rate) \
|
||||
do { \
|
||||
} while (0)
|
||||
|
||||
#define RTC_AEC_DEBUG_WAV_CLOSE(wav_file) \
|
||||
do { \
|
||||
} while (0)
|
||||
|
||||
#define RTC_AEC_DEBUG_RAW_WRITE(file, data, data_size) \
|
||||
do { \
|
||||
} while (0)
|
||||
|
||||
#define RTC_AEC_DEBUG_RAW_OPEN(file, name, instance_counter) \
|
||||
do { \
|
||||
} while (0)
|
||||
|
||||
#define RTC_AEC_DEBUG_RAW_CLOSE(file) \
|
||||
do { \
|
||||
} while (0)
|
||||
|
||||
#endif // WEBRTC_AEC_DEBUG_DUMP
|
||||
|
||||
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_LOGGING_
|
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "webrtc/modules/audio_processing/logging/aec_logging_file_handling.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/stringutils.h"
|
||||
#include "webrtc/common_audio/wav_file.h"
|
||||
#include "webrtc/typedefs.h"
|
||||
|
||||
#ifdef WEBRTC_AEC_DEBUG_DUMP
|
||||
void WebRtcAec_ReopenWav(const char* name,
|
||||
int instance_index,
|
||||
int process_rate,
|
||||
int sample_rate,
|
||||
rtc_WavWriter** wav_file) {
|
||||
if (*wav_file) {
|
||||
if (rtc_WavSampleRate(*wav_file) == sample_rate)
|
||||
return;
|
||||
rtc_WavClose(*wav_file);
|
||||
}
|
||||
char filename[64];
|
||||
int written = rtc::sprintfn(filename, sizeof(filename), "%s%d-%d.wav", name,
|
||||
instance_index, process_rate);
|
||||
|
||||
// Ensure there was no buffer output error.
|
||||
RTC_DCHECK_GE(written, 0);
|
||||
// Ensure that the buffer size was sufficient.
|
||||
RTC_DCHECK_LT(static_cast<size_t>(written), sizeof(filename));
|
||||
|
||||
*wav_file = rtc_WavOpen(filename, sample_rate, 1);
|
||||
}
|
||||
|
||||
void WebRtcAec_RawFileOpen(const char* name, int instance_index, FILE** file) {
|
||||
char filename[64];
|
||||
int written = rtc::sprintfn(filename, sizeof(filename), "%s_%d.dat", name,
|
||||
instance_index);
|
||||
|
||||
// Ensure there was no buffer output error.
|
||||
RTC_DCHECK_GE(written, 0);
|
||||
// Ensure that the buffer size was sufficient.
|
||||
RTC_DCHECK_LT(static_cast<size_t>(written), sizeof(filename));
|
||||
|
||||
*file = fopen(filename, "wb");
|
||||
}
|
||||
|
||||
#endif // WEBRTC_AEC_DEBUG_DUMP
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_LOGGING_FILE_HANDLING_
|
||||
#define WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_LOGGING_FILE_HANDLING_
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "webrtc/common_audio/wav_file.h"
|
||||
#include "webrtc/typedefs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef WEBRTC_AEC_DEBUG_DUMP
|
||||
// Opens a new Wav file for writing. If it was already open with a different
|
||||
// sample frequency, it closes it first.
|
||||
void WebRtcAec_ReopenWav(const char* name,
|
||||
int instance_index,
|
||||
int process_rate,
|
||||
int sample_rate,
|
||||
rtc_WavWriter** wav_file);
|
||||
|
||||
// Opens dumpfile with instance-specific filename.
|
||||
void WebRtcAec_RawFileOpen(const char* name, int instance_index, FILE** file);
|
||||
|
||||
#endif // WEBRTC_AEC_DEBUG_DUMP
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_LOGGING_FILE_HANDLING_
|
Reference in New Issue
Block a user