Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright (c) 2016 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 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_LOGGING_APM_DATA_DUMPER_H_ | |
| 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_LOGGING_APM_DATA_DUMPER_H_ | |
| 13 | |
| 14 #include <map> | |
| 15 #include <string> | |
| 16 | |
| 17 #include "webrtc/base/constructormagic.h" | |
| 18 #include "webrtc/base/array_view.h" | |
|
hlundin-webrtc
2016/04/11 11:58:29
Order of includes.
peah-webrtc
2016/04/12 21:46:39
Done.
| |
| 19 #include "webrtc/common_audio/wav_file.h" | |
| 20 | |
| 21 namespace webrtc { | |
| 22 | |
| 23 // Class that handles dumping of variables into files. | |
| 24 class ApmDataDumper { | |
| 25 public: | |
| 26 // Constructor that takes an instance index that may | |
| 27 // be used to distinguish data dumped from different | |
| 28 // instances of the code. | |
| 29 explicit ApmDataDumper(int instance_index) | |
| 30 : instance_index_(instance_index) {} | |
| 31 ~ApmDataDumper(); | |
| 32 | |
| 33 // (Re)Initializes the data dumping such that new versions | |
| 34 // of all files being dumped to are created. | |
| 35 void Initialize(); | |
|
kwiberg-webrtc
2016/04/11 10:43:37
The name of this function suggests that it has to
hlundin-webrtc
2016/04/11 11:58:29
Acknowledged.
peah-webrtc
2016/04/12 21:46:39
Done.
peah-webrtc
2016/04/12 21:46:39
Good point! Did not think of that. I modified this
| |
| 36 | |
| 37 // Methods for performing dumping of data of various types into | |
| 38 // various formats. | |
| 39 void DumpRaw(const std::string& name, int v_length, float* v); | |
| 40 void DumpRaw(const std::string& name, rtc::ArrayView<const float> v); | |
| 41 void DumpWav(const std::string& name, | |
| 42 int v_length, | |
| 43 float* v, | |
| 44 int sample_rate_hz); | |
| 45 void DumpWav(const std::string& name, | |
| 46 rtc::ArrayView<const float> v, | |
| 47 int sample_rate_hz); | |
|
kwiberg-webrtc
2016/04/11 10:43:37
By making these methods not inline, you'll prevent
peah-webrtc
2016/04/12 21:46:39
Good point!
Done.
| |
| 48 | |
| 49 private: | |
|
kwiberg-webrtc
2016/04/11 10:43:37
Consider #ifdeffing the members away too.
peah-webrtc
2016/04/12 21:46:39
Done.
| |
| 50 const int instance_index_; | |
| 51 int reinit_counter_ = -1; | |
| 52 std::map<std::string, FILE*> raw_files_; | |
| 53 std::map<std::string, rtc_WavWriter*> wav_files_; | |
| 54 | |
| 55 FILE* GetRawFile(const std::string& name); | |
|
kwiberg-webrtc
2016/04/11 10:43:37
You don't include anything that provides FILE exce
hlundin-webrtc
2016/04/11 11:58:29
Forward declare?
peah-webrtc
2016/04/12 21:46:39
Good find!
peah-webrtc
2016/04/12 21:46:39
I'm not sure what you mean with this.
hlundin-webrtc
2016/04/25 11:29:59
What I think I meant was that since your previous
| |
| 56 rtc_WavWriter* GetWavFile(const std::string& name, int sample_rate_hz); | |
|
kwiberg-webrtc
2016/04/11 10:43:37
It looks like you're using the C API for the wav w
peah-webrtc
2016/04/12 21:46:39
Good point!
Done.
| |
| 57 | |
| 58 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(ApmDataDumper); | |
| 59 }; | |
| 60 | |
| 61 } // namespace webrtc | |
| 62 | |
| 63 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_LOGGING_APM_DATA_DUMPER_H_ | |
| OLD | NEW |