| 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 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 _moduleProcessThreadPtr(NULL), | 759 _moduleProcessThreadPtr(NULL), |
| 760 _audioDeviceModulePtr(NULL), | 760 _audioDeviceModulePtr(NULL), |
| 761 _voiceEngineObserverPtr(NULL), | 761 _voiceEngineObserverPtr(NULL), |
| 762 _callbackCritSectPtr(NULL), | 762 _callbackCritSectPtr(NULL), |
| 763 _transportPtr(NULL), | 763 _transportPtr(NULL), |
| 764 _rxVadObserverPtr(NULL), | 764 _rxVadObserverPtr(NULL), |
| 765 _oldVadDecision(-1), | 765 _oldVadDecision(-1), |
| 766 _sendFrameType(0), | 766 _sendFrameType(0), |
| 767 _externalMixing(false), | 767 _externalMixing(false), |
| 768 _mixFileWithMicrophone(false), | 768 _mixFileWithMicrophone(false), |
| 769 _mute(false), | 769 input_mute_(false), |
| 770 previous_frame_muted_(false), |
| 770 _panLeft(1.0f), | 771 _panLeft(1.0f), |
| 771 _panRight(1.0f), | 772 _panRight(1.0f), |
| 772 _outputGain(1.0f), | 773 _outputGain(1.0f), |
| 773 _lastLocalTimeStamp(0), | 774 _lastLocalTimeStamp(0), |
| 774 _lastPayloadType(0), | 775 _lastPayloadType(0), |
| 775 _includeAudioLevelIndication(false), | 776 _includeAudioLevelIndication(false), |
| 776 _outputSpeechType(AudioFrame::kNormalSpeech), | 777 _outputSpeechType(AudioFrame::kNormalSpeech), |
| 777 _average_jitter_buffer_delay_us(0), | 778 _average_jitter_buffer_delay_us(0), |
| 778 _previousTimestamp(0), | 779 _previousTimestamp(0), |
| 779 _recPacketDelayMs(20), | 780 _recPacketDelayMs(20), |
| (...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2131 level = static_cast<int32_t>(currentLevel); | 2132 level = static_cast<int32_t>(currentLevel); |
| 2132 return 0; | 2133 return 0; |
| 2133 } | 2134 } |
| 2134 | 2135 |
| 2135 int Channel::GetSpeechOutputLevelFullRange(uint32_t& level) const { | 2136 int Channel::GetSpeechOutputLevelFullRange(uint32_t& level) const { |
| 2136 int16_t currentLevel = _outputAudioLevel.LevelFullRange(); | 2137 int16_t currentLevel = _outputAudioLevel.LevelFullRange(); |
| 2137 level = static_cast<int32_t>(currentLevel); | 2138 level = static_cast<int32_t>(currentLevel); |
| 2138 return 0; | 2139 return 0; |
| 2139 } | 2140 } |
| 2140 | 2141 |
| 2141 int Channel::SetMute(bool enable) { | 2142 int Channel::SetInputMute(bool enable) { |
| 2142 rtc::CritScope cs(&volume_settings_critsect_); | 2143 rtc::CritScope cs(&volume_settings_critsect_); |
| 2143 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), | 2144 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), |
| 2144 "Channel::SetMute(enable=%d)", enable); | 2145 "Channel::SetMute(enable=%d)", enable); |
| 2145 _mute = enable; | 2146 input_mute_ = enable; |
| 2146 return 0; | 2147 return 0; |
| 2147 } | 2148 } |
| 2148 | 2149 |
| 2149 bool Channel::Mute() const { | 2150 bool Channel::InputMute() const { |
| 2150 rtc::CritScope cs(&volume_settings_critsect_); | 2151 rtc::CritScope cs(&volume_settings_critsect_); |
| 2151 return _mute; | 2152 return input_mute_; |
| 2152 } | 2153 } |
| 2153 | 2154 |
| 2154 int Channel::SetOutputVolumePan(float left, float right) { | 2155 int Channel::SetOutputVolumePan(float left, float right) { |
| 2155 rtc::CritScope cs(&volume_settings_critsect_); | 2156 rtc::CritScope cs(&volume_settings_critsect_); |
| 2156 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), | 2157 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), |
| 2157 "Channel::SetOutputVolumePan()"); | 2158 "Channel::SetOutputVolumePan()"); |
| 2158 _panLeft = left; | 2159 _panLeft = left; |
| 2159 _panRight = right; | 2160 _panRight = right; |
| 2160 return 0; | 2161 return 0; |
| 2161 } | 2162 } |
| (...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2946 if (_audioFrame.samples_per_channel_ == 0) { | 2947 if (_audioFrame.samples_per_channel_ == 0) { |
| 2947 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), | 2948 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), |
| 2948 "Channel::PrepareEncodeAndSend() invalid audio frame"); | 2949 "Channel::PrepareEncodeAndSend() invalid audio frame"); |
| 2949 return 0xFFFFFFFF; | 2950 return 0xFFFFFFFF; |
| 2950 } | 2951 } |
| 2951 | 2952 |
| 2952 if (channel_state_.Get().input_file_playing) { | 2953 if (channel_state_.Get().input_file_playing) { |
| 2953 MixOrReplaceAudioWithFile(mixingFrequency); | 2954 MixOrReplaceAudioWithFile(mixingFrequency); |
| 2954 } | 2955 } |
| 2955 | 2956 |
| 2956 bool is_muted = Mute(); // Cache locally as Mute() takes a lock. | 2957 bool is_muted = InputMute(); // Cache locally as InputMute() takes a lock. |
| 2957 if (is_muted) { | 2958 AudioFrameOperations::Mute(&_audioFrame, previous_frame_muted_, is_muted); |
| 2958 AudioFrameOperations::Mute(_audioFrame); | |
| 2959 } | |
| 2960 | 2959 |
| 2961 if (channel_state_.Get().input_external_media) { | 2960 if (channel_state_.Get().input_external_media) { |
| 2962 rtc::CritScope cs(&_callbackCritSect); | 2961 rtc::CritScope cs(&_callbackCritSect); |
| 2963 const bool isStereo = (_audioFrame.num_channels_ == 2); | 2962 const bool isStereo = (_audioFrame.num_channels_ == 2); |
| 2964 if (_inputExternalMediaCallbackPtr) { | 2963 if (_inputExternalMediaCallbackPtr) { |
| 2965 _inputExternalMediaCallbackPtr->Process( | 2964 _inputExternalMediaCallbackPtr->Process( |
| 2966 _channelId, kRecordingPerChannel, (int16_t*)_audioFrame.data_, | 2965 _channelId, kRecordingPerChannel, (int16_t*)_audioFrame.data_, |
| 2967 _audioFrame.samples_per_channel_, _audioFrame.sample_rate_hz_, | 2966 _audioFrame.samples_per_channel_, _audioFrame.sample_rate_hz_, |
| 2968 isStereo); | 2967 isStereo); |
| 2969 } | 2968 } |
| 2970 } | 2969 } |
| 2971 | 2970 |
| 2972 if (_includeAudioLevelIndication) { | 2971 if (_includeAudioLevelIndication) { |
| 2973 size_t length = | 2972 size_t length = |
| 2974 _audioFrame.samples_per_channel_ * _audioFrame.num_channels_; | 2973 _audioFrame.samples_per_channel_ * _audioFrame.num_channels_; |
| 2975 if (is_muted) { | 2974 if (is_muted && previous_frame_muted_) { |
| 2976 rms_level_.ProcessMuted(length); | 2975 rms_level_.ProcessMuted(length); |
| 2977 } else { | 2976 } else { |
| 2978 rms_level_.Process(_audioFrame.data_, length); | 2977 rms_level_.Process(_audioFrame.data_, length); |
| 2979 } | 2978 } |
| 2980 } | 2979 } |
| 2980 previous_frame_muted_ = is_muted; |
| 2981 | 2981 |
| 2982 return 0; | 2982 return 0; |
| 2983 } | 2983 } |
| 2984 | 2984 |
| 2985 uint32_t Channel::EncodeAndSend() { | 2985 uint32_t Channel::EncodeAndSend() { |
| 2986 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, _channelId), | 2986 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, _channelId), |
| 2987 "Channel::EncodeAndSend()"); | 2987 "Channel::EncodeAndSend()"); |
| 2988 | 2988 |
| 2989 assert(_audioFrame.num_channels_ <= 2); | 2989 assert(_audioFrame.num_channels_ <= 2); |
| 2990 if (_audioFrame.samples_per_channel_ == 0) { | 2990 if (_audioFrame.samples_per_channel_ == 0) { |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3529 int64_t min_rtt = 0; | 3529 int64_t min_rtt = 0; |
| 3530 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != | 3530 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != |
| 3531 0) { | 3531 0) { |
| 3532 return 0; | 3532 return 0; |
| 3533 } | 3533 } |
| 3534 return rtt; | 3534 return rtt; |
| 3535 } | 3535 } |
| 3536 | 3536 |
| 3537 } // namespace voe | 3537 } // namespace voe |
| 3538 } // namespace webrtc | 3538 } // namespace webrtc |
| OLD | NEW |