OLD | NEW |
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/modules/utility/include/file_player.h" | 21 #include "webrtc/modules/utility/include/file_player.h" |
22 #include "webrtc/modules/utility/include/file_recorder.h" | 22 #include "webrtc/modules/utility/include/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) |
| 29 #define WEBRTC_VOICE_ENGINE_TYPING_DETECTION 1 |
| 30 #else |
| 31 #define WEBRTC_VOICE_ENGINE_TYPING_DETECTION 0 |
| 32 #endif |
| 33 |
28 namespace webrtc { | 34 namespace webrtc { |
29 | 35 |
30 class AudioProcessing; | 36 class AudioProcessing; |
31 class ProcessThread; | 37 class ProcessThread; |
32 class VoEExternalMedia; | 38 class VoEExternalMedia; |
33 class VoEMediaProcess; | 39 class VoEMediaProcess; |
34 | 40 |
35 namespace voe { | 41 namespace voe { |
36 | 42 |
37 class ChannelManager; | 43 class ChannelManager; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 void PlayNotification(int32_t id, | 150 void PlayNotification(int32_t id, |
145 uint32_t durationMs); | 151 uint32_t durationMs); |
146 | 152 |
147 void RecordNotification(int32_t id, | 153 void RecordNotification(int32_t id, |
148 uint32_t durationMs); | 154 uint32_t durationMs); |
149 | 155 |
150 void PlayFileEnded(int32_t id); | 156 void PlayFileEnded(int32_t id); |
151 | 157 |
152 void RecordFileEnded(int32_t id); | 158 void RecordFileEnded(int32_t id); |
153 | 159 |
154 #ifdef WEBRTC_VOICE_ENGINE_TYPING_DETECTION | 160 #if WEBRTC_VOICE_ENGINE_TYPING_DETECTION |
155 // Typing detection | 161 // Typing detection |
156 int TimeSinceLastTyping(int &seconds); | 162 int TimeSinceLastTyping(int &seconds); |
157 int SetTypingDetectionParameters(int timeWindow, | 163 int SetTypingDetectionParameters(int timeWindow, |
158 int costPerTyping, | 164 int costPerTyping, |
159 int reportingThreshold, | 165 int reportingThreshold, |
160 int penaltyDecay, | 166 int penaltyDecay, |
161 int typeEventDelay); | 167 int typeEventDelay); |
162 #endif | 168 #endif |
163 | 169 |
164 void EnableStereoChannelSwapping(bool enable); | 170 void EnableStereoChannelSwapping(bool enable); |
(...skipping 11 matching lines...) Expand all Loading... |
176 size_t nChannels, | 182 size_t nChannels, |
177 int samplesPerSec); | 183 int samplesPerSec); |
178 int32_t RecordAudioToFile(uint32_t mixingFrequency); | 184 int32_t RecordAudioToFile(uint32_t mixingFrequency); |
179 | 185 |
180 int32_t MixOrReplaceAudioWithFile( | 186 int32_t MixOrReplaceAudioWithFile( |
181 int mixingFrequency); | 187 int mixingFrequency); |
182 | 188 |
183 void ProcessAudio(int delay_ms, int clock_drift, int current_mic_level, | 189 void ProcessAudio(int delay_ms, int clock_drift, int current_mic_level, |
184 bool key_pressed); | 190 bool key_pressed); |
185 | 191 |
186 #ifdef WEBRTC_VOICE_ENGINE_TYPING_DETECTION | 192 #if WEBRTC_VOICE_ENGINE_TYPING_DETECTION |
187 void TypingDetection(bool keyPressed); | 193 void TypingDetection(bool keyPressed); |
188 #endif | 194 #endif |
189 | 195 |
190 // uses | 196 // uses |
191 Statistics* _engineStatisticsPtr; | 197 Statistics* _engineStatisticsPtr; |
192 ChannelManager* _channelManagerPtr; | 198 ChannelManager* _channelManagerPtr; |
193 AudioProcessing* audioproc_; | 199 AudioProcessing* audioproc_; |
194 VoiceEngineObserver* _voiceEngineObserverPtr; | 200 VoiceEngineObserver* _voiceEngineObserverPtr; |
195 ProcessThread* _processThreadPtr; | 201 ProcessThread* _processThreadPtr; |
196 | 202 |
197 // owns | 203 // owns |
198 MonitorModule _monitorModule; | 204 MonitorModule _monitorModule; |
199 AudioFrame _audioFrame; | 205 AudioFrame _audioFrame; |
200 PushResampler<int16_t> resampler_; // ADM sample rate -> mixing rate | 206 PushResampler<int16_t> resampler_; // ADM sample rate -> mixing rate |
201 std::unique_ptr<FilePlayer> file_player_; | 207 std::unique_ptr<FilePlayer> file_player_; |
202 std::unique_ptr<FileRecorder> file_recorder_; | 208 std::unique_ptr<FileRecorder> file_recorder_; |
203 std::unique_ptr<FileRecorder> file_call_recorder_; | 209 std::unique_ptr<FileRecorder> file_call_recorder_; |
204 int _filePlayerId; | 210 int _filePlayerId; |
205 int _fileRecorderId; | 211 int _fileRecorderId; |
206 int _fileCallRecorderId; | 212 int _fileCallRecorderId; |
207 bool _filePlaying; | 213 bool _filePlaying; |
208 bool _fileRecording; | 214 bool _fileRecording; |
209 bool _fileCallRecording; | 215 bool _fileCallRecording; |
210 voe::AudioLevel _audioLevel; | 216 voe::AudioLevel _audioLevel; |
211 // protect file instances and their variables in MixedParticipants() | 217 // protect file instances and their variables in MixedParticipants() |
212 rtc::CriticalSection _critSect; | 218 rtc::CriticalSection _critSect; |
213 rtc::CriticalSection _callbackCritSect; | 219 rtc::CriticalSection _callbackCritSect; |
214 | 220 |
215 #ifdef WEBRTC_VOICE_ENGINE_TYPING_DETECTION | 221 #if WEBRTC_VOICE_ENGINE_TYPING_DETECTION |
216 webrtc::TypingDetection _typingDetection; | 222 webrtc::TypingDetection _typingDetection; |
217 bool _typingNoiseWarningPending; | 223 bool _typingNoiseWarningPending; |
218 bool _typingNoiseDetected; | 224 bool _typingNoiseDetected; |
219 #endif | 225 #endif |
220 bool _saturationWarning; | 226 bool _saturationWarning; |
221 | 227 |
222 int _instanceId; | 228 int _instanceId; |
223 bool _mixFileWithMicrophone; | 229 bool _mixFileWithMicrophone; |
224 uint32_t _captureLevel; | 230 uint32_t _captureLevel; |
225 VoEMediaProcess* external_postproc_ptr_; | 231 VoEMediaProcess* external_postproc_ptr_; |
226 VoEMediaProcess* external_preproc_ptr_; | 232 VoEMediaProcess* external_preproc_ptr_; |
227 bool _mute; | 233 bool _mute; |
228 bool stereo_codec_; | 234 bool stereo_codec_; |
229 bool swap_stereo_channels_; | 235 bool swap_stereo_channels_; |
230 }; | 236 }; |
231 | 237 |
232 } // namespace voe | 238 } // namespace voe |
233 | 239 |
234 } // namespace webrtc | 240 } // namespace webrtc |
235 | 241 |
236 #endif // WEBRTC_VOICE_ENGINE_TRANSMIT_MIXER_H | 242 #endif // WEBRTC_VOICE_ENGINE_TRANSMIT_MIXER_H |
OLD | NEW |