OLD | NEW |
---|---|
(Empty) | |
1 /* | |
kwiberg-webrtc
2015/08/10 20:19:57
Why is this a C and not a C++ file? If it was C++,
peah-webrtc
2015/08/12 20:25:52
Do you mean I should rename it to aec_logging_file
kwiberg-webrtc
2015/08/13 07:59:34
Yes.
peah-webrtc
2015/08/13 13:37:40
Done.
| |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | |
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 | |
12 #ifdef WEBRTC_AEC_DEBUG_DUMP | |
the sun
2015/08/11 08:48:26
The includes don't need to be within conditionals
peah-webrtc
2015/08/12 20:25:52
Done.
| |
13 #include <assert.h> | |
14 #include <stdio.h> | |
15 #include <stdint.h> | |
Andrew MacDonald
2015/08/10 15:25:55
nit: blank line after this.
stdint.h before stdio
peah-webrtc
2015/08/12 20:25:52
Done.
| |
16 #include "webrtc/common_audio/wav_file.h" | |
17 #include "webrtc/typedefs.h" | |
18 #include "aec_logging_file_handling.h" | |
Andrew MacDonald
2015/08/10 15:25:55
Full path.
peah-webrtc
2015/08/12 20:25:53
Done.
| |
19 #endif | |
20 | |
21 // To enable AEC logging, run this command from trunk/ : | |
22 // python webrtc/build/gyp_webrtc -Daec_debug_dump=1 | |
23 #ifdef WEBRTC_AEC_DEBUG_DUMP | |
kwiberg-webrtc
2015/08/10 20:19:57
Lines 19 and 23 cancel each other out. (In other w
peah-webrtc
2015/08/12 20:25:53
Thanks! I removed the first #ifdef pair, so it is
peah-webrtc
2015/08/12 20:25:53
Done.
| |
24 // Open a new Wav file for writing. If it was already open with a different | |
25 // sample frequency, close it first. | |
Andrew MacDonald
2015/08/10 15:25:55
Move this documentation to the header. In particul
peah-webrtc
2015/08/12 20:25:52
Done.
| |
26 void WebRtcAec_ReopenWav(rtc_WavWriter** wav_file, | |
27 const char* const name, | |
the sun
2015/08/11 08:48:26
No need to make the pointer const, just the stuff
peah-webrtc
2015/08/12 20:25:52
Done.
| |
28 const int seq1, | |
29 const int seq2, | |
Andrew MacDonald
2015/08/10 15:25:55
Better names than seq1, seq2. It's not clear what
peah-webrtc
2015/08/12 20:25:52
Fully agree on that! This was the original code th
peah-webrtc
2015/08/12 20:25:52
Done.
| |
30 const int sample_rate) { | |
Andrew MacDonald
2015/08/10 15:25:55
Drop const from by-value parameters.
peah-webrtc
2015/08/12 20:25:52
Done.
| |
31 int written ATTRIBUTE_UNUSED; | |
32 char filename[64]; | |
33 if (*wav_file) { | |
34 if (rtc_WavSampleRate(*wav_file) == sample_rate) | |
35 return; | |
36 rtc_WavClose(*wav_file); | |
37 } | |
38 written = snprintf(filename, sizeof(filename), "%s%d-%d.wav", | |
39 name, seq1, seq2); | |
40 assert(written >= 0); // no output error | |
41 assert((size_t)written < sizeof(filename)); // buffer was large enough | |
Andrew MacDonald
2015/08/10 15:25:55
Capitals and periods (and below).
peah-webrtc
2015/08/12 20:25:52
I'm not sure what you refer to. Could you please b
hlundin-webrtc
2015/08/13 06:19:02
He refers to the somewhat picky style rule saying
kwiberg-webrtc
2015/08/13 07:59:34
This is probably the part of our coding style that
peah-webrtc
2015/08/13 13:37:40
Done.
peah-webrtc
2015/08/13 13:37:40
Acknowledged.
peah-webrtc
2015/08/13 13:37:40
Done.
| |
42 *wav_file = rtc_WavOpen(filename, sample_rate, 1); | |
43 } | |
44 | |
45 | |
46 // Open a new file for writing, named with a instance specific | |
47 // suffix | |
Andrew MacDonald
2015/08/10 15:25:55
Move this to the header.
peah-webrtc
2015/08/12 20:25:53
Done.
| |
48 void WebRtcAec_RawFileOpen(FILE** file, | |
49 const char * const name, | |
50 const int16_t instanceCtr) { | |
Andrew MacDonald
2015/08/10 15:25:55
Drop const and instance_counter
peah-webrtc
2015/08/12 20:25:53
Done.
| |
51 int written ATTRIBUTE_UNUSED; | |
Andrew MacDonald
2015/08/10 15:25:55
Indent.
peah-webrtc
2015/08/12 20:25:53
Done.
| |
52 char filename[64]; | |
53 | |
54 written = sprintf(filename, "%s_%d.dat", name, instanceCtr); | |
55 assert(written >= 0); // no output error | |
56 assert((size_t)written < sizeof(filename)); // buffer was large enough | |
the sun
2015/08/11 08:48:26
We should never knowingly introduce buffer overrun
peah-webrtc
2015/08/12 20:25:53
As far as I can see, the functions in stringutils.
the sun
2015/08/24 11:04:46
The implementation is C++ now, correct? Can you us
peah-webrtc
2015/08/25 05:05:28
Done.
| |
57 | |
58 *file = fopen(filename, "wb"); | |
59 } | |
60 | |
61 | |
62 #endif // WEBRTC_AEC_DEBUG_DUMP | |
OLD | NEW |