OLD | NEW |
---|---|
(Empty) | |
1 /* | |
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 #include "webrtc/modules/audio_processing/logging/aec_logging_file_handling.h" | |
12 | |
13 #include <stdint.h> | |
14 #include <stdio.h> | |
15 | |
16 #include "webrtc/base/basicdefs.h" | |
17 #include "webrtc/base/checks.h" | |
18 #include "webrtc/base/stringutils.h" | |
19 #include "webrtc/common_audio/wav_file.h" | |
20 #include "webrtc/typedefs.h" | |
21 | |
22 #ifdef WEBRTC_AEC_DEBUG_DUMP | |
23 extern "C" void WebRtcAec_ReopenWav(const char* name, | |
kwiberg-webrtc
2015/08/25 09:04:43
You only need the 'extern "C"' in the declaration,
Andrew MacDonald
2015/08/25 17:16:29
Ah, interesting. I think we have this pattern else
peah-webrtc
2015/08/26 07:24:24
Done.
peah-webrtc
2015/08/26 07:24:25
Acknowledged.
peah-webrtc
2015/08/26 07:24:25
Done.
| |
24 int instance_index, | |
25 int process_rate, | |
26 int sample_rate, | |
27 rtc_WavWriter** wav_file) { | |
28 int written ATTRIBUTE_UNUSED; | |
29 char filename[64]; | |
kwiberg-webrtc
2015/08/25 09:04:43
Move declarations as far down as possible now that
peah-webrtc
2015/08/26 07:24:25
Done.
| |
30 if (*wav_file) { | |
31 if (rtc_WavSampleRate(*wav_file) == sample_rate) | |
32 return; | |
33 rtc_WavClose(*wav_file); | |
34 } | |
35 written = rtc::sprintfn(filename, ARRAY_SIZE(filename), "%s%d-%d.wav", name, | |
Andrew MacDonald
2015/08/25 17:16:29
sprintfn calls for a number of bytes in the second
peah-webrtc
2015/08/26 07:24:24
Done.
| |
36 instance_index, process_rate); | |
kwiberg-webrtc
2015/08/25 09:04:43
You appear to need to run clang-format.
peah-webrtc
2015/08/26 07:24:24
Done.
| |
37 | |
38 // Ensure there was no buffer output error. | |
39 DCHECK(written >= 0); | |
kwiberg-webrtc
2015/08/25 09:04:43
DCHECK_GE
peah-webrtc
2015/08/26 07:24:24
Done.
| |
40 // Ensure that the buffer size was sufficient. | |
41 DCHECK(static_cast<size_t>(written) < sizeof(filename)); | |
kwiberg-webrtc
2015/08/25 09:04:43
DCHECK_LT
peah-webrtc
2015/08/26 07:24:24
Done.
| |
42 | |
43 *wav_file = rtc_WavOpen(filename, sample_rate, 1); | |
44 } | |
45 | |
46 extern "C" void WebRtcAec_RawFileOpen(const char* name, | |
47 int instance_counter, | |
the sun
2015/08/25 08:32:35
Is there a difference between instance_index (as u
peah-webrtc
2015/08/26 07:24:25
Done.
peah-webrtc
2015/08/26 07:24:25
Good point. No, there is not :-). I'll choose the
| |
48 FILE** file) { | |
49 int written ATTRIBUTE_UNUSED; | |
kwiberg-webrtc
2015/08/25 09:04:43
You shouldn't need the ATTRIBUTE_UNUSED. (DCHECK i
peah-webrtc
2015/08/26 07:24:25
Done.
| |
50 char filename[64]; | |
51 | |
52 written = rtc::sprintfn(filename, ARRAY_SIZE(filename), "%s_%d.dat", name, | |
53 instance_counter); | |
54 | |
55 // Ensure there was no buffer output error. | |
56 DCHECK(written >= 0); | |
57 // Ensure that the buffer size was sufficient. | |
58 DCHECK(static_cast<size_t>(written) < sizeof(filename)); | |
59 | |
60 *file = fopen(filename, "wb"); | |
61 } | |
62 | |
63 #endif // WEBRTC_AEC_DEBUG_DUMP | |
OLD | NEW |