Chromium Code Reviews| Index: webrtc/modules/audio_processing/logging/aec_logging.h |
| diff --git a/webrtc/modules/audio_processing/logging/aec_logging.h b/webrtc/modules/audio_processing/logging/aec_logging.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..61880fe825e718e3bc89cc8ceec15a313a82f053 |
| --- /dev/null |
| +++ b/webrtc/modules/audio_processing/logging/aec_logging.h |
| @@ -0,0 +1,94 @@ |
| +/* |
| + * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
|
hlundin-webrtc
2015/08/10 13:04:41
2015
peah-webrtc
2015/08/12 20:25:52
Done.
|
| + * |
| + * 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_ |
| + |
|
Andrew MacDonald
2015/08/10 15:25:55
Remove extra blank line.
peah-webrtc
2015/08/12 20:25:52
Done.
|
| + |
| +// To enable AEC logging, run this command from trunk/ : |
|
hlundin-webrtc
2015/08/10 13:04:41
See my other suggestion in aec_logging_file_handli
peah-webrtc
2015/08/12 20:25:52
Done.
|
| +// python webrtc/build/gyp_webrtc.py -Daec_debug_dump=1 |
| +#ifdef WEBRTC_AEC_DEBUG_DUMP |
| +#include <stdio.h> |
| +#include "webrtc/modules/audio_processing/logging/aec_logging_file_handling.h" |
| +#endif |
| + |
| +#ifdef __cplusplus |
| +extern "C" { |
| +#endif |
|
kwiberg-webrtc
2015/08/10 20:19:57
You only define macros, so the extern "C" thingy i
peah-webrtc
2015/08/12 20:25:52
Done.
|
| + |
| + |
|
Andrew MacDonald
2015/08/10 15:25:55
Remove extra blank line.
peah-webrtc
2015/08/12 20:25:52
Done.
|
| +#ifndef WEBRTC_AEC_DEBUG_DUMP |
| + |
| +// Dump wav data to file |
|
hlundin-webrtc
2015/08/10 13:04:41
End with .
(On all comments.)
peah-webrtc
2015/08/12 20:25:51
Done.
|
| +#define WEBRTC_AEC_DEBUG_WAV_WRITE(file, data, numSamples) |
|
Andrew MacDonald
2015/08/10 15:25:55
I know this creates inconsistencies, but we've bee
peah-webrtc
2015/08/12 20:25:52
Done.
|
| + |
| +// (Re)open wav file for writing using the specified sample rate |
|
Andrew MacDonald
2015/08/10 15:25:55
Just add all these comments once on the implemente
peah-webrtc
2015/08/12 20:25:52
Done.
|
| +#define WEBRTC_AEC_DEBUG_WAV_REOPEN(wavFile, name, seq1, seq2, sampleRate) |
|
kwiberg-webrtc
2015/08/10 20:19:57
Macros that should expand to empty statements shou
peah-webrtc
2015/08/12 20:25:52
Done!
Did I do it right now? One concern I have is
kwiberg-webrtc
2015/08/13 07:59:34
Looks good now. And yes, do {} while (0) really ou
|
| + |
| +// Close wav file |
| +#define WEBRTC_AEC_DEBUG_WAV_CLOSE(wavFile) |
| + |
| +// Dump raw data to file |
| +#define WEBRTC_AEC_DEBUG_RAW_WRITE(file, data, dataSize) |
| + |
| +// Open raw data file for writing using the specified sample rate |
| +#define WEBRTC_AEC_DEBUG_RAW_OPEN(file, name, instanceCtr) |
| + |
| +// Close raw data file |
| +#define WEBRTC_AEC_DEBUG_RAW_CLOSE(file) |
| + |
| +#else // WEBRTC_AEC_DEBUG_DUMP |
| + |
| +// Dump wav data to file |
| +#define WEBRTC_AEC_DEBUG_WAV_WRITE(file, data, numSamples) \ |
| + do { \ |
| + rtc_WavWriteSamples(file, data, numSamples); \ |
|
hlundin-webrtc
2015/08/10 13:04:41
Parentheses around the parameters, like you have b
kwiberg-webrtc
2015/08/10 20:19:57
Can you give an example invocation of the macro wh
hlundin-webrtc
2015/08/12 11:48:18
No, I can not. It was just a knee-jerk reaction fr
peah-webrtc
2015/08/12 20:25:51
Please see comment below!
peah-webrtc
2015/08/12 20:25:52
I think you are both correct. I've been taught to
peah-webrtc
2015/08/12 20:25:52
Acknowledged.
kwiberg-webrtc
2015/08/13 07:59:34
I'd be happier if you removed them, since they clu
peah-webrtc
2015/08/13 13:37:39
Done.
|
| + } while (0); |
|
kwiberg-webrtc
2015/08/10 20:19:56
Better to leave the semicolon out of the macro def
peah-webrtc
2015/08/12 20:25:51
Great point!
peah-webrtc
2015/08/12 20:25:52
Done.
|
| + |
| +// (Re)open wav file for writing using the specified sample rate |
| +#define WEBRTC_AEC_DEBUG_WAV_REOPEN(wavFile, name, seq1, seq2, sampleRate) \ |
| + do { \ |
| + WebRtcAec_ReopenWav((wavFile), (name), (seq1), (seq2), (sampleRate)); \ |
| + } while (0); |
| + |
| +// Close wav file |
| +#define WEBRTC_AEC_DEBUG_WAV_CLOSE(wavFile) \ |
| + do { \ |
| + rtc_WavClose((wavFile)); \ |
| + } while (0); |
| + |
| +// Dump raw data to file |
| +#define WEBRTC_AEC_DEBUG_RAW_WRITE(file, data, dataSize) \ |
| + do { \ |
| + (void)fwrite((data), (dataSize) , 1, (file)); \ |
| + } while (0); |
| + |
| +// Open raw data file for writing using the specified sample rate |
| +#define WEBRTC_AEC_DEBUG_RAW_OPEN(file, name, instanceCtr) \ |
| + do { \ |
| + WebRtcAec_RawFileOpen((file), (name), (instanceCtr)); \ |
| + } while (0); |
| + |
| + |
|
Andrew MacDonald
2015/08/10 15:25:54
Remove extra blank line.
peah-webrtc
2015/08/12 20:25:52
Done.
|
| +// Close raw data file |
| +#define WEBRTC_AEC_DEBUG_RAW_CLOSE(file) \ |
| + do { \ |
| + fclose((file)); \ |
| + } while (0); |
| + |
| + |
| + |
|
Andrew MacDonald
2015/08/10 15:25:54
Remove two extra blank lines.
peah-webrtc
2015/08/12 20:25:52
Done.
|
| +#endif // WEBRTC_AEC_DEBUG_DUMP |
| + |
| +#ifdef __cplusplus |
| +} |
| +#endif |
| + |
| +#endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_LOGGING_ |
|
kwiberg-webrtc
2015/08/10 20:19:57
Hmm. Suggestion: Instead of
#ifdef WEBRTC_AEC_DE
peah-webrtc
2015/08/12 20:25:52
Would it be guaranteed that those inline function
kwiberg-webrtc
2015/08/13 07:59:34
There's no guarantee that the compiler will actual
peah-webrtc
2015/08/13 13:37:39
I think that you are correct in that all compilers
peah-webrtc
2015/08/17 09:36:16
After an offline discussion, it was concluded that
kwiberg-webrtc
2015/08/17 09:43:07
Yes. :-)
Andrew MacDonald
2015/08/17 16:37:05
Yes.
|