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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 voe::Channel* channelPtr = ch.channel(); | 56 voe::Channel* channelPtr = ch.channel(); |
57 if (channelPtr == NULL) { | 57 if (channelPtr == NULL) { |
58 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 58 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
59 "SetLocalSSRC() failed to locate channel"); | 59 "SetLocalSSRC() failed to locate channel"); |
60 return -1; | 60 return -1; |
61 } | 61 } |
62 return channelPtr->SetLocalSSRC(ssrc); | 62 return channelPtr->SetLocalSSRC(ssrc); |
63 } | 63 } |
64 | 64 |
65 int VoERTP_RTCPImpl::GetLocalSSRC(int channel, unsigned int& ssrc) { | 65 int VoERTP_RTCPImpl::GetLocalSSRC(int channel, unsigned int& ssrc) { |
66 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | |
67 "GetLocalSSRC(channel=%d, ssrc=?)", channel); | |
68 if (!_shared->statistics().Initialized()) { | 66 if (!_shared->statistics().Initialized()) { |
69 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 67 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
70 return -1; | 68 return -1; |
71 } | 69 } |
72 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 70 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
73 voe::Channel* channelPtr = ch.channel(); | 71 voe::Channel* channelPtr = ch.channel(); |
74 if (channelPtr == NULL) { | 72 if (channelPtr == NULL) { |
75 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 73 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
76 "GetLocalSSRC() failed to locate channel"); | 74 "GetLocalSSRC() failed to locate channel"); |
77 return -1; | 75 return -1; |
78 } | 76 } |
79 return channelPtr->GetLocalSSRC(ssrc); | 77 return channelPtr->GetLocalSSRC(ssrc); |
80 } | 78 } |
81 | 79 |
82 int VoERTP_RTCPImpl::GetRemoteSSRC(int channel, unsigned int& ssrc) { | 80 int VoERTP_RTCPImpl::GetRemoteSSRC(int channel, unsigned int& ssrc) { |
83 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | |
84 "GetRemoteSSRC(channel=%d, ssrc=?)", channel); | |
85 if (!_shared->statistics().Initialized()) { | 81 if (!_shared->statistics().Initialized()) { |
86 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 82 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
87 return -1; | 83 return -1; |
88 } | 84 } |
89 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 85 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
90 voe::Channel* channelPtr = ch.channel(); | 86 voe::Channel* channelPtr = ch.channel(); |
91 if (channelPtr == NULL) { | 87 if (channelPtr == NULL) { |
92 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 88 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
93 "GetRemoteSSRC() failed to locate channel"); | 89 "GetRemoteSSRC() failed to locate channel"); |
94 return -1; | 90 return -1; |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 if (channelPtr == NULL) { | 232 if (channelPtr == NULL) { |
237 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 233 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
238 "SetRTCPStatus() failed to locate channel"); | 234 "SetRTCPStatus() failed to locate channel"); |
239 return -1; | 235 return -1; |
240 } | 236 } |
241 channelPtr->SetRTCPStatus(enable); | 237 channelPtr->SetRTCPStatus(enable); |
242 return 0; | 238 return 0; |
243 } | 239 } |
244 | 240 |
245 int VoERTP_RTCPImpl::GetRTCPStatus(int channel, bool& enabled) { | 241 int VoERTP_RTCPImpl::GetRTCPStatus(int channel, bool& enabled) { |
246 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | |
247 "GetRTCPStatus(channel=%d)", channel); | |
248 if (!_shared->statistics().Initialized()) { | 242 if (!_shared->statistics().Initialized()) { |
249 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 243 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
250 return -1; | 244 return -1; |
251 } | 245 } |
252 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 246 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
253 voe::Channel* channelPtr = ch.channel(); | 247 voe::Channel* channelPtr = ch.channel(); |
254 if (channelPtr == NULL) { | 248 if (channelPtr == NULL) { |
255 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 249 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
256 "GetRTCPStatus() failed to locate channel"); | 250 "GetRTCPStatus() failed to locate channel"); |
257 return -1; | 251 return -1; |
(...skipping 12 matching lines...) Expand all Loading... |
270 voe::Channel* channelPtr = ch.channel(); | 264 voe::Channel* channelPtr = ch.channel(); |
271 if (channelPtr == NULL) { | 265 if (channelPtr == NULL) { |
272 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 266 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
273 "SetRTCP_CNAME() failed to locate channel"); | 267 "SetRTCP_CNAME() failed to locate channel"); |
274 return -1; | 268 return -1; |
275 } | 269 } |
276 return channelPtr->SetRTCP_CNAME(cName); | 270 return channelPtr->SetRTCP_CNAME(cName); |
277 } | 271 } |
278 | 272 |
279 int VoERTP_RTCPImpl::GetRemoteRTCP_CNAME(int channel, char cName[256]) { | 273 int VoERTP_RTCPImpl::GetRemoteRTCP_CNAME(int channel, char cName[256]) { |
280 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | |
281 "GetRemoteRTCP_CNAME(channel=%d, cName=?)", channel); | |
282 if (!_shared->statistics().Initialized()) { | 274 if (!_shared->statistics().Initialized()) { |
283 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 275 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
284 return -1; | 276 return -1; |
285 } | 277 } |
286 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 278 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
287 voe::Channel* channelPtr = ch.channel(); | 279 voe::Channel* channelPtr = ch.channel(); |
288 if (channelPtr == NULL) { | 280 if (channelPtr == NULL) { |
289 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 281 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
290 "GetRemoteRTCP_CNAME() failed to locate channel"); | 282 "GetRemoteRTCP_CNAME() failed to locate channel"); |
291 return -1; | 283 return -1; |
292 } | 284 } |
293 return channelPtr->GetRemoteRTCP_CNAME(cName); | 285 return channelPtr->GetRemoteRTCP_CNAME(cName); |
294 } | 286 } |
295 | 287 |
296 int VoERTP_RTCPImpl::GetRemoteRTCPData( | 288 int VoERTP_RTCPImpl::GetRemoteRTCPData( |
297 int channel, | 289 int channel, |
298 unsigned int& NTPHigh, // from sender info in SR | 290 unsigned int& NTPHigh, // from sender info in SR |
299 unsigned int& NTPLow, // from sender info in SR | 291 unsigned int& NTPLow, // from sender info in SR |
300 unsigned int& timestamp, // from sender info in SR | 292 unsigned int& timestamp, // from sender info in SR |
301 unsigned int& playoutTimestamp, // derived locally | 293 unsigned int& playoutTimestamp, // derived locally |
302 unsigned int* jitter, // from report block 1 in SR/RR | 294 unsigned int* jitter, // from report block 1 in SR/RR |
303 unsigned short* fractionLost) // from report block 1 in SR/RR | 295 unsigned short* fractionLost) // from report block 1 in SR/RR |
304 { | 296 { |
305 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | |
306 "GetRemoteRTCPData(channel=%d,...)", channel); | |
307 if (!_shared->statistics().Initialized()) { | 297 if (!_shared->statistics().Initialized()) { |
308 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 298 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
309 return -1; | 299 return -1; |
310 } | 300 } |
311 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 301 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
312 voe::Channel* channelPtr = ch.channel(); | 302 voe::Channel* channelPtr = ch.channel(); |
313 if (channelPtr == NULL) { | 303 if (channelPtr == NULL) { |
314 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 304 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
315 "GetRemoteRTCP_CNAME() failed to locate channel"); | 305 "GetRemoteRTCP_CNAME() failed to locate channel"); |
316 return -1; | 306 return -1; |
317 } | 307 } |
318 return channelPtr->GetRemoteRTCPData(NTPHigh, NTPLow, timestamp, | 308 return channelPtr->GetRemoteRTCPData(NTPHigh, NTPLow, timestamp, |
319 playoutTimestamp, jitter, fractionLost); | 309 playoutTimestamp, jitter, fractionLost); |
320 } | 310 } |
321 | 311 |
322 int VoERTP_RTCPImpl::GetRTPStatistics(int channel, | 312 int VoERTP_RTCPImpl::GetRTPStatistics(int channel, |
323 unsigned int& averageJitterMs, | 313 unsigned int& averageJitterMs, |
324 unsigned int& maxJitterMs, | 314 unsigned int& maxJitterMs, |
325 unsigned int& discardedPackets) { | 315 unsigned int& discardedPackets) { |
326 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | |
327 "GetRTPStatistics(channel=%d,....)", channel); | |
328 if (!_shared->statistics().Initialized()) { | 316 if (!_shared->statistics().Initialized()) { |
329 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 317 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
330 return -1; | 318 return -1; |
331 } | 319 } |
332 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 320 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
333 voe::Channel* channelPtr = ch.channel(); | 321 voe::Channel* channelPtr = ch.channel(); |
334 if (channelPtr == NULL) { | 322 if (channelPtr == NULL) { |
335 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 323 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
336 "GetRTPStatistics() failed to locate channel"); | 324 "GetRTPStatistics() failed to locate channel"); |
337 return -1; | 325 return -1; |
338 } | 326 } |
339 return channelPtr->GetRTPStatistics(averageJitterMs, maxJitterMs, | 327 return channelPtr->GetRTPStatistics(averageJitterMs, maxJitterMs, |
340 discardedPackets); | 328 discardedPackets); |
341 } | 329 } |
342 | 330 |
343 int VoERTP_RTCPImpl::GetRTCPStatistics(int channel, CallStatistics& stats) { | 331 int VoERTP_RTCPImpl::GetRTCPStatistics(int channel, CallStatistics& stats) { |
344 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | |
345 "GetRTCPStatistics(channel=%d)", channel); | |
346 if (!_shared->statistics().Initialized()) { | 332 if (!_shared->statistics().Initialized()) { |
347 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 333 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
348 return -1; | 334 return -1; |
349 } | 335 } |
350 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 336 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
351 voe::Channel* channelPtr = ch.channel(); | 337 voe::Channel* channelPtr = ch.channel(); |
352 if (channelPtr == NULL) { | 338 if (channelPtr == NULL) { |
353 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 339 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
354 "GetRTPStatistics() failed to locate channel"); | 340 "GetRTPStatistics() failed to locate channel"); |
355 return -1; | 341 return -1; |
356 } | 342 } |
357 return channelPtr->GetRTPStatistics(stats); | 343 return channelPtr->GetRTPStatistics(stats); |
358 } | 344 } |
359 | 345 |
360 int VoERTP_RTCPImpl::GetRemoteRTCPReportBlocks( | 346 int VoERTP_RTCPImpl::GetRemoteRTCPReportBlocks( |
361 int channel, std::vector<ReportBlock>* report_blocks) { | 347 int channel, std::vector<ReportBlock>* report_blocks) { |
362 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | |
363 "GetRemoteRTCPReportBlocks(channel=%d)", channel); | |
364 if (!_shared->statistics().Initialized()) { | 348 if (!_shared->statistics().Initialized()) { |
365 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 349 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
366 return -1; | 350 return -1; |
367 } | 351 } |
368 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 352 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
369 voe::Channel* channel_ptr = ch.channel(); | 353 voe::Channel* channel_ptr = ch.channel(); |
370 if (channel_ptr == NULL) { | 354 if (channel_ptr == NULL) { |
371 _shared->SetLastError( | 355 _shared->SetLastError( |
372 VE_CHANNEL_NOT_VALID, kTraceError, | 356 VE_CHANNEL_NOT_VALID, kTraceError, |
373 "GetRemoteRTCPReportBlocks() failed to locate channel"); | 357 "GetRemoteRTCPReportBlocks() failed to locate channel"); |
(...skipping 24 matching lines...) Expand all Loading... |
398 #else | 382 #else |
399 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, | 383 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, |
400 "SetREDStatus() RED is not supported"); | 384 "SetREDStatus() RED is not supported"); |
401 return -1; | 385 return -1; |
402 #endif | 386 #endif |
403 } | 387 } |
404 | 388 |
405 int VoERTP_RTCPImpl::GetREDStatus(int channel, | 389 int VoERTP_RTCPImpl::GetREDStatus(int channel, |
406 bool& enabled, | 390 bool& enabled, |
407 int& redPayloadtype) { | 391 int& redPayloadtype) { |
408 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | |
409 "GetREDStatus(channel=%d, enabled=?, redPayloadtype=?)", | |
410 channel); | |
411 #ifdef WEBRTC_CODEC_RED | 392 #ifdef WEBRTC_CODEC_RED |
412 if (!_shared->statistics().Initialized()) { | 393 if (!_shared->statistics().Initialized()) { |
413 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 394 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
414 return -1; | 395 return -1; |
415 } | 396 } |
416 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 397 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
417 voe::Channel* channelPtr = ch.channel(); | 398 voe::Channel* channelPtr = ch.channel(); |
418 if (channelPtr == NULL) { | 399 if (channelPtr == NULL) { |
419 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 400 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
420 "GetREDStatus() failed to locate channel"); | 401 "GetREDStatus() failed to locate channel"); |
(...skipping 19 matching lines...) Expand all Loading... |
440 "SetNACKStatus() failed to locate channel"); | 421 "SetNACKStatus() failed to locate channel"); |
441 return -1; | 422 return -1; |
442 } | 423 } |
443 channelPtr->SetNACKStatus(enable, maxNoPackets); | 424 channelPtr->SetNACKStatus(enable, maxNoPackets); |
444 return 0; | 425 return 0; |
445 } | 426 } |
446 | 427 |
447 #endif // #ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API | 428 #endif // #ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API |
448 | 429 |
449 } // namespace webrtc | 430 } // namespace webrtc |
OLD | NEW |