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