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

Side by Side Diff: webrtc/voice_engine/transmit_mixer.h

Issue 2720253002: Remove saturation warning support from TransmitMixer. (Closed)
Patch Set: 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
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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
11 #ifndef WEBRTC_VOICE_ENGINE_TRANSMIT_MIXER_H 11 #ifndef WEBRTC_VOICE_ENGINE_TRANSMIT_MIXER_H
12 #define WEBRTC_VOICE_ENGINE_TRANSMIT_MIXER_H 12 #define WEBRTC_VOICE_ENGINE_TRANSMIT_MIXER_H
13 13
14 #include <memory> 14 #include <memory>
15 15
16 #include "webrtc/base/criticalsection.h" 16 #include "webrtc/base/criticalsection.h"
17 #include "webrtc/common_audio/resampler/include/push_resampler.h" 17 #include "webrtc/common_audio/resampler/include/push_resampler.h"
18 #include "webrtc/common_types.h" 18 #include "webrtc/common_types.h"
19 #include "webrtc/modules/audio_processing/typing_detection.h" 19 #include "webrtc/modules/audio_processing/typing_detection.h"
20 #include "webrtc/modules/include/module_common_types.h" 20 #include "webrtc/modules/include/module_common_types.h"
21 #include "webrtc/voice_engine/file_player.h" 21 #include "webrtc/voice_engine/file_player.h"
22 #include "webrtc/voice_engine/file_recorder.h" 22 #include "webrtc/voice_engine/file_recorder.h"
23 #include "webrtc/voice_engine/include/voe_base.h" 23 #include "webrtc/voice_engine/include/voe_base.h"
24 #include "webrtc/voice_engine/level_indicator.h" 24 #include "webrtc/voice_engine/level_indicator.h"
25 #include "webrtc/voice_engine/monitor_module.h" 25 #include "webrtc/voice_engine/monitor_module.h"
26 #include "webrtc/voice_engine/voice_engine_defines.h" 26 #include "webrtc/voice_engine/voice_engine_defines.h"
27 27
28 #if !defined(WEBRTC_ANDROID) && !defined(WEBRTC_IOS) 28 #if !defined(WEBRTC_ANDROID) && !defined(WEBRTC_IOS)
29 // Should this be turned on in Chromium as well?
hlundin-webrtc 2017/02/28 12:56:47 I believe it is.
29 #define WEBRTC_VOICE_ENGINE_TYPING_DETECTION 1 30 #define WEBRTC_VOICE_ENGINE_TYPING_DETECTION 1
30 #else 31 #else
31 #define WEBRTC_VOICE_ENGINE_TYPING_DETECTION 0 32 #define WEBRTC_VOICE_ENGINE_TYPING_DETECTION 0
32 #endif 33 #endif
33 34
34 namespace webrtc { 35 namespace webrtc {
35 36
36 class AudioProcessing; 37 class AudioProcessing;
37 class ProcessThread; 38 class ProcessThread;
38 39
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 int StartRecordingCall(OutStream* stream, const CodecInst* codecInst); 126 int StartRecordingCall(OutStream* stream, const CodecInst* codecInst);
126 127
127 int StopRecordingCall(); 128 int StopRecordingCall();
128 129
129 void SetMixWithMicStatus(bool mix); 130 void SetMixWithMicStatus(bool mix);
130 131
131 int32_t RegisterVoiceEngineObserver(VoiceEngineObserver& observer); 132 int32_t RegisterVoiceEngineObserver(VoiceEngineObserver& observer);
132 133
133 virtual ~TransmitMixer(); 134 virtual ~TransmitMixer();
134 135
136 #if WEBRTC_VOICE_ENGINE_TYPING_DETECTION
135 // Periodic callback from the MonitorModule. 137 // Periodic callback from the MonitorModule.
136 void OnPeriodicProcess(); 138 void OnPeriodicProcess();
139 #endif
137 140
138 // FileCallback 141 // FileCallback
139 void PlayNotification(const int32_t id, 142 void PlayNotification(const int32_t id,
140 const uint32_t durationMs); 143 const uint32_t durationMs);
141 144
142 void RecordNotification(const int32_t id, 145 void RecordNotification(const int32_t id,
143 const uint32_t durationMs); 146 const uint32_t durationMs);
144 147
145 void PlayFileEnded(const int32_t id); 148 void PlayFileEnded(const int32_t id);
146 149
147 void RecordFileEnded(const int32_t id); 150 void RecordFileEnded(const int32_t id);
148 151
149 #if WEBRTC_VOICE_ENGINE_TYPING_DETECTION 152 #if WEBRTC_VOICE_ENGINE_TYPING_DETECTION
150 // Typing detection 153 // Typing detection
151 int TimeSinceLastTyping(int &seconds); 154 int TimeSinceLastTyping(int &seconds);
152 int SetTypingDetectionParameters(int timeWindow, 155 int SetTypingDetectionParameters(int timeWindow,
153 int costPerTyping, 156 int costPerTyping,
154 int reportingThreshold, 157 int reportingThreshold,
155 int penaltyDecay, 158 int penaltyDecay,
156 int typeEventDelay); 159 int typeEventDelay);
157 #endif 160 #endif
158 161
159 // Virtual to allow mocking. 162 // Virtual to allow mocking.
160 virtual void EnableStereoChannelSwapping(bool enable); 163 virtual void EnableStereoChannelSwapping(bool enable);
161 bool IsStereoChannelSwappingEnabled(); 164 bool IsStereoChannelSwappingEnabled();
162 165
163 protected: 166 protected:
167 #if WEBRTC_VOICE_ENGINE_TYPING_DETECTION
164 TransmitMixer() : _monitorModule(this) {} 168 TransmitMixer() : _monitorModule(this) {}
169 #else
170 TransmitMixer() = default;
171 #endif
165 172
166 private: 173 private:
167 TransmitMixer(uint32_t instanceId); 174 TransmitMixer(uint32_t instanceId);
168 175
169 // Gets the maximum sample rate and number of channels over all currently 176 // Gets the maximum sample rate and number of channels over all currently
170 // sending codecs. 177 // sending codecs.
171 void GetSendCodecInfo(int* max_sample_rate, size_t* max_channels); 178 void GetSendCodecInfo(int* max_sample_rate, size_t* max_channels);
172 179
173 void GenerateAudioFrame(const int16_t audioSamples[], 180 void GenerateAudioFrame(const int16_t audioSamples[],
174 size_t nSamples, 181 size_t nSamples,
(...skipping 12 matching lines...) Expand all
187 #endif 194 #endif
188 195
189 // uses 196 // uses
190 Statistics* _engineStatisticsPtr = nullptr; 197 Statistics* _engineStatisticsPtr = nullptr;
191 ChannelManager* _channelManagerPtr = nullptr; 198 ChannelManager* _channelManagerPtr = nullptr;
192 AudioProcessing* audioproc_ = nullptr; 199 AudioProcessing* audioproc_ = nullptr;
193 VoiceEngineObserver* _voiceEngineObserverPtr = nullptr; 200 VoiceEngineObserver* _voiceEngineObserverPtr = nullptr;
194 ProcessThread* _processThreadPtr = nullptr; 201 ProcessThread* _processThreadPtr = nullptr;
195 202
196 // owns 203 // owns
197 MonitorModule<TransmitMixer> _monitorModule;
198 AudioFrame _audioFrame; 204 AudioFrame _audioFrame;
199 PushResampler<int16_t> resampler_; // ADM sample rate -> mixing rate 205 PushResampler<int16_t> resampler_; // ADM sample rate -> mixing rate
200 std::unique_ptr<FilePlayer> file_player_; 206 std::unique_ptr<FilePlayer> file_player_;
201 std::unique_ptr<FileRecorder> file_recorder_; 207 std::unique_ptr<FileRecorder> file_recorder_;
202 std::unique_ptr<FileRecorder> file_call_recorder_; 208 std::unique_ptr<FileRecorder> file_call_recorder_;
203 int _filePlayerId = 0; 209 int _filePlayerId = 0;
204 int _fileRecorderId = 0; 210 int _fileRecorderId = 0;
205 int _fileCallRecorderId = 0; 211 int _fileCallRecorderId = 0;
206 bool _filePlaying = false; 212 bool _filePlaying = false;
207 bool _fileRecording = false; 213 bool _fileRecording = false;
208 bool _fileCallRecording = false; 214 bool _fileCallRecording = false;
209 voe::AudioLevel _audioLevel; 215 voe::AudioLevel _audioLevel;
210 // protect file instances and their variables in MixedParticipants() 216 // protect file instances and their variables in MixedParticipants()
211 rtc::CriticalSection _critSect; 217 rtc::CriticalSection _critSect;
212 rtc::CriticalSection _callbackCritSect; 218 rtc::CriticalSection _callbackCritSect;
213 219
214 #if WEBRTC_VOICE_ENGINE_TYPING_DETECTION 220 #if WEBRTC_VOICE_ENGINE_TYPING_DETECTION
221 MonitorModule<TransmitMixer> _monitorModule;
215 webrtc::TypingDetection _typingDetection; 222 webrtc::TypingDetection _typingDetection;
216 bool _typingNoiseWarningPending = false; 223 bool _typingNoiseWarningPending = false;
217 bool _typingNoiseDetected = false; 224 bool _typingNoiseDetected = false;
218 #endif 225 #endif
219 bool _saturationWarning = false;
220 226
221 int _instanceId = 0; 227 int _instanceId = 0;
222 bool _mixFileWithMicrophone = false; 228 bool _mixFileWithMicrophone = false;
223 uint32_t _captureLevel = 0; 229 uint32_t _captureLevel = 0;
224 bool _mute = false; 230 bool _mute = false;
225 bool stereo_codec_ = false; 231 bool stereo_codec_ = false;
226 bool swap_stereo_channels_ = false; 232 bool swap_stereo_channels_ = false;
227 }; 233 };
228 } // namespace voe 234 } // namespace voe
229 } // namespace webrtc 235 } // namespace webrtc
230 236
231 #endif // WEBRTC_VOICE_ENGINE_TRANSMIT_MIXER_H 237 #endif // WEBRTC_VOICE_ENGINE_TRANSMIT_MIXER_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698