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 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 int32_t RegisterVoiceEngineObserver(VoiceEngineObserver& observer); | 132 int32_t RegisterVoiceEngineObserver(VoiceEngineObserver& observer); |
133 | 133 |
134 virtual ~TransmitMixer(); | 134 virtual ~TransmitMixer(); |
135 | 135 |
136 // MonitorObserver | 136 // MonitorObserver |
137 void OnPeriodicProcess(); | 137 void OnPeriodicProcess(); |
138 | 138 |
139 | 139 |
140 // FileCallback | 140 // FileCallback |
141 void PlayNotification(int32_t id, | 141 void PlayNotification(const int32_t id, |
142 uint32_t durationMs); | 142 const uint32_t durationMs); |
143 | 143 |
144 void RecordNotification(int32_t id, | 144 void RecordNotification(const int32_t id, |
145 uint32_t durationMs); | 145 const uint32_t durationMs); |
146 | 146 |
147 void PlayFileEnded(int32_t id); | 147 void PlayFileEnded(const int32_t id); |
148 | 148 |
149 void RecordFileEnded(int32_t id); | 149 void RecordFileEnded(const int32_t id); |
150 | 150 |
151 #if WEBRTC_VOICE_ENGINE_TYPING_DETECTION | 151 #if WEBRTC_VOICE_ENGINE_TYPING_DETECTION |
152 // Typing detection | 152 // Typing detection |
153 int TimeSinceLastTyping(int &seconds); | 153 int TimeSinceLastTyping(int &seconds); |
154 int SetTypingDetectionParameters(int timeWindow, | 154 int SetTypingDetectionParameters(int timeWindow, |
155 int costPerTyping, | 155 int costPerTyping, |
156 int reportingThreshold, | 156 int reportingThreshold, |
157 int penaltyDecay, | 157 int penaltyDecay, |
158 int typeEventDelay); | 158 int typeEventDelay); |
159 #endif | 159 #endif |
160 | 160 |
161 void EnableStereoChannelSwapping(bool enable); | 161 // Virtual to allow mocking. |
| 162 virtual void EnableStereoChannelSwapping(bool enable); |
162 bool IsStereoChannelSwappingEnabled(); | 163 bool IsStereoChannelSwappingEnabled(); |
163 | 164 |
| 165 protected: |
| 166 TransmitMixer() = default; |
| 167 |
164 private: | 168 private: |
165 TransmitMixer(uint32_t instanceId); | 169 TransmitMixer(uint32_t instanceId); |
166 | 170 |
167 // Gets the maximum sample rate and number of channels over all currently | 171 // Gets the maximum sample rate and number of channels over all currently |
168 // sending codecs. | 172 // sending codecs. |
169 void GetSendCodecInfo(int* max_sample_rate, size_t* max_channels); | 173 void GetSendCodecInfo(int* max_sample_rate, size_t* max_channels); |
170 | 174 |
171 void GenerateAudioFrame(const int16_t audioSamples[], | 175 void GenerateAudioFrame(const int16_t audioSamples[], |
172 size_t nSamples, | 176 size_t nSamples, |
173 size_t nChannels, | 177 size_t nChannels, |
174 int samplesPerSec); | 178 int samplesPerSec); |
175 int32_t RecordAudioToFile(uint32_t mixingFrequency); | 179 int32_t RecordAudioToFile(uint32_t mixingFrequency); |
176 | 180 |
177 int32_t MixOrReplaceAudioWithFile( | 181 int32_t MixOrReplaceAudioWithFile( |
178 int mixingFrequency); | 182 int mixingFrequency); |
179 | 183 |
180 void ProcessAudio(int delay_ms, int clock_drift, int current_mic_level, | 184 void ProcessAudio(int delay_ms, int clock_drift, int current_mic_level, |
181 bool key_pressed); | 185 bool key_pressed); |
182 | 186 |
183 #if WEBRTC_VOICE_ENGINE_TYPING_DETECTION | 187 #if WEBRTC_VOICE_ENGINE_TYPING_DETECTION |
184 void TypingDetection(bool keyPressed); | 188 void TypingDetection(bool keyPressed); |
185 #endif | 189 #endif |
186 | 190 |
187 // uses | 191 // uses |
188 Statistics* _engineStatisticsPtr; | 192 Statistics* _engineStatisticsPtr = nullptr; |
189 ChannelManager* _channelManagerPtr; | 193 ChannelManager* _channelManagerPtr = nullptr; |
190 AudioProcessing* audioproc_; | 194 AudioProcessing* audioproc_ = nullptr; |
191 VoiceEngineObserver* _voiceEngineObserverPtr; | 195 VoiceEngineObserver* _voiceEngineObserverPtr = nullptr; |
192 ProcessThread* _processThreadPtr; | 196 ProcessThread* _processThreadPtr = nullptr; |
193 | 197 |
194 // owns | 198 // owns |
195 MonitorModule _monitorModule; | 199 MonitorModule _monitorModule; |
196 AudioFrame _audioFrame; | 200 AudioFrame _audioFrame; |
197 PushResampler<int16_t> resampler_; // ADM sample rate -> mixing rate | 201 PushResampler<int16_t> resampler_; // ADM sample rate -> mixing rate |
198 std::unique_ptr<FilePlayer> file_player_; | 202 std::unique_ptr<FilePlayer> file_player_; |
199 std::unique_ptr<FileRecorder> file_recorder_; | 203 std::unique_ptr<FileRecorder> file_recorder_; |
200 std::unique_ptr<FileRecorder> file_call_recorder_; | 204 std::unique_ptr<FileRecorder> file_call_recorder_; |
201 int _filePlayerId; | 205 int _filePlayerId = 0; |
202 int _fileRecorderId; | 206 int _fileRecorderId = 0; |
203 int _fileCallRecorderId; | 207 int _fileCallRecorderId = 0; |
204 bool _filePlaying; | 208 bool _filePlaying = false; |
205 bool _fileRecording; | 209 bool _fileRecording = false; |
206 bool _fileCallRecording; | 210 bool _fileCallRecording = false; |
207 voe::AudioLevel _audioLevel; | 211 voe::AudioLevel _audioLevel; |
208 // protect file instances and their variables in MixedParticipants() | 212 // protect file instances and their variables in MixedParticipants() |
209 rtc::CriticalSection _critSect; | 213 rtc::CriticalSection _critSect; |
210 rtc::CriticalSection _callbackCritSect; | 214 rtc::CriticalSection _callbackCritSect; |
211 | 215 |
212 #if WEBRTC_VOICE_ENGINE_TYPING_DETECTION | 216 #if WEBRTC_VOICE_ENGINE_TYPING_DETECTION |
213 webrtc::TypingDetection _typingDetection; | 217 webrtc::TypingDetection _typingDetection; |
214 bool _typingNoiseWarningPending; | 218 bool _typingNoiseWarningPending = false; |
215 bool _typingNoiseDetected; | 219 bool _typingNoiseDetected = false; |
216 #endif | 220 #endif |
217 bool _saturationWarning; | 221 bool _saturationWarning = false; |
218 | 222 |
219 int _instanceId; | 223 int _instanceId = 0; |
220 bool _mixFileWithMicrophone; | 224 bool _mixFileWithMicrophone = false; |
221 uint32_t _captureLevel; | 225 uint32_t _captureLevel = 0; |
222 bool _mute; | 226 bool _mute = false; |
223 bool stereo_codec_; | 227 bool stereo_codec_ = false; |
224 bool swap_stereo_channels_; | 228 bool swap_stereo_channels_ = false; |
225 }; | 229 }; |
226 | |
227 } // namespace voe | 230 } // namespace voe |
228 | |
229 } // namespace webrtc | 231 } // namespace webrtc |
230 | 232 |
231 #endif // WEBRTC_VOICE_ENGINE_TRANSMIT_MIXER_H | 233 #endif // WEBRTC_VOICE_ENGINE_TRANSMIT_MIXER_H |
OLD | NEW |