Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: webrtc/modules/audio_processing/include/aec_dump.h

Issue 2778783002: AecDump interface (Closed)
Patch Set: Put capture logging in methods. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_INCLUDE_AEC_DUMP_H_
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AEC_DUMP_H_
13
14 #include <memory>
15 #include <string>
16 #include <vector>
17
18 #include "webrtc/base/array_view.h"
19
20 namespace audioproc {
21 class Event;
22 } // namespace audioproc
23
24 namespace webrtc {
25
26 class AudioFrame;
27
28 // Struct for passing current config from APM without having to
29 // include protobuf headers.
30 struct InternalAPMConfig {
31 InternalAPMConfig();
32 InternalAPMConfig(const InternalAPMConfig&);
33 InternalAPMConfig(InternalAPMConfig&&);
34
35 InternalAPMConfig& operator=(const InternalAPMConfig&) = delete;
36 InternalAPMConfig& operator=(const InternalAPMConfig&&) = delete;
37
38 bool aec_enabled = false;
39 bool aec_delay_agnostic_enabled = false;
40 bool aec_drift_compensation_enabled = false;
41 bool aec_extended_filter_enabled = false;
42 int aec_suppression_level = 0;
43 bool aecm_enabled = false;
44 bool aecm_comfort_noise_enabled = false;
45 int aecm_routing_mode = 0;
46 bool agc_enabled = false;
47 int agc_mode = 0;
48 bool agc_limiter_enabled = false;
49 bool hpf_enabled = false;
50 bool ns_enabled = false;
51 int ns_level = 0;
52 bool transient_suppression_enabled = false;
53 bool intelligibility_enhancer_enabled = false;
54 bool noise_robust_agc_enabled = false;
55 std::string experiments_description = "";
56 };
57
58 struct InternalAPMStreamsConfig {
59 int input_sample_rate = 0;
60 int output_sample_rate = 0;
61 int render_input_sample_rate = 0;
62 int render_output_sample_rate = 0;
63
64 size_t input_num_channels = 0;
65 size_t output_num_channels = 0;
66 size_t render_input_num_channels = 0;
67 size_t render_output_num_channels = 0;
68 };
69
70 class AecDump {
peah-webrtc 2017/04/25 21:04:46 You probably should have a comment describing the
aleloi 2017/04/26 09:16:48 Done.
71 public:
72 // A capture stream frame is logged before and after processing in
73 // the same protobuf message. To facilitate that, a CaptureStreamInfo
74 // instance is first filled with Input, then Output.
75 //
76 // To log an input/output pair, first call
77 // AecDump::GetCaptureStreamInfo. Add the input and output to
78 // it. Then call AecDump::WriteCaptureStreamMessage.
79 class CaptureStreamInfo {
80 public:
81 virtual ~CaptureStreamInfo() = default;
82 virtual void AddInput(
83 const rtc::ArrayView<rtc::ArrayView<const float>>& src) = 0;
84 virtual void AddOutput(
85 const rtc::ArrayView<rtc::ArrayView<const float>>& src) = 0;
86
87 virtual void AddInput(const AudioFrame& frame) = 0;
88 virtual void AddOutput(const AudioFrame& frame) = 0;
89
90 virtual void set_delay(int delay) = 0;
91 virtual void set_drift(int drift) = 0;
92 virtual void set_level(int level) = 0;
93 virtual void set_keypress(bool keypress) = 0;
94 };
95
96 virtual ~AecDump() = default;
97
98 virtual std::unique_ptr<CaptureStreamInfo> GetCaptureStreamInfo() const = 0;
99
100 // The Write* methods are always safe to call concurrently or
101 // otherwise for all implementing subclasses. The intended mode of
102 // operation is to create a protobuf object from the input, and send
103 // it away to be written to file asynchronously.
104 virtual void WriteInitMessage(
105 const InternalAPMStreamsConfig& streams_config) = 0;
106
107 virtual void WriteRenderStreamMessage(const AudioFrame& frame) = 0;
108
109 virtual void WriteRenderStreamMessage(
110 const rtc::ArrayView<rtc::ArrayView<const float>>& src) = 0;
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_INCLUDE_AEC_DUMP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698