 Chromium Code Reviews
 Chromium Code Reviews 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
    
  
    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| 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" | |
| 
Andrew MacDonald
2015/08/17 16:37:05
nit: style guide likes the associated header to be
 
peah-webrtc
2015/08/25 05:05:28
Done.
 | |
| 18 | |
| 19 #ifdef WEBRTC_AEC_DEBUG_DUMP | |
| 20 extern "C" 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", name, | |
| 33 instance_index, process_rate); | |
| 34 | |
| 35 // Ensrure there was no buffer output error. | |
| 36 assert(written >= 0); | |
| 
Andrew MacDonald
2015/08/17 16:37:05
Since this is C++ now, you could use DCHECKs inste
 
the sun
2015/08/24 11:04:46
+1
 
peah-webrtc
2015/08/25 05:05:28
Done.
 | |
| 37 // Ensure that the buffer size was sufficient. | |
| 38 assert((size_t)written < sizeof(filename)); | |
| 39 | |
| 40 *wav_file = rtc_WavOpen(filename, sample_rate, 1); | |
| 41 } | |
| 42 | |
| 43 extern "C" void WebRtcAec_RawFileOpen(const char* name, | |
| 44 int instance_counter, | |
| 45 FILE** file) { | |
| 46 int written ATTRIBUTE_UNUSED; | |
| 47 char filename[64]; | |
| 48 | |
| 49 written = | |
| 50 snprintf(filename, sizeof(filename), "%s_%d.dat", name, instance_counter); | |
| 51 | |
| 52 // Ensrure there was no buffer output error. | |
| 53 assert(written >= 0); | |
| 54 // Ensure that the buffer size was sufficient. | |
| 55 assert((size_t)written < sizeof(filename)); | |
| 56 | |
| 57 *file = fopen(filename, "wb"); | |
| 58 } | |
| 59 | |
| 60 #endif // WEBRTC_AEC_DEBUG_DUMP | |
| OLD | NEW |