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

Side by Side Diff: webrtc/voice_engine/include/voe_audio_processing.h

Issue 2738543002: Remove VoEAudioProcessing interface. (Closed)
Patch Set: rebase Created 3 years, 9 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) 2012 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 // This sub-API supports the following functionalities:
12 //
13 // - Noise Suppression (NS).
14 // - Automatic Gain Control (AGC).
15 // - Echo Control (EC).
16 // - Receiving side VAD, NS and AGC.
17 // - Measurements of instantaneous speech, noise and echo levels.
18 // - Generation of AP debug recordings.
19 // - Detection of keyboard typing which can disrupt a voice conversation.
20 //
21 // Usage example, omitting error checking:
22 //
23 // using namespace webrtc;
24 // VoiceEngine* voe = VoiceEngine::Create();
25 // VoEBase* base = VoEBase::GetInterface();
26 // VoEAudioProcessing* ap = VoEAudioProcessing::GetInterface(voe);
27 // base->Init();
28 // ap->SetEcStatus(true, kAgcAdaptiveAnalog);
29 // ...
30 // base->Terminate();
31 // base->Release();
32 // ap->Release();
33 // VoiceEngine::Delete(voe);
34 //
35 #ifndef WEBRTC_VOICE_ENGINE_VOE_AUDIO_PROCESSING_H
36 #define WEBRTC_VOICE_ENGINE_VOE_AUDIO_PROCESSING_H
37
38 #include <stdio.h>
39
40 #include "webrtc/common_types.h"
41
42 namespace webrtc {
43
44 class VoiceEngine;
45
46 // VoEAudioProcessing
47 class WEBRTC_DLLEXPORT VoEAudioProcessing {
48 public:
49 // Factory for the VoEAudioProcessing sub-API. Increases an internal
50 // reference counter if successful. Returns NULL if the API is not
51 // supported or if construction fails.
52 static VoEAudioProcessing* GetInterface(VoiceEngine* voiceEngine);
53
54 // Releases the VoEAudioProcessing sub-API and decreases an internal
55 // reference counter. Returns the new reference count. This value should
56 // be zero for all sub-API:s before the VoiceEngine object can be safely
57 // deleted.
58 virtual int Release() = 0;
59
60 // Sets Noise Suppression (NS) status and mode.
61 // The NS reduces noise in the microphone signal.
62 virtual int SetNsStatus(bool enable, NsModes mode = kNsUnchanged) = 0;
63
64 // Gets the NS status and mode.
65 virtual int GetNsStatus(bool& enabled, NsModes& mode) = 0;
66
67 // Sets the Automatic Gain Control (AGC) status and mode.
68 // The AGC adjusts the microphone signal to an appropriate level.
69 virtual int SetAgcStatus(bool enable, AgcModes mode = kAgcUnchanged) = 0;
70
71 // Gets the AGC status and mode.
72 virtual int GetAgcStatus(bool& enabled, AgcModes& mode) = 0;
73
74 // Sets the AGC configuration.
75 // Should only be used in situations where the working environment
76 // is well known.
77 virtual int SetAgcConfig(AgcConfig config) = 0;
78
79 // Gets the AGC configuration.
80 virtual int GetAgcConfig(AgcConfig& config) = 0;
81
82 // Sets the Echo Control (EC) status and mode.
83 // The EC mitigates acoustic echo where a user can hear their own
84 // speech repeated back due to an acoustic coupling between the
85 // speaker and the microphone at the remote end.
86 virtual int SetEcStatus(bool enable, EcModes mode = kEcUnchanged) = 0;
87
88 // Gets the EC status and mode.
89 virtual int GetEcStatus(bool& enabled, EcModes& mode) = 0;
90
91 // Enables the compensation of clock drift between the capture and render
92 // streams by the echo canceller (i.e. only using EcMode==kEcAec). It will
93 // only be enabled if supported on the current platform; otherwise an error
94 // will be returned. Check if the platform is supported by calling
95 // |DriftCompensationSupported()|.
96 virtual int EnableDriftCompensation(bool enable) = 0;
97 virtual bool DriftCompensationEnabled() = 0;
98 static bool DriftCompensationSupported();
99
100 // Sets a delay |offset| in ms to add to the system delay reported by the
101 // OS, which is used by the AEC to synchronize far- and near-end streams.
102 // In some cases a system may introduce a delay which goes unreported by the
103 // OS, but which is known to the user. This method can be used to compensate
104 // for the unreported delay.
105 virtual void SetDelayOffsetMs(int offset) = 0;
106 virtual int DelayOffsetMs() = 0;
107
108 // Modifies settings for the AEC designed for mobile devices (AECM).
109 virtual int SetAecmMode(AecmModes mode = kAecmSpeakerphone,
110 bool enableCNG = true) = 0;
111
112 // Gets settings for the AECM.
113 virtual int GetAecmMode(AecmModes& mode, bool& enabledCNG) = 0;
114
115 // Enables a high pass filter on the capture signal. This removes DC bias
116 // and low-frequency noise. Recommended to be enabled.
117 virtual int EnableHighPassFilter(bool enable) = 0;
118 virtual bool IsHighPassFilterEnabled() = 0;
119
120 // Gets the VAD/DTX activity for the specified |channel|.
121 // The returned value is 1 if frames of audio contains speech
122 // and 0 if silence. The output is always 1 if VAD is disabled.
123 virtual int VoiceActivityIndicator(int channel) = 0;
124
125 // Enables or disables the possibility to retrieve echo metrics and delay
126 // logging values during an active call. The metrics are only supported in
127 // AEC.
128 virtual int SetEcMetricsStatus(bool enable) = 0;
129
130 // Gets the current EC metric status.
131 virtual int GetEcMetricsStatus(bool& enabled) = 0;
132
133 // Gets the instantaneous echo level metrics.
134 virtual int GetEchoMetrics(int& ERL, int& ERLE, int& RERL, int& A_NLP) = 0;
135
136 // Gets the EC internal |delay_median| and |delay_std| in ms between
137 // near-end and far-end. The metric |fraction_poor_delays| is the amount of
138 // delay values that potentially can break the EC. The values are aggregated
139 // over one second and the last updated metrics are returned.
140 virtual int GetEcDelayMetrics(int& delay_median,
141 int& delay_std,
142 float& fraction_poor_delays) = 0;
143
144 // Enables recording of Audio Processing (AP) debugging information.
145 // The file can later be used for off-line analysis of the AP performance.
146 virtual int StartDebugRecording(const char* fileNameUTF8) = 0;
147
148 // Same as above but sets and uses an existing file handle. Takes ownership
149 // of |file_handle| and passes it on to the audio processing module.
150 virtual int StartDebugRecording(FILE* file_handle) = 0;
151
152 // Disables recording of AP debugging information.
153 virtual int StopDebugRecording() = 0;
154
155 // Enables or disables detection of disturbing keyboard typing.
156 // An error notification will be given as a callback upon detection.
157 virtual int SetTypingDetectionStatus(bool enable) = 0;
158
159 // Gets the current typing detection status.
160 virtual int GetTypingDetectionStatus(bool& enabled) = 0;
161
162 // Reports the lower of:
163 // * Time in seconds since the last typing event.
164 // * Time in seconds since the typing detection was enabled.
165 // Returns error if typing detection is disabled.
166 virtual int TimeSinceLastTyping(int& seconds) = 0;
167
168 // Optional setting of typing detection parameters
169 // Parameter with value == 0 will be ignored
170 // and left with default config.
171 // TODO(niklase) Remove default argument as soon as libJingle is updated!
172 virtual int SetTypingDetectionParameters(int timeWindow,
173 int costPerTyping,
174 int reportingThreshold,
175 int penaltyDecay,
176 int typeEventDelay = 0) = 0;
177
178 // Swaps the capture-side left and right audio channels when enabled. It
179 // only has an effect when using a stereo send codec. The setting is
180 // persistent; it will be applied whenever a stereo send codec is enabled.
181 //
182 // The swap is applied only to the captured audio, and not mixed files. The
183 // swap will appear in file recordings and when accessing audio through the
184 // external media interface.
185 virtual void EnableStereoChannelSwapping(bool enable) = 0;
186 virtual bool IsStereoChannelSwappingEnabled() = 0;
187
188 protected:
189 VoEAudioProcessing() {}
190 virtual ~VoEAudioProcessing() {}
191 };
192
193 } // namespace webrtc
194
195 #endif // WEBRTC_VOICE_ENGINE_VOE_AUDIO_PROCESSING_H
OLDNEW
« no previous file with comments | « webrtc/voice_engine/channel.cc ('k') | webrtc/voice_engine/test/auto_test/extended/agc_config_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698