Chromium Code Reviews| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 // Reinitializes the data dumping such that new versions | 50 // Reinitializes the data dumping such that new versions |
| 51 // of all files being dumped to are created. | 51 // of all files being dumped to are created. |
| 52 void InitiateNewSetOfRecordings() { | 52 void InitiateNewSetOfRecordings() { |
| 53 #if WEBRTC_APM_DEBUG_DUMP == 1 | 53 #if WEBRTC_APM_DEBUG_DUMP == 1 |
| 54 ++recording_set_index_; | 54 ++recording_set_index_; |
| 55 #endif | 55 #endif |
| 56 } | 56 } |
| 57 | 57 |
| 58 // Methods for performing dumping of data of various types into | 58 // Methods for performing dumping of data of various types into |
| 59 // various formats. | 59 // various formats. |
| 60 void DumpRaw(const char* name, double v) { | |
| 61 #if WEBRTC_APM_DEBUG_DUMP == 1 | |
| 62 FILE* file = GetRawFile(name); | |
| 63 fwrite(&v, sizeof(v), 1, file); | |
| 64 #endif | |
| 65 } | |
| 66 | |
| 67 void DumpRaw(const char* name, int v_length, const double* v) { | |
|
hlundin-webrtc
2017/01/18 13:08:51
size_t v_length
peah-webrtc
2017/01/19 15:33:07
Done.
| |
| 68 #if WEBRTC_APM_DEBUG_DUMP == 1 | |
| 69 FILE* file = GetRawFile(name); | |
| 70 fwrite(v, sizeof(v[0]), v_length, file); | |
| 71 #endif | |
| 72 } | |
| 73 | |
| 74 void DumpRaw(const char* name, rtc::ArrayView<const double> v) { | |
| 75 #if WEBRTC_APM_DEBUG_DUMP == 1 | |
| 76 DumpRaw(name, v.size(), v.data()); | |
| 77 #endif | |
| 78 } | |
| 79 | |
| 80 void DumpRaw(const char* name, float v) { | |
| 81 #if WEBRTC_APM_DEBUG_DUMP == 1 | |
| 82 FILE* file = GetRawFile(name); | |
| 83 fwrite(&v, sizeof(v), 1, file); | |
| 84 #endif | |
| 85 } | |
| 86 | |
| 60 void DumpRaw(const char* name, int v_length, const float* v) { | 87 void DumpRaw(const char* name, int v_length, const float* v) { |
| 61 #if WEBRTC_APM_DEBUG_DUMP == 1 | 88 #if WEBRTC_APM_DEBUG_DUMP == 1 |
| 62 FILE* file = GetRawFile(name); | 89 FILE* file = GetRawFile(name); |
| 63 fwrite(v, sizeof(v[0]), v_length, file); | 90 fwrite(v, sizeof(v[0]), v_length, file); |
| 64 #endif | 91 #endif |
| 65 } | 92 } |
| 66 | 93 |
| 67 void DumpRaw(const char* name, rtc::ArrayView<const float> v) { | 94 void DumpRaw(const char* name, rtc::ArrayView<const float> v) { |
| 68 #if WEBRTC_APM_DEBUG_DUMP == 1 | 95 #if WEBRTC_APM_DEBUG_DUMP == 1 |
| 69 DumpRaw(name, v.size(), v.data()); | 96 DumpRaw(name, v.size(), v.data()); |
| 70 #endif | 97 #endif |
| 71 } | 98 } |
| 72 | 99 |
| 100 void DumpRaw(const char* name, bool v) { | |
| 101 #if WEBRTC_APM_DEBUG_DUMP == 1 | |
| 102 FILE* file = GetRawFile(name); | |
|
hlundin-webrtc
2017/01/18 13:08:51
You could just call
DumpRaw(name, static_cast<int1
peah-webrtc
2017/01/19 15:33:07
Good find!
Done.
| |
| 103 int16_t value = static_cast<int16_t>(v); | |
| 104 fwrite(&value, sizeof(value), 1, file); | |
| 105 #endif | |
| 106 } | |
| 107 | |
| 73 void DumpRaw(const char* name, int v_length, const bool* v) { | 108 void DumpRaw(const char* name, int v_length, const bool* v) { |
| 74 #if WEBRTC_APM_DEBUG_DUMP == 1 | 109 #if WEBRTC_APM_DEBUG_DUMP == 1 |
| 75 FILE* file = GetRawFile(name); | 110 FILE* file = GetRawFile(name); |
| 76 for (int k = 0; k < v_length; ++k) { | 111 for (int k = 0; k < v_length; ++k) { |
| 77 int16_t value = static_cast<int16_t>(v[k]); | 112 int16_t value = static_cast<int16_t>(v[k]); |
| 78 fwrite(&value, sizeof(value), 1, file); | 113 fwrite(&value, sizeof(value), 1, file); |
| 79 } | 114 } |
| 80 #endif | 115 #endif |
| 81 } | 116 } |
| 82 | 117 |
| 83 void DumpRaw(const char* name, rtc::ArrayView<const bool> v) { | 118 void DumpRaw(const char* name, rtc::ArrayView<const bool> v) { |
| 84 #if WEBRTC_APM_DEBUG_DUMP == 1 | 119 #if WEBRTC_APM_DEBUG_DUMP == 1 |
| 85 DumpRaw(name, v.size(), v.data()); | 120 DumpRaw(name, v.size(), v.data()); |
| 86 #endif | 121 #endif |
| 87 } | 122 } |
| 88 | 123 |
| 124 void DumpRaw(const char* name, int16_t v) { | |
| 125 #if WEBRTC_APM_DEBUG_DUMP == 1 | |
| 126 FILE* file = GetRawFile(name); | |
| 127 fwrite(&v, sizeof(v), 1, file); | |
| 128 #endif | |
| 129 } | |
| 130 | |
| 89 void DumpRaw(const char* name, int v_length, const int16_t* v) { | 131 void DumpRaw(const char* name, int v_length, const int16_t* v) { |
| 90 #if WEBRTC_APM_DEBUG_DUMP == 1 | 132 #if WEBRTC_APM_DEBUG_DUMP == 1 |
| 91 FILE* file = GetRawFile(name); | 133 FILE* file = GetRawFile(name); |
| 92 fwrite(v, sizeof(v[0]), v_length, file); | 134 fwrite(v, sizeof(v[0]), v_length, file); |
| 93 #endif | 135 #endif |
| 94 } | 136 } |
| 95 | 137 |
| 96 void DumpRaw(const char* name, rtc::ArrayView<const int16_t> v) { | 138 void DumpRaw(const char* name, rtc::ArrayView<const int16_t> v) { |
| 97 #if WEBRTC_APM_DEBUG_DUMP == 1 | 139 #if WEBRTC_APM_DEBUG_DUMP == 1 |
| 98 DumpRaw(name, v.size(), v.data()); | 140 DumpRaw(name, v.size(), v.data()); |
| 99 #endif | 141 #endif |
| 100 } | 142 } |
| 101 | 143 |
| 144 void DumpRaw(const char* name, int32_t v) { | |
| 145 #if WEBRTC_APM_DEBUG_DUMP == 1 | |
| 146 FILE* file = GetRawFile(name); | |
| 147 fwrite(&v, sizeof(v), 1, file); | |
| 148 #endif | |
| 149 } | |
| 150 | |
| 102 void DumpRaw(const char* name, int v_length, const int32_t* v) { | 151 void DumpRaw(const char* name, int v_length, const int32_t* v) { |
| 103 #if WEBRTC_APM_DEBUG_DUMP == 1 | 152 #if WEBRTC_APM_DEBUG_DUMP == 1 |
| 104 FILE* file = GetRawFile(name); | 153 FILE* file = GetRawFile(name); |
| 105 fwrite(v, sizeof(v[0]), v_length, file); | 154 fwrite(v, sizeof(v[0]), v_length, file); |
| 106 #endif | 155 #endif |
| 107 } | 156 } |
| 108 | 157 |
| 158 void DumpRaw(const char* name, size_t v) { | |
|
hlundin-webrtc
2017/01/18 13:08:51
Hmmm. This starts to look a bit like a candidate f
peah-webrtc
2017/01/19 15:33:07
True. Let's do that. But I'd rather keep that chan
hlundin-webrtc
2017/01/20 09:31:44
Good.
peah-webrtc
2017/01/23 14:16:39
Acknowledged.
| |
| 159 #if WEBRTC_APM_DEBUG_DUMP == 1 | |
| 160 FILE* file = GetRawFile(name); | |
| 161 fwrite(&v, sizeof(v), 1, file); | |
| 162 #endif | |
| 163 } | |
| 164 | |
| 165 void DumpRaw(const char* name, int v_length, const size_t* v) { | |
| 166 #if WEBRTC_APM_DEBUG_DUMP == 1 | |
| 167 FILE* file = GetRawFile(name); | |
| 168 fwrite(v, sizeof(v[0]), v_length, file); | |
| 169 #endif | |
| 170 } | |
| 171 | |
| 109 void DumpRaw(const char* name, rtc::ArrayView<const int32_t> v) { | 172 void DumpRaw(const char* name, rtc::ArrayView<const int32_t> v) { |
| 110 #if WEBRTC_APM_DEBUG_DUMP == 1 | 173 #if WEBRTC_APM_DEBUG_DUMP == 1 |
| 111 DumpRaw(name, v.size(), v.data()); | 174 DumpRaw(name, v.size(), v.data()); |
| 112 #endif | 175 #endif |
| 113 } | 176 } |
| 114 | 177 |
| 115 void DumpWav(const char* name, | 178 void DumpWav(const char* name, |
| 116 int v_length, | 179 int v_length, |
| 117 const float* v, | 180 const float* v, |
| 118 int sample_rate_hz, | 181 int sample_rate_hz, |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 142 | 205 |
| 143 FILE* GetRawFile(const char* name); | 206 FILE* GetRawFile(const char* name); |
| 144 WavWriter* GetWavFile(const char* name, int sample_rate_hz, int num_channels); | 207 WavWriter* GetWavFile(const char* name, int sample_rate_hz, int num_channels); |
| 145 #endif | 208 #endif |
| 146 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(ApmDataDumper); | 209 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(ApmDataDumper); |
| 147 }; | 210 }; |
| 148 | 211 |
| 149 } // namespace webrtc | 212 } // namespace webrtc |
| 150 | 213 |
| 151 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_LOGGING_APM_DATA_DUMPER_H_ | 214 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_LOGGING_APM_DATA_DUMPER_H_ |
| OLD | NEW |