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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 _typingNoiseWarningPending(false), | 198 _typingNoiseWarningPending(false), |
199 _typingNoiseDetected(false), | 199 _typingNoiseDetected(false), |
200 #endif | 200 #endif |
201 _saturationWarning(false), | 201 _saturationWarning(false), |
202 _instanceId(instanceId), | 202 _instanceId(instanceId), |
203 _mixFileWithMicrophone(false), | 203 _mixFileWithMicrophone(false), |
204 _captureLevel(0), | 204 _captureLevel(0), |
205 external_postproc_ptr_(NULL), | 205 external_postproc_ptr_(NULL), |
206 external_preproc_ptr_(NULL), | 206 external_preproc_ptr_(NULL), |
207 _mute(false), | 207 _mute(false), |
208 _remainingMuteMicTimeMs(0), | |
209 stereo_codec_(false), | 208 stereo_codec_(false), |
210 swap_stereo_channels_(false) | 209 swap_stereo_channels_(false) |
211 { | 210 { |
212 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId, -1), | 211 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId, -1), |
213 "TransmitMixer::TransmitMixer() - ctor"); | 212 "TransmitMixer::TransmitMixer() - ctor"); |
214 } | 213 } |
215 | 214 |
216 TransmitMixer::~TransmitMixer() | 215 TransmitMixer::~TransmitMixer() |
217 { | 216 { |
218 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId, -1), | 217 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId, -1), |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 | 351 |
353 if (swap_stereo_channels_ && stereo_codec_) | 352 if (swap_stereo_channels_ && stereo_codec_) |
354 // Only bother swapping if we're using a stereo codec. | 353 // Only bother swapping if we're using a stereo codec. |
355 AudioFrameOperations::SwapStereoChannels(&_audioFrame); | 354 AudioFrameOperations::SwapStereoChannels(&_audioFrame); |
356 | 355 |
357 // --- Annoying typing detection (utilizes the APM/VAD decision) | 356 // --- Annoying typing detection (utilizes the APM/VAD decision) |
358 #ifdef WEBRTC_VOICE_ENGINE_TYPING_DETECTION | 357 #ifdef WEBRTC_VOICE_ENGINE_TYPING_DETECTION |
359 TypingDetection(keyPressed); | 358 TypingDetection(keyPressed); |
360 #endif | 359 #endif |
361 | 360 |
362 // --- Mute during DTMF tone if direct feedback is enabled | |
363 if (_remainingMuteMicTimeMs > 0) | |
364 { | |
365 AudioFrameOperations::Mute(_audioFrame); | |
366 _remainingMuteMicTimeMs -= 10; | |
367 if (_remainingMuteMicTimeMs < 0) | |
368 { | |
369 _remainingMuteMicTimeMs = 0; | |
370 } | |
371 } | |
372 | |
373 // --- Mute signal | 361 // --- Mute signal |
374 if (_mute) | 362 if (_mute) |
375 { | 363 { |
376 AudioFrameOperations::Mute(_audioFrame); | 364 AudioFrameOperations::Mute(_audioFrame); |
377 } | 365 } |
378 | 366 |
379 // --- Mix with file (does not affect the mixing frequency) | 367 // --- Mix with file (does not affect the mixing frequency) |
380 if (_filePlaying) | 368 if (_filePlaying) |
381 { | 369 { |
382 MixOrReplaceAudioWithFile(_audioFrame.sample_rate_hz_); | 370 MixOrReplaceAudioWithFile(_audioFrame.sample_rate_hz_); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 if (channel_ptr && channel_ptr->Sending()) | 458 if (channel_ptr && channel_ptr->Sending()) |
471 channel_ptr->EncodeAndSend(); | 459 channel_ptr->EncodeAndSend(); |
472 } | 460 } |
473 } | 461 } |
474 | 462 |
475 uint32_t TransmitMixer::CaptureLevel() const | 463 uint32_t TransmitMixer::CaptureLevel() const |
476 { | 464 { |
477 return _captureLevel; | 465 return _captureLevel; |
478 } | 466 } |
479 | 467 |
480 void | |
481 TransmitMixer::UpdateMuteMicrophoneTime(uint32_t lengthMs) | |
482 { | |
483 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, -1), | |
484 "TransmitMixer::UpdateMuteMicrophoneTime(lengthMs=%d)", | |
485 lengthMs); | |
486 _remainingMuteMicTimeMs = lengthMs; | |
487 } | |
488 | |
489 int32_t | 468 int32_t |
490 TransmitMixer::StopSend() | 469 TransmitMixer::StopSend() |
491 { | 470 { |
492 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, -1), | 471 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, -1), |
493 "TransmitMixer::StopSend()"); | 472 "TransmitMixer::StopSend()"); |
494 _audioLevel.Clear(); | 473 _audioLevel.Clear(); |
495 return 0; | 474 return 0; |
496 } | 475 } |
497 | 476 |
498 int TransmitMixer::StartPlayingFileAsMicrophone(const char* fileName, | 477 int TransmitMixer::StartPlayingFileAsMicrophone(const char* fileName, |
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1330 void TransmitMixer::EnableStereoChannelSwapping(bool enable) { | 1309 void TransmitMixer::EnableStereoChannelSwapping(bool enable) { |
1331 swap_stereo_channels_ = enable; | 1310 swap_stereo_channels_ = enable; |
1332 } | 1311 } |
1333 | 1312 |
1334 bool TransmitMixer::IsStereoChannelSwappingEnabled() { | 1313 bool TransmitMixer::IsStereoChannelSwappingEnabled() { |
1335 return swap_stereo_channels_; | 1314 return swap_stereo_channels_; |
1336 } | 1315 } |
1337 | 1316 |
1338 } // namespace voe | 1317 } // namespace voe |
1339 } // namespace webrtc | 1318 } // namespace webrtc |
OLD | NEW |