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