| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 voe::Channel* channelPtr = ch.channel(); | 111 voe::Channel* channelPtr = ch.channel(); |
| 112 if (channelPtr == NULL) { | 112 if (channelPtr == NULL) { |
| 113 _shared->SetLastError( | 113 _shared->SetLastError( |
| 114 VE_CHANNEL_NOT_VALID, kTraceError, | 114 VE_CHANNEL_NOT_VALID, kTraceError, |
| 115 "SetSendAudioLevelIndicationStatus() failed to locate channel"); | 115 "SetSendAudioLevelIndicationStatus() failed to locate channel"); |
| 116 return -1; | 116 return -1; |
| 117 } | 117 } |
| 118 return channelPtr->SetSendAudioLevelIndicationStatus(enable, id); | 118 return channelPtr->SetSendAudioLevelIndicationStatus(enable, id); |
| 119 } | 119 } |
| 120 | 120 |
| 121 int VoERTP_RTCPImpl::SetReceiveAudioLevelIndicationStatus(int channel, | |
| 122 bool enable, | |
| 123 unsigned char id) { | |
| 124 WEBRTC_TRACE( | |
| 125 kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | |
| 126 "SetReceiveAudioLevelIndicationStatus(channel=%d, enable=%d, id=%u)", | |
| 127 channel, enable, id); | |
| 128 if (!_shared->statistics().Initialized()) { | |
| 129 _shared->SetLastError(VE_NOT_INITED, kTraceError); | |
| 130 return -1; | |
| 131 } | |
| 132 if (enable && (id < kVoiceEngineMinRtpExtensionId || | |
| 133 id > kVoiceEngineMaxRtpExtensionId)) { | |
| 134 // [RFC5285] The 4-bit id is the local identifier of this element in | |
| 135 // the range 1-14 inclusive. | |
| 136 _shared->SetLastError( | |
| 137 VE_INVALID_ARGUMENT, kTraceError, | |
| 138 "SetReceiveAudioLevelIndicationStatus() invalid id parameter"); | |
| 139 return -1; | |
| 140 } | |
| 141 // Set state and id for the specified channel. | |
| 142 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | |
| 143 voe::Channel* channel_ptr = ch.channel(); | |
| 144 if (channel_ptr == NULL) { | |
| 145 _shared->SetLastError( | |
| 146 VE_CHANNEL_NOT_VALID, kTraceError, | |
| 147 "SetReceiveAudioLevelIndicationStatus() failed to locate channel"); | |
| 148 return -1; | |
| 149 } | |
| 150 return channel_ptr->SetReceiveAudioLevelIndicationStatus(enable, id); | |
| 151 } | |
| 152 | |
| 153 int VoERTP_RTCPImpl::SetRTCPStatus(int channel, bool enable) { | 121 int VoERTP_RTCPImpl::SetRTCPStatus(int channel, bool enable) { |
| 154 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | 122 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
| 155 "SetRTCPStatus(channel=%d, enable=%d)", channel, enable); | 123 "SetRTCPStatus(channel=%d, enable=%d)", channel, enable); |
| 156 if (!_shared->statistics().Initialized()) { | 124 if (!_shared->statistics().Initialized()) { |
| 157 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 125 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
| 158 return -1; | 126 return -1; |
| 159 } | 127 } |
| 160 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 128 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 161 voe::Channel* channelPtr = ch.channel(); | 129 voe::Channel* channelPtr = ch.channel(); |
| 162 if (channelPtr == NULL) { | 130 if (channelPtr == NULL) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 176 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 209 voe::Channel* channelPtr = ch.channel(); | 177 voe::Channel* channelPtr = ch.channel(); |
| 210 if (channelPtr == NULL) { | 178 if (channelPtr == NULL) { |
| 211 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 179 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
| 212 "GetRemoteRTCP_CNAME() failed to locate channel"); | 180 "GetRemoteRTCP_CNAME() failed to locate channel"); |
| 213 return -1; | 181 return -1; |
| 214 } | 182 } |
| 215 return channelPtr->GetRemoteRTCP_CNAME(cName); | 183 return channelPtr->GetRemoteRTCP_CNAME(cName); |
| 216 } | 184 } |
| 217 | 185 |
| 218 int VoERTP_RTCPImpl::GetRemoteRTCPData( | |
| 219 int channel, | |
| 220 unsigned int& NTPHigh, // from sender info in SR | |
| 221 unsigned int& NTPLow, // from sender info in SR | |
| 222 unsigned int& timestamp, // from sender info in SR | |
| 223 unsigned int& playoutTimestamp, // derived locally | |
| 224 unsigned int* jitter, // from report block 1 in SR/RR | |
| 225 unsigned short* fractionLost) // from report block 1 in SR/RR | |
| 226 { | |
| 227 if (!_shared->statistics().Initialized()) { | |
| 228 _shared->SetLastError(VE_NOT_INITED, kTraceError); | |
| 229 return -1; | |
| 230 } | |
| 231 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | |
| 232 voe::Channel* channelPtr = ch.channel(); | |
| 233 if (channelPtr == NULL) { | |
| 234 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | |
| 235 "GetRemoteRTCP_CNAME() failed to locate channel"); | |
| 236 return -1; | |
| 237 } | |
| 238 return channelPtr->GetRemoteRTCPData(NTPHigh, NTPLow, timestamp, | |
| 239 playoutTimestamp, jitter, fractionLost); | |
| 240 } | |
| 241 | |
| 242 int VoERTP_RTCPImpl::GetRTPStatistics(int channel, | |
| 243 unsigned int& averageJitterMs, | |
| 244 unsigned int& maxJitterMs, | |
| 245 unsigned int& discardedPackets) { | |
| 246 if (!_shared->statistics().Initialized()) { | |
| 247 _shared->SetLastError(VE_NOT_INITED, kTraceError); | |
| 248 return -1; | |
| 249 } | |
| 250 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | |
| 251 voe::Channel* channelPtr = ch.channel(); | |
| 252 if (channelPtr == NULL) { | |
| 253 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | |
| 254 "GetRTPStatistics() failed to locate channel"); | |
| 255 return -1; | |
| 256 } | |
| 257 return channelPtr->GetRTPStatistics(averageJitterMs, maxJitterMs, | |
| 258 discardedPackets); | |
| 259 } | |
| 260 | |
| 261 int VoERTP_RTCPImpl::GetRTCPStatistics(int channel, CallStatistics& stats) { | 186 int VoERTP_RTCPImpl::GetRTCPStatistics(int channel, CallStatistics& stats) { |
| 262 if (!_shared->statistics().Initialized()) { | 187 if (!_shared->statistics().Initialized()) { |
| 263 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 188 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
| 264 return -1; | 189 return -1; |
| 265 } | 190 } |
| 266 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 191 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 267 voe::Channel* channelPtr = ch.channel(); | 192 voe::Channel* channelPtr = ch.channel(); |
| 268 if (channelPtr == NULL) { | 193 if (channelPtr == NULL) { |
| 269 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 194 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
| 270 "GetRTPStatistics() failed to locate channel"); | 195 "GetRTPStatistics() failed to locate channel"); |
| 271 return -1; | 196 return -1; |
| 272 } | 197 } |
| 273 return channelPtr->GetRTPStatistics(stats); | 198 return channelPtr->GetRTPStatistics(stats); |
| 274 } | 199 } |
| 275 | 200 |
| 276 int VoERTP_RTCPImpl::GetRemoteRTCPReportBlocks( | |
| 277 int channel, std::vector<ReportBlock>* report_blocks) { | |
| 278 if (!_shared->statistics().Initialized()) { | |
| 279 _shared->SetLastError(VE_NOT_INITED, kTraceError); | |
| 280 return -1; | |
| 281 } | |
| 282 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | |
| 283 voe::Channel* channel_ptr = ch.channel(); | |
| 284 if (channel_ptr == NULL) { | |
| 285 _shared->SetLastError( | |
| 286 VE_CHANNEL_NOT_VALID, kTraceError, | |
| 287 "GetRemoteRTCPReportBlocks() failed to locate channel"); | |
| 288 return -1; | |
| 289 } | |
| 290 return channel_ptr->GetRemoteRTCPReportBlocks(report_blocks); | |
| 291 } | |
| 292 | |
| 293 int VoERTP_RTCPImpl::SetNACKStatus(int channel, bool enable, int maxNoPackets) { | |
| 294 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | |
| 295 "SetNACKStatus(channel=%d, enable=%d, maxNoPackets=%d)", channel, | |
| 296 enable, maxNoPackets); | |
| 297 | |
| 298 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | |
| 299 voe::Channel* channelPtr = ch.channel(); | |
| 300 if (channelPtr == NULL) { | |
| 301 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | |
| 302 "SetNACKStatus() failed to locate channel"); | |
| 303 return -1; | |
| 304 } | |
| 305 channelPtr->SetNACKStatus(enable, maxNoPackets); | |
| 306 return 0; | |
| 307 } | |
| 308 | |
| 309 } // namespace webrtc | 201 } // namespace webrtc |
| OLD | NEW |