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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 fwrite(v, sizeof(v[0]), v_length, file); | 66 fwrite(v, sizeof(v[0]), v_length, file); |
67 #endif | 67 #endif |
68 } | 68 } |
69 | 69 |
70 void DumpRaw(const char* name, rtc::ArrayView<const float> v) { | 70 void DumpRaw(const char* name, rtc::ArrayView<const float> v) { |
71 #if WEBRTC_AEC_DEBUG_DUMP == 1 | 71 #if WEBRTC_AEC_DEBUG_DUMP == 1 |
72 DumpRaw(name, v.size(), v.data()); | 72 DumpRaw(name, v.size(), v.data()); |
73 #endif | 73 #endif |
74 } | 74 } |
75 | 75 |
| 76 void DumpRaw(const char* name, int v_length, const int16_t* v) { |
| 77 #if WEBRTC_AEC_DEBUG_DUMP == 1 |
| 78 FILE* file = GetRawFile(name); |
| 79 fwrite(v, sizeof(v[0]), v_length, file); |
| 80 #endif |
| 81 } |
| 82 |
| 83 void DumpRaw(const char* name, rtc::ArrayView<const int16_t> v) { |
| 84 #if WEBRTC_AEC_DEBUG_DUMP == 1 |
| 85 DumpRaw(name, v.size(), v.data()); |
| 86 #endif |
| 87 } |
| 88 |
| 89 void DumpRaw(const char* name, int v_length, const int32_t* v) { |
| 90 #if WEBRTC_AEC_DEBUG_DUMP == 1 |
| 91 FILE* file = GetRawFile(name); |
| 92 fwrite(v, sizeof(v[0]), v_length, file); |
| 93 #endif |
| 94 } |
| 95 |
| 96 void DumpRaw(const char* name, rtc::ArrayView<const int32_t> v) { |
| 97 #if WEBRTC_AEC_DEBUG_DUMP == 1 |
| 98 DumpRaw(name, v.size(), v.data()); |
| 99 #endif |
| 100 } |
| 101 |
76 void DumpWav(const char* name, | 102 void DumpWav(const char* name, |
77 int v_length, | 103 int v_length, |
78 const float* v, | 104 const float* v, |
79 int sample_rate_hz, | 105 int sample_rate_hz, |
80 int num_channels) { | 106 int num_channels) { |
81 #if WEBRTC_AEC_DEBUG_DUMP == 1 | 107 #if WEBRTC_AEC_DEBUG_DUMP == 1 |
82 WavWriter* file = GetWavFile(name, sample_rate_hz, num_channels); | 108 WavWriter* file = GetWavFile(name, sample_rate_hz, num_channels); |
83 file->WriteSamples(v, v_length); | 109 file->WriteSamples(v, v_length); |
84 #endif | 110 #endif |
85 } | 111 } |
86 | 112 |
87 private: | 113 private: |
88 #if WEBRTC_AEC_DEBUG_DUMP == 1 | 114 #if WEBRTC_AEC_DEBUG_DUMP == 1 |
89 const int instance_index_; | 115 const int instance_index_; |
90 int recording_set_index_ = 0; | 116 int recording_set_index_ = 0; |
91 std::unordered_map<std::string, std::unique_ptr<FILE, RawFileCloseFunctor>> | 117 std::unordered_map<std::string, std::unique_ptr<FILE, RawFileCloseFunctor>> |
92 raw_files_; | 118 raw_files_; |
93 std::unordered_map<std::string, std::unique_ptr<WavWriter>> wav_files_; | 119 std::unordered_map<std::string, std::unique_ptr<WavWriter>> wav_files_; |
94 | 120 |
95 FILE* GetRawFile(const char* name); | 121 FILE* GetRawFile(const char* name); |
96 WavWriter* GetWavFile(const char* name, int sample_rate_hz, int num_channels); | 122 WavWriter* GetWavFile(const char* name, int sample_rate_hz, int num_channels); |
97 #endif | 123 #endif |
98 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(ApmDataDumper); | 124 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(ApmDataDumper); |
99 }; | 125 }; |
100 | 126 |
101 } // namespace webrtc | 127 } // namespace webrtc |
102 | 128 |
103 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_LOGGING_APM_DATA_DUMPER_H_ | 129 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_LOGGING_APM_DATA_DUMPER_H_ |
OLD | NEW |