Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright (c) 2017 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_AEC_DUMPER_AEC_DUMPER_H_ | |
| 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC_DUMPER_AEC_DUMPER_H_ | |
| 13 | |
| 14 #include <memory> | |
| 15 #include <string> | |
| 16 #include <vector> | |
| 17 | |
| 18 #include "webrtc/base/array_view.h" | |
| 19 #include "webrtc/base/constructormagic.h" | |
| 20 #include "webrtc/modules/audio_processing/include/audio_processing.h" | |
| 21 | |
| 22 namespace audioproc { | |
| 23 class Event; | |
| 24 } // namespace audioproc | |
| 25 | |
| 26 namespace rtc { | |
| 27 class TaskQueue; | |
| 28 } // namespace rtc | |
| 29 | |
| 30 namespace webrtc { | |
| 31 | |
| 32 class AudioFrame; | |
| 33 | |
| 34 // Struct for passing current config from APM without having to | |
| 35 // include protobuf headers. | |
| 36 struct InternalAPMConfig { | |
|
the sun
2017/04/03 14:33:02
Is it possible to extend the APM::Config to includ
aleloi
2017/04/06 15:46:11
Probably. For some reason, I thought we were movin
the sun
2017/04/06 17:39:37
Oh, misunderstanding. Not the template based globa
| |
| 37 InternalAPMConfig(); | |
| 38 | |
| 39 bool aec_enabled = false; | |
| 40 bool aec_delay_agnostic_enabled = false; | |
| 41 bool aec_drift_compensation_enabled = false; | |
| 42 bool aec_extended_filter_enabled = false; | |
| 43 int aec_suppression_level = 0; | |
| 44 bool aecm_enabled = false; | |
| 45 bool aecm_comfort_noise_enabled = false; | |
| 46 int aecm_routing_mode = 0; | |
| 47 bool agc_enabled = false; | |
| 48 int agc_mode = 0; | |
| 49 bool agc_limiter_enabled = false; | |
| 50 bool hpf_enabled = false; | |
| 51 bool ns_enabled = false; | |
| 52 int ns_level = 0; | |
| 53 bool transient_suppression_enabled = false; | |
| 54 bool intelligibility_enhancer_enabled = false; | |
| 55 bool noise_robust_agc_enabled = false; | |
| 56 std::string experiments_description = ""; | |
| 57 | |
| 58 private: | |
| 59 RTC_DISALLOW_COPY_AND_ASSIGN(InternalAPMConfig); | |
| 60 }; | |
| 61 | |
| 62 class AecDumper { | |
|
peah-webrtc
2017/03/31 07:24:42
Would it not make sense to at the same time change
the sun
2017/04/03 14:33:02
Let's keep AecDump for now.
1) The concept is alre
peah-webrtc
2017/04/05 04:41:50
Makes sense. In particular I think 1) is a very im
aleloi
2017/04/06 15:46:11
Changed to AecDump.
| |
| 63 public: | |
| 64 // A capture stream frame is logged before and after processing in | |
| 65 // the same protobuf message. To facilitate that, a | |
|
peah-webrtc
2017/03/31 07:24:42
Is really a line break needed here due to the leng
aleloi
2017/04/06 15:46:11
Done.
| |
| 66 // CaptureStreamInfo instance is first filled with Input, then | |
| 67 // Output. | |
| 68 // | |
| 69 // To log an input/output pair, first call | |
| 70 // AecDumper::GetCaptureStreamInfo. Add the input and output to | |
| 71 // it. Then call AecDumper::WriteCaptureStreamMessage. | |
| 72 class CaptureStreamInfo { | |
| 73 public: | |
| 74 virtual ~CaptureStreamInfo() = default; | |
| 75 virtual void AddInput(std::vector<rtc::ArrayView<const float>> src) = 0; | |
|
peah-webrtc
2017/03/31 07:24:42
Won't this cause a copy of src? Would it not be be
aleloi
2017/04/06 15:46:11
Done.
| |
| 76 virtual void AddOutput(std::vector<rtc::ArrayView<const float>> src) = 0; | |
|
peah-webrtc
2017/03/31 07:24:42
See above
aleloi
2017/04/06 15:46:11
Done.
| |
| 77 | |
| 78 virtual void AddInput(const AudioFrame& frame) = 0; | |
| 79 virtual void AddOutput(const AudioFrame& frame) = 0; | |
| 80 | |
| 81 virtual void set_delay(int delay) = 0; | |
| 82 virtual void set_drift(int drift) = 0; | |
| 83 virtual void set_level(int level) = 0; | |
| 84 virtual void set_keypress(bool keypress) = 0; | |
| 85 }; | |
| 86 | |
| 87 AecDumper() = default; | |
| 88 | |
| 89 virtual ~AecDumper() = default; | |
| 90 | |
| 91 // An AecDumper is always associated with a single file and task | |
| 92 // queue. The file is safely closed when the dtor is called. The | |
|
peah-webrtc
2017/03/31 07:24:42
Is this the case as it is now used in WebRTC?
aleloi
2017/04/06 15:46:10
I think using a single file / AecDump instance mak
| |
| 93 // task queue must outlive the created AecDumper instance. | |
| 94 static std::unique_ptr<AecDumper> Create(std::string file_name, | |
|
the sun
2017/04/03 14:33:02
For the reasons we've discussed offline (proto lib
aleloi
2017/04/06 15:46:11
Done, I think. I prefer having a null implementati
| |
| 95 int64_t max_log_size_bytes, | |
| 96 rtc::TaskQueue* worker_queue); | |
| 97 static std::unique_ptr<AecDumper> Create(FILE* handle, | |
| 98 int64_t max_log_size_bytes, | |
| 99 rtc::TaskQueue* worker_queue); | |
| 100 | |
| 101 static std::unique_ptr<AecDumper> CreateNullDumper(); | |
| 102 | |
| 103 virtual std::unique_ptr<CaptureStreamInfo> GetCaptureStreamInfo() = 0; | |
| 104 | |
| 105 virtual void WriteInitMessage(const ProcessingConfig& api_format) = 0; | |
| 106 | |
| 107 virtual void WriteReverseStreamMessage(const AudioFrame& frame) = 0; | |
|
peah-webrtc
2017/03/31 07:24:42
Would it make sense to change "Reverse" to "Render
the sun
2017/04/03 14:33:02
+1! "Reverse" stream makes my head explode.
aleloi
2017/04/06 15:46:11
Done.
| |
| 108 | |
| 109 virtual void WriteReverseStreamMessage( | |
| 110 std::vector<rtc::ArrayView<const float>> src) = 0; | |
|
peah-webrtc
2017/03/31 07:24:42
Won't this cause a copy of src? Would it not be be
aleloi
2017/04/06 15:46:11
Done.
| |
| 111 | |
| 112 virtual void WriteCaptureStreamMessage( | |
| 113 std::unique_ptr<CaptureStreamInfo> stream_info) = 0; | |
| 114 | |
| 115 // If not |forced|, only writes the current config if it is | |
| 116 // different from the last saved one; if |forced|, writes the config | |
| 117 // regardless of the last saved. | |
| 118 virtual void WriteConfig(const InternalAPMConfig& config, bool forced) = 0; | |
| 119 }; | |
| 120 } // namespace webrtc | |
| 121 | |
| 122 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC_DUMPER_AEC_DUMPER_H_ | |
| OLD | NEW |