Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: webrtc/modules/audio_processing/logging/aec_logging.h

Issue 1272403003: Replaced the wav file dumping functionality in aec_core.c with the newly added corresponding macros (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added support for inclusion from C++ code Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * 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.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_LOGGING_
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_LOGGING_
13
Andrew MacDonald 2015/08/10 15:25:55 Remove extra blank line.
peah-webrtc 2015/08/12 20:25:52 Done.
14
15 // 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.
16 // python webrtc/build/gyp_webrtc.py -Daec_debug_dump=1
17 #ifdef WEBRTC_AEC_DEBUG_DUMP
18 #include <stdio.h>
19 #include "webrtc/modules/audio_processing/logging/aec_logging_file_handling.h"
20 #endif
21
22 #ifdef __cplusplus
23 extern "C" {
24 #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.
25
26
Andrew MacDonald 2015/08/10 15:25:55 Remove extra blank line.
peah-webrtc 2015/08/12 20:25:52 Done.
27 #ifndef WEBRTC_AEC_DEBUG_DUMP
28
29 // 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.
30 #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.
31
32 // (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.
33 #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
34
35 // Close wav file
36 #define WEBRTC_AEC_DEBUG_WAV_CLOSE(wavFile)
37
38 // Dump raw data to file
39 #define WEBRTC_AEC_DEBUG_RAW_WRITE(file, data, dataSize)
40
41 // Open raw data file for writing using the specified sample rate
42 #define WEBRTC_AEC_DEBUG_RAW_OPEN(file, name, instanceCtr)
43
44 // Close raw data file
45 #define WEBRTC_AEC_DEBUG_RAW_CLOSE(file)
46
47 #else // WEBRTC_AEC_DEBUG_DUMP
48
49 // Dump wav data to file
50 #define WEBRTC_AEC_DEBUG_WAV_WRITE(file, data, numSamples) \
51 do { \
52 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.
53 } 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.
54
55 // (Re)open wav file for writing using the specified sample rate
56 #define WEBRTC_AEC_DEBUG_WAV_REOPEN(wavFile, name, seq1, seq2, sampleRate) \
57 do { \
58 WebRtcAec_ReopenWav((wavFile), (name), (seq1), (seq2), (sampleRate)); \
59 } while (0);
60
61 // Close wav file
62 #define WEBRTC_AEC_DEBUG_WAV_CLOSE(wavFile) \
63 do { \
64 rtc_WavClose((wavFile)); \
65 } while (0);
66
67 // Dump raw data to file
68 #define WEBRTC_AEC_DEBUG_RAW_WRITE(file, data, dataSize) \
69 do { \
70 (void)fwrite((data), (dataSize) , 1, (file)); \
71 } while (0);
72
73 // Open raw data file for writing using the specified sample rate
74 #define WEBRTC_AEC_DEBUG_RAW_OPEN(file, name, instanceCtr) \
75 do { \
76 WebRtcAec_RawFileOpen((file), (name), (instanceCtr)); \
77 } while (0);
78
79
Andrew MacDonald 2015/08/10 15:25:54 Remove extra blank line.
peah-webrtc 2015/08/12 20:25:52 Done.
80 // Close raw data file
81 #define WEBRTC_AEC_DEBUG_RAW_CLOSE(file) \
82 do { \
83 fclose((file)); \
84 } while (0);
85
86
87
Andrew MacDonald 2015/08/10 15:25:54 Remove two extra blank lines.
peah-webrtc 2015/08/12 20:25:52 Done.
88 #endif // WEBRTC_AEC_DEBUG_DUMP
89
90 #ifdef __cplusplus
91 }
92 #endif
93
94 #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.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698