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 <assert.h> |
| 12 #include <stdint.h> |
| 13 #include <stdio.h> |
| 14 |
| 15 #include "webrtc/common_audio/wav_file.h" |
| 16 #include "webrtc/typedefs.h" |
| 17 #include "webrtc/modules/audio_processing/logging/aec_logging_file_handling.h" |
| 18 |
| 19 #ifdef WEBRTC_AEC_DEBUG_DUMP |
| 20 void WebRtcAec_ReopenWav(const char* name, |
| 21 int instance_index, |
| 22 int process_rate, |
| 23 int sample_rate, |
| 24 rtc_WavWriter** wav_file) { |
| 25 int written ATTRIBUTE_UNUSED; |
| 26 char filename[64]; |
| 27 if (*wav_file) { |
| 28 if (rtc_WavSampleRate(*wav_file) == sample_rate) |
| 29 return; |
| 30 rtc_WavClose(*wav_file); |
| 31 } |
| 32 written = snprintf(filename, sizeof(filename), "%s%d-%d.wav", |
| 33 name, instance_index, process_rate); |
| 34 assert(written >= 0); // no output error |
| 35 assert((size_t)written < sizeof(filename)); // buffer was large enough |
| 36 *wav_file = rtc_WavOpen(filename, sample_rate, 1); |
| 37 } |
| 38 |
| 39 |
| 40 void WebRtcAec_RawFileOpen(const char* name, |
| 41 int instance_counter, |
| 42 FILE** file) { |
| 43 int written ATTRIBUTE_UNUSED; |
| 44 char filename[64]; |
| 45 |
| 46 written = snprintf(filename, sizeof(filename), "%s_%d.dat", |
| 47 name, instance_counter); |
| 48 assert(written >= 0); // no output error |
| 49 assert((size_t)written < sizeof(filename)); // buffer was large enough |
| 50 |
| 51 *file = fopen(filename, "wb"); |
| 52 } |
| 53 |
| 54 |
| 55 #endif // WEBRTC_AEC_DEBUG_DUMP |
OLD | NEW |