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