| 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 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 ntp_estimator_(Clock::GetRealTimeClock()), | 766 ntp_estimator_(Clock::GetRealTimeClock()), |
| 767 playout_timestamp_rtp_(0), | 767 playout_timestamp_rtp_(0), |
| 768 playout_delay_ms_(0), | 768 playout_delay_ms_(0), |
| 769 send_sequence_number_(0), | 769 send_sequence_number_(0), |
| 770 rtp_ts_wraparound_handler_(new rtc::TimestampWrapAroundHandler()), | 770 rtp_ts_wraparound_handler_(new rtc::TimestampWrapAroundHandler()), |
| 771 capture_start_rtp_time_stamp_(-1), | 771 capture_start_rtp_time_stamp_(-1), |
| 772 capture_start_ntp_time_ms_(-1), | 772 capture_start_ntp_time_ms_(-1), |
| 773 _engineStatisticsPtr(NULL), | 773 _engineStatisticsPtr(NULL), |
| 774 _moduleProcessThreadPtr(NULL), | 774 _moduleProcessThreadPtr(NULL), |
| 775 _audioDeviceModulePtr(NULL), | 775 _audioDeviceModulePtr(NULL), |
| 776 _voiceEngineObserverPtr(NULL), | |
| 777 _callbackCritSectPtr(NULL), | 776 _callbackCritSectPtr(NULL), |
| 778 _transportPtr(NULL), | 777 _transportPtr(NULL), |
| 779 input_mute_(false), | 778 input_mute_(false), |
| 780 previous_frame_muted_(false), | 779 previous_frame_muted_(false), |
| 781 _outputGain(1.0f), | 780 _outputGain(1.0f), |
| 782 _includeAudioLevelIndication(false), | 781 _includeAudioLevelIndication(false), |
| 783 transport_overhead_per_packet_(0), | 782 transport_overhead_per_packet_(0), |
| 784 rtp_overhead_per_packet_(0), | 783 rtp_overhead_per_packet_(0), |
| 785 _outputSpeechType(AudioFrame::kNormalSpeech), | 784 _outputSpeechType(AudioFrame::kNormalSpeech), |
| 786 rtcp_observer_(new VoERtcpObserver(this)), | 785 rtcp_observer_(new VoERtcpObserver(this)), |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 // De-register modules in process thread | 941 // De-register modules in process thread |
| 943 if (_moduleProcessThreadPtr) | 942 if (_moduleProcessThreadPtr) |
| 944 _moduleProcessThreadPtr->DeRegisterModule(_rtpRtcpModule.get()); | 943 _moduleProcessThreadPtr->DeRegisterModule(_rtpRtcpModule.get()); |
| 945 | 944 |
| 946 // End of modules shutdown | 945 // End of modules shutdown |
| 947 } | 946 } |
| 948 | 947 |
| 949 int32_t Channel::SetEngineInformation(Statistics& engineStatistics, | 948 int32_t Channel::SetEngineInformation(Statistics& engineStatistics, |
| 950 ProcessThread& moduleProcessThread, | 949 ProcessThread& moduleProcessThread, |
| 951 AudioDeviceModule& audioDeviceModule, | 950 AudioDeviceModule& audioDeviceModule, |
| 952 VoiceEngineObserver* voiceEngineObserver, | |
| 953 rtc::CriticalSection* callbackCritSect, | 951 rtc::CriticalSection* callbackCritSect, |
| 954 rtc::TaskQueue* encoder_queue) { | 952 rtc::TaskQueue* encoder_queue) { |
| 955 RTC_DCHECK(encoder_queue); | 953 RTC_DCHECK(encoder_queue); |
| 956 RTC_DCHECK(!encoder_queue_); | 954 RTC_DCHECK(!encoder_queue_); |
| 957 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), | 955 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), |
| 958 "Channel::SetEngineInformation()"); | 956 "Channel::SetEngineInformation()"); |
| 959 _engineStatisticsPtr = &engineStatistics; | 957 _engineStatisticsPtr = &engineStatistics; |
| 960 _moduleProcessThreadPtr = &moduleProcessThread; | 958 _moduleProcessThreadPtr = &moduleProcessThread; |
| 961 _audioDeviceModulePtr = &audioDeviceModule; | 959 _audioDeviceModulePtr = &audioDeviceModule; |
| 962 _voiceEngineObserverPtr = voiceEngineObserver; | |
| 963 _callbackCritSectPtr = callbackCritSect; | 960 _callbackCritSectPtr = callbackCritSect; |
| 964 encoder_queue_ = encoder_queue; | 961 encoder_queue_ = encoder_queue; |
| 965 return 0; | 962 return 0; |
| 966 } | 963 } |
| 967 | 964 |
| 968 void Channel::SetSink(std::unique_ptr<AudioSinkInterface> sink) { | 965 void Channel::SetSink(std::unique_ptr<AudioSinkInterface> sink) { |
| 969 rtc::CritScope cs(&_callbackCritSect); | 966 rtc::CritScope cs(&_callbackCritSect); |
| 970 audio_sink_ = std::move(sink); | 967 audio_sink_ = std::move(sink); |
| 971 } | 968 } |
| 972 | 969 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 audio_coding_->SetEncoder(std::move(encoder)); | 1114 audio_coding_->SetEncoder(std::move(encoder)); |
| 1118 codec_manager_.UnsetCodecInst(); | 1115 codec_manager_.UnsetCodecInst(); |
| 1119 return true; | 1116 return true; |
| 1120 } | 1117 } |
| 1121 | 1118 |
| 1122 void Channel::ModifyEncoder( | 1119 void Channel::ModifyEncoder( |
| 1123 rtc::FunctionView<void(std::unique_ptr<AudioEncoder>*)> modifier) { | 1120 rtc::FunctionView<void(std::unique_ptr<AudioEncoder>*)> modifier) { |
| 1124 audio_coding_->ModifyEncoder(modifier); | 1121 audio_coding_->ModifyEncoder(modifier); |
| 1125 } | 1122 } |
| 1126 | 1123 |
| 1127 int32_t Channel::RegisterVoiceEngineObserver(VoiceEngineObserver& observer) { | |
| 1128 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), | |
| 1129 "Channel::RegisterVoiceEngineObserver()"); | |
| 1130 rtc::CritScope cs(&_callbackCritSect); | |
| 1131 | |
| 1132 if (_voiceEngineObserverPtr) { | |
| 1133 _engineStatisticsPtr->SetLastError( | |
| 1134 VE_INVALID_OPERATION, kTraceError, | |
| 1135 "RegisterVoiceEngineObserver() observer already enabled"); | |
| 1136 return -1; | |
| 1137 } | |
| 1138 _voiceEngineObserverPtr = &observer; | |
| 1139 return 0; | |
| 1140 } | |
| 1141 | |
| 1142 int32_t Channel::DeRegisterVoiceEngineObserver() { | |
| 1143 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), | |
| 1144 "Channel::DeRegisterVoiceEngineObserver()"); | |
| 1145 rtc::CritScope cs(&_callbackCritSect); | |
| 1146 | |
| 1147 if (!_voiceEngineObserverPtr) { | |
| 1148 _engineStatisticsPtr->SetLastError( | |
| 1149 VE_INVALID_OPERATION, kTraceWarning, | |
| 1150 "DeRegisterVoiceEngineObserver() observer already disabled"); | |
| 1151 return 0; | |
| 1152 } | |
| 1153 _voiceEngineObserverPtr = NULL; | |
| 1154 return 0; | |
| 1155 } | |
| 1156 | |
| 1157 int32_t Channel::GetSendCodec(CodecInst& codec) { | 1124 int32_t Channel::GetSendCodec(CodecInst& codec) { |
| 1158 if (cached_send_codec_) { | 1125 if (cached_send_codec_) { |
| 1159 codec = *cached_send_codec_; | 1126 codec = *cached_send_codec_; |
| 1160 return 0; | 1127 return 0; |
| 1161 } else { | 1128 } else { |
| 1162 const CodecInst* send_codec = codec_manager_.GetCodecInst(); | 1129 const CodecInst* send_codec = codec_manager_.GetCodecInst(); |
| 1163 if (send_codec) { | 1130 if (send_codec) { |
| 1164 codec = *send_codec; | 1131 codec = *send_codec; |
| 1165 return 0; | 1132 return 0; |
| 1166 } | 1133 } |
| (...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2029 int64_t min_rtt = 0; | 1996 int64_t min_rtt = 0; |
| 2030 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != | 1997 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != |
| 2031 0) { | 1998 0) { |
| 2032 return 0; | 1999 return 0; |
| 2033 } | 2000 } |
| 2034 return rtt; | 2001 return rtt; |
| 2035 } | 2002 } |
| 2036 | 2003 |
| 2037 } // namespace voe | 2004 } // namespace voe |
| 2038 } // namespace webrtc | 2005 } // namespace webrtc |
| OLD | NEW |