| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 const std::string& suffix) { | 31 const std::string& suffix) { |
| 32 std::stringstream ss; | 32 std::stringstream ss; |
| 33 ss << name << "_" << instance_index << "-" << reinit_index << suffix; | 33 ss << name << "_" << instance_index << "-" << reinit_index << suffix; |
| 34 return ss.str(); | 34 return ss.str(); |
| 35 } | 35 } |
| 36 #endif | 36 #endif |
| 37 | 37 |
| 38 } // namespace | 38 } // namespace |
| 39 | 39 |
| 40 #if WEBRTC_AEC_DEBUG_DUMP == 1 | 40 #if WEBRTC_AEC_DEBUG_DUMP == 1 |
| 41 ApmDataDumper::ApmDataDumper(int instance_index) |
| 42 : instance_index_(instance_index) {} |
| 43 #else |
| 44 ApmDataDumper::ApmDataDumper(int instance_index) {} |
| 45 #endif |
| 46 |
| 47 ApmDataDumper::~ApmDataDumper() {} |
| 48 |
| 49 #if WEBRTC_AEC_DEBUG_DUMP == 1 |
| 41 FILE* ApmDataDumper::GetRawFile(const char* name) { | 50 FILE* ApmDataDumper::GetRawFile(const char* name) { |
| 42 std::string filename = | 51 std::string filename = |
| 43 FormFileName(name, instance_index_, recording_set_index_, ".dat"); | 52 FormFileName(name, instance_index_, recording_set_index_, ".dat"); |
| 44 auto& f = raw_files_[filename]; | 53 auto& f = raw_files_[filename]; |
| 45 if (!f) { | 54 if (!f) { |
| 46 f.reset(fopen(filename.c_str(), "wb")); | 55 f.reset(fopen(filename.c_str(), "wb")); |
| 47 } | 56 } |
| 48 return f.get(); | 57 return f.get(); |
| 49 } | 58 } |
| 50 | 59 |
| 51 WavWriter* ApmDataDumper::GetWavFile(const char* name, | 60 WavWriter* ApmDataDumper::GetWavFile(const char* name, |
| 52 int sample_rate_hz, | 61 int sample_rate_hz, |
| 53 int num_channels) { | 62 int num_channels) { |
| 54 std::string filename = | 63 std::string filename = |
| 55 FormFileName(name, instance_index_, recording_set_index_, ".wav"); | 64 FormFileName(name, instance_index_, recording_set_index_, ".wav"); |
| 56 auto& f = wav_files_[filename]; | 65 auto& f = wav_files_[filename]; |
| 57 if (!f) { | 66 if (!f) { |
| 58 f.reset(new WavWriter(filename.c_str(), sample_rate_hz, num_channels)); | 67 f.reset(new WavWriter(filename.c_str(), sample_rate_hz, num_channels)); |
| 59 } | 68 } |
| 60 return f.get(); | 69 return f.get(); |
| 61 } | 70 } |
| 62 | 71 |
| 63 #endif | 72 #endif |
| 64 | 73 |
| 65 } // namespace webrtc | 74 } // namespace webrtc |
| OLD | NEW |