Chromium Code Reviews| 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 | |
| 12 #ifdef WEBRTC_AEC_DEBUG_DUMP | |
| 13 #include <assert.h> | |
| 14 #include <stdio.h> | |
| 15 #include <stdint.h> | |
|
hlundin-webrtc
2015/08/10 13:04:40
Sort includes alphabetically. stdint < stdio
peah-webrtc
2015/08/12 20:25:51
Done.
| |
| 16 #include "webrtc/common_audio/wav_file.h" | |
|
hlundin-webrtc
2015/08/10 13:04:40
I usually insert a blank line between system files
peah-webrtc
2015/08/12 20:25:51
Done.
| |
| 17 #include "webrtc/typedefs.h" | |
| 18 #include "aec_logging_file_handling.h" | |
|
hlundin-webrtc
2015/08/10 13:04:40
Use full path.
peah-webrtc
2015/08/12 20:25:50
Done.
| |
| 19 #endif | |
| 20 | |
| 21 // To enable AEC logging, run this command from trunk/ : | |
|
hlundin-webrtc
2015/08/10 13:04:40
This comment is the same as in the .h file.
Funct
peah-webrtc
2015/08/12 20:25:51
Done.
| |
| 22 // python webrtc/build/gyp_webrtc -Daec_debug_dump=1 | |
| 23 #ifdef WEBRTC_AEC_DEBUG_DUMP | |
| 24 // Open a new Wav file for writing. If it was already open with a different | |
| 25 // sample frequency, close it first. | |
| 26 void WebRtcAec_ReopenWav(rtc_WavWriter** wav_file, | |
|
hlundin-webrtc
2015/08/10 13:04:40
wav_file is both input and output. Input-only goes
Andrew MacDonald
2015/08/10 15:28:44
Agreed. I actually would prefer returning a rtc_Wa
peah-webrtc
2015/08/12 20:25:51
I agree that that would be preferrable. My concern
peah-webrtc
2015/08/12 20:25:51
Done.
Andrew MacDonald
2015/08/12 20:37:58
Ah, good point. Yes I think it's reasonable to kee
| |
| 27 const char* const name, | |
| 28 const int seq1, | |
| 29 const int seq2, | |
| 30 const int sample_rate) { | |
| 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 | |
| 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 | |
| 48 void WebRtcAec_RawFileOpen(FILE** file, | |
| 49 const char * const name, | |
| 50 const int16_t instanceCtr) { | |
| 51 int written ATTRIBUTE_UNUSED; | |
|
hlundin-webrtc
2015/08/10 13:04:40
Indentation. (Run "git cl format" on your patch.)
peah-webrtc
2015/08/12 20:25:51
Done.
| |
| 52 char filename[64]; | |
| 53 | |
| 54 written = sprintf(filename, "%s_%d.dat", name, instanceCtr); | |
|
hlundin-webrtc
2015/08/10 13:04:40
snprintf?
peah-webrtc
2015/08/12 20:25:51
Done.
| |
| 55 assert(written >= 0); // no output error | |
| 56 assert((size_t)written < sizeof(filename)); // buffer was large enough | |
| 57 | |
| 58 *file = fopen(filename, "wb"); | |
|
hlundin-webrtc
2015/08/10 13:04:40
Why not return a FILE* instead, and avoid the FILE
peah-webrtc
2015/08/12 20:25:51
I agree that would be a better solution, if only i
| |
| 59 } | |
| 60 | |
| 61 | |
| 62 #endif // WEBRTC_AEC_DEBUG_DUMP | |
| OLD | NEW |