1 /* 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 3 * 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 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" 12 #include "webrtc/system_wrappers/interface/file_wrapper.h" 13 #include "webrtc/system_wrappers/interface/trace.h" 14 #include "webrtc/video_engine/include/vie_network.h" 15 #include "webrtc/voice_engine/include/voe_errors.h" 16 #include "webrtc/voice_engine/voe_rtp_rtcp_impl.h" 17 #include "webrtc/voice_engine/voice_engine_impl.h" 18 19 #include "webrtc/voice_engine/channel.h" 20 #include "webrtc/voice_engine/transmit_mixer.h" 21 22 namespace webrtc { 23 24 VoERTP_RTCP* VoERTP_RTCP::GetInterface(VoiceEngine* voiceEngine) 25 { 26 #ifndef WEBRTC_VOICE_ENGINE_RTP_RTCP_API 27 return NULL; 28 #else 29 if (NULL == voiceEngine) 30 { 31 return NULL; 32 } 33 VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine); 34 s->AddRef(); 35 return s; 36 #endif 37 } 38 39 #ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API 40 41 VoERTP_RTCPImpl::VoERTP_RTCPImpl(voe::SharedData* shared) : _shared(shared) 42 { 43 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1), 44 "VoERTP_RTCPImpl::VoERTP_RTCPImpl() - ctor"); 45 } 46 47 VoERTP_RTCPImpl::~VoERTP_RTCPImpl() 48 { 49 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1), 50 "VoERTP_RTCPImpl::~VoERTP_RTCPImpl() - dtor"); 51 } 52 53 int VoERTP_RTCPImpl::SetLocalSSRC(int channel, unsigned int ssrc) 54 { 55 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), 56 "SetLocalSSRC(channel=%d, %lu)", channel, ssrc); 57 if (!_shared->statistics().Initialized()) 58 { 59 _shared->SetLastError(VE_NOT_INITED, kTraceError); 60 return -1; 61 } 62 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); 63 voe::Channel* channelPtr = ch.channel(); 64 if (channelPtr == NULL) 65 { 66 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 67 "SetLocalSSRC() failed to locate channel"); 68 return -1; 69 } 70 return channelPtr->SetLocalSSRC(ssrc); 71 } 72 73 int VoERTP_RTCPImpl::GetLocalSSRC(int channel, unsigned int& ssrc) 74 { 75 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), 76 "GetLocalSSRC(channel=%d, ssrc=?)", channel); 77 if (!_shared->statistics().Initialized()) 78 { 79 _shared->SetLastError(VE_NOT_INITED, kTraceError); 80 return -1; 81 } 82 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); 83 voe::Channel* channelPtr = ch.channel(); 84 if (channelPtr == NULL) 85 { 86 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 87 "GetLocalSSRC() failed to locate channel"); 88 return -1; 89 } 90 return channelPtr->GetLocalSSRC(ssrc); 91 } 92 93 int VoERTP_RTCPImpl::GetRemoteSSRC(int channel, unsigned int& ssrc) 94 { 95 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), 96 "GetRemoteSSRC(channel=%d, ssrc=?)", channel); 97 if (!_shared->statistics().Initialized()) 98 { 99 _shared->SetLastError(VE_NOT_INITED, kTraceError); 100 return -1; 101 } 102 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); 103 voe::Channel* channelPtr = ch.channel(); 104 if (channelPtr == NULL) 105 { 106 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 107 "GetRemoteSSRC() failed to locate channel"); 108 return -1; 109 } 110 return channelPtr->GetRemoteSSRC(ssrc); 111 } 112 113 int VoERTP_RTCPImpl::SetSendAudioLevelIndicationStatus(int channel, 114 bool enable, 115 unsigned char id) 116 { 117 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), 118 "SetSendAudioLevelIndicationStatus(channel=%d, enable=%d," 119 " ID=%u)", channel, enable, id); 120 if (!_shared->statistics().Initialized()) 121 { 122 _shared->SetLastError(VE_NOT_INITED, kTraceError); 123 return -1; 124 } 125 if (enable && (id < kVoiceEngineMinRtpExtensionId || 126 id > kVoiceEngineMaxRtpExtensionId)) 127 { 128 // [RFC5285] The 4-bit id is the local identifier of this element in 129 // the range 1-14 inclusive. 130 _shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError, 131 "SetSendAudioLevelIndicationStatus() invalid ID parameter"); 132 return -1; 133 } 134 135 // Set state and id for the specified channel. 136 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); 137 voe::Channel* channelPtr = ch.channel(); 138 if (channelPtr == NULL) 139 { 140 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 141 "SetSendAudioLevelIndicationStatus() failed to locate channel"); 142 return -1; 143 } 144 return channelPtr->SetSendAudioLevelIndicationStatus(enable, id); 145 } 146 147 int VoERTP_RTCPImpl::SetReceiveAudioLevelIndicationStatus(int channel, 148 bool enable, 149 unsigned char id) { 150 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), 151 "SetReceiveAudioLevelIndicationStatus(channel=%d, enable=%d, id=%u)", 152 channel, enable, id); 153 if (!_shared->statistics().Initialized()) { 154 _shared->SetLastError(VE_NOT_INITED, kTraceError); 155 return -1; 156 } 157 if (enable && 158 (id < kVoiceEngineMinRtpExtensionId || 159 id > kVoiceEngineMaxRtpExtensionId)) { 160 // [RFC5285] The 4-bit id is the local identifier of this element in 161 // the range 1-14 inclusive. 162 _shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError, 163 "SetReceiveAbsoluteSenderTimeStatus() invalid id parameter"); 164 return -1; 165 } 166 // Set state and id for the specified channel. 167 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); 168 voe::Channel* channel_ptr = ch.channel(); 169 if (channel_ptr == NULL) { 170 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 171 "SetReceiveAudioLevelIndicationStatus() failed to locate channel"); 172 return -1; 173 } 174 return channel_ptr->SetReceiveAudioLevelIndicationStatus(enable, id); 175 } 176 177 int VoERTP_RTCPImpl::SetSendAbsoluteSenderTimeStatus(int channel, 178 bool enable, 179 unsigned char id) { 180 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), 181 "SetSendAbsoluteSenderTimeStatus(channel=%d, enable=%d, id=%u)", 182 channel, enable, id); 183 if (!_shared->statistics().Initialized()) { 184 _shared->SetLastError(VE_NOT_INITED, kTraceError); 185 return -1; 186 } 187 if (enable && (id < kVoiceEngineMinRtpExtensionId || 188 id > kVoiceEngineMaxRtpExtensionId)) { 189 // [RFC5285] The 4-bit id is the local identifier of this element in 190 // the range 1-14 inclusive. 191 _shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError, 192 "SetSendAbsoluteSenderTimeStatus() invalid id parameter"); 193 return -1; 194 } 195 // Set state and id for the specified channel. 196 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); 197 voe::Channel* channelPtr = ch.channel(); 198 if (channelPtr == NULL) { 199 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 200 "SetSendAbsoluteSenderTimeStatus() failed to locate channel"); 201 return -1; 202 } 203 return channelPtr->SetSendAbsoluteSenderTimeStatus(enable, id); 204 } 205 206 int VoERTP_RTCPImpl::SetReceiveAbsoluteSenderTimeStatus(int channel, 207 bool enable, 208 unsigned char id) { 209 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), 210 "SetReceiveAbsoluteSenderTimeStatus(channel=%d, enable=%d, id=%u)", 211 channel, enable, id); 212 if (!_shared->statistics().Initialized()) { 213 _shared->SetLastError(VE_NOT_INITED, kTraceError); 214 return -1; 215 } 216 if (enable && (id < kVoiceEngineMinRtpExtensionId || 217 id > kVoiceEngineMaxRtpExtensionId)) { 218 // [RFC5285] The 4-bit id is the local identifier of this element in 219 // the range 1-14 inclusive. 220 _shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError, 221 "SetReceiveAbsoluteSenderTimeStatus() invalid id parameter"); 222 return -1; 223 } 224 // Set state and id for the specified channel. 225 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); 226 voe::Channel* channelPtr = ch.channel(); 227 if (channelPtr == NULL) { 228 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 229 "SetReceiveAbsoluteSenderTimeStatus() failed to locate channel"); 230 return -1; 231 } 232 return channelPtr->SetReceiveAbsoluteSenderTimeStatus(enable, id); 233 } 234 235 int VoERTP_RTCPImpl::SetRTCPStatus(int channel, bool enable) 236 { 237 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), 238 "SetRTCPStatus(channel=%d, enable=%d)", channel, enable); 239 if (!_shared->statistics().Initialized()) 240 { 241 _shared->SetLastError(VE_NOT_INITED, kTraceError); 242 return -1; 243 } 244 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); 245 voe::Channel* channelPtr = ch.channel(); 246 if (channelPtr == NULL) 247 { 248 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 249 "SetRTCPStatus() failed to locate channel"); 250 return -1; 251 } 252 return channelPtr->SetRTCPStatus(enable); 253 } 254 255 int VoERTP_RTCPImpl::GetRTCPStatus(int channel, bool& enabled) 256 { 257 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), 258 "GetRTCPStatus(channel=%d)", channel); 259 if (!_shared->statistics().Initialized()) 260 { 261 _shared->SetLastError(VE_NOT_INITED, kTraceError); 262 return -1; 263 } 264 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); 265 voe::Channel* channelPtr = ch.channel(); 266 if (channelPtr == NULL) 267 { 268 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 269 "GetRTCPStatus() failed to locate channel"); 270 return -1; 271 } 272 return channelPtr->GetRTCPStatus(enabled); 273 } 274 275 int VoERTP_RTCPImpl::SetRTCP_CNAME(int channel, const char cName[256]) 276 { 277 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), 278 "SetRTCP_CNAME(channel=%d, cName=%s)", channel, cName); 279 if (!_shared->statistics().Initialized()) 280 { 281 _shared->SetLastError(VE_NOT_INITED, kTraceError); 282 return -1; 283 } 284 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); 285 voe::Channel* channelPtr = ch.channel(); 286 if (channelPtr == NULL) 287 { 288 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 289 "SetRTCP_CNAME() failed to locate channel"); 290 return -1; 291 } 292 return channelPtr->SetRTCP_CNAME(cName); 293 } 294 295 int VoERTP_RTCPImpl::GetRemoteRTCP_CNAME(int channel, char cName[256]) 296 { 297 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), 298 "GetRemoteRTCP_CNAME(channel=%d, cName=?)", channel); 299 if (!_shared->statistics().Initialized()) 300 { 301 _shared->SetLastError(VE_NOT_INITED, kTraceError); 302 return -1; 303 } 304 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); 305 voe::Channel* channelPtr = ch.channel(); 306 if (channelPtr == NULL) 307 { 308 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 309 "GetRemoteRTCP_CNAME() failed to locate channel"); 310 return -1; 311 } 312 return channelPtr->GetRemoteRTCP_CNAME(cName); 313 } 314 315 int VoERTP_RTCPImpl::GetRemoteRTCPData( 316 int channel, 317 unsigned int& NTPHigh, // from sender info in SR 318 unsigned int& NTPLow, // from sender info in SR 319 unsigned int& timestamp, // from sender info in SR 320 unsigned int& playoutTimestamp, // derived locally 321 unsigned int* jitter, // from report block 1 in SR/RR 322 unsigned short* fractionLost) // from report block 1 in SR/RR 323 { 324 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), 325 "GetRemoteRTCPData(channel=%d,...)", channel); 326 if (!_shared->statistics().Initialized()) 327 { 328 _shared->SetLastError(VE_NOT_INITED, kTraceError); 329 return -1; 330 } 331 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); 332 voe::Channel* channelPtr = ch.channel(); 333 if (channelPtr == NULL) 334 { 335 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 336 "GetRemoteRTCP_CNAME() failed to locate channel"); 337 return -1; 338 } 339 return channelPtr->GetRemoteRTCPData(NTPHigh, 340 NTPLow, 341 timestamp, 342 playoutTimestamp, 343 jitter, 344 fractionLost); 345 } 346 347 int VoERTP_RTCPImpl::GetRTPStatistics(int channel, 348 unsigned int& averageJitterMs, 349 unsigned int& maxJitterMs, 350 unsigned int& discardedPackets) 351 { 352 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), 353 "GetRTPStatistics(channel=%d,....)", channel); 354 if (!_shared->statistics().Initialized()) 355 { 356 _shared->SetLastError(VE_NOT_INITED, kTraceError); 357 return -1; 358 } 359 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); 360 voe::Channel* channelPtr = ch.channel(); 361 if (channelPtr == NULL) 362 { 363 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 364 "GetRTPStatistics() failed to locate channel"); 365 return -1; 366 } 367 return channelPtr->GetRTPStatistics(averageJitterMs, 368 maxJitterMs, 369 discardedPackets); 370 } 371 372 int VoERTP_RTCPImpl::GetRTCPStatistics(int channel, CallStatistics& stats) 373 { 374 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), 375 "GetRTCPStatistics(channel=%d)", channel); 376 if (!_shared->statistics().Initialized()) 377 { 378 _shared->SetLastError(VE_NOT_INITED, kTraceError); 379 return -1; 380 } 381 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); 382 voe::Channel* channelPtr = ch.channel(); 383 if (channelPtr == NULL) 384 { 385 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 386 "GetRTPStatistics() failed to locate channel"); 387 return -1; 388 } 389 return channelPtr->GetRTPStatistics(stats); 390 } 391 392 int VoERTP_RTCPImpl::GetRemoteRTCPReportBlocks( 393 int channel, std::vector<ReportBlock>* report_blocks) { 394 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), 395 "GetRemoteRTCPReportBlocks(channel=%d)", channel); 396 if (!_shared->statistics().Initialized()) { 397 _shared->SetLastError(VE_NOT_INITED, kTraceError); 398 return -1; 399 } 400 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); 401 voe::Channel* channel_ptr = ch.channel(); 402 if (channel_ptr == NULL) { 403 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 404 "GetRemoteRTCPReportBlocks() failed to locate channel"); 405 return -1; 406 } 407 return channel_ptr->GetRemoteRTCPReportBlocks(report_blocks); 408 } 409 410 int VoERTP_RTCPImpl::SetREDStatus(int channel, bool enable, int redPayloadtype) 411 { 412 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), 413 "SetREDStatus(channel=%d, enable=%d, redPayloadtype=%d)", 414 channel, enable, redPayloadtype); 415 #ifdef WEBRTC_CODEC_RED 416 if (!_shared->statistics().Initialized()) 417 { 418 _shared->SetLastError(VE_NOT_INITED, kTraceError); 419 return -1; 420 } 421 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); 422 voe::Channel* channelPtr = ch.channel(); 423 if (channelPtr == NULL) 424 { 425 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 426 "SetREDStatus() failed to locate channel"); 427 return -1; 428 } 429 return channelPtr->SetREDStatus(enable, redPayloadtype); 430 #else 431 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, 432 "SetREDStatus() RED is not supported"); 433 return -1; 434 #endif 435 } 436 437 int VoERTP_RTCPImpl::GetREDStatus(int channel, 438 bool& enabled, 439 int& redPayloadtype) 440 { 441 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), 442 "GetREDStatus(channel=%d, enabled=?, redPayloadtype=?)", 443 channel); 444 #ifdef WEBRTC_CODEC_RED 445 if (!_shared->statistics().Initialized()) 446 { 447 _shared->SetLastError(VE_NOT_INITED, kTraceError); 448 return -1; 449 } 450 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); 451 voe::Channel* channelPtr = ch.channel(); 452 if (channelPtr == NULL) 453 { 454 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 455 "GetREDStatus() failed to locate channel"); 456 return -1; 457 } 458 return channelPtr->GetREDStatus(enabled, redPayloadtype); 459 #else 460 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, 461 "GetREDStatus() RED is not supported"); 462 return -1; 463 #endif 464 } 465 466 int VoERTP_RTCPImpl::SetNACKStatus(int channel, 467 bool enable, 468 int maxNoPackets) 469 { 470 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), 471 "SetNACKStatus(channel=%d, enable=%d, maxNoPackets=%d)", 472 channel, enable, maxNoPackets); 473 474 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); 475 voe::Channel* channelPtr = ch.channel(); 476 if (channelPtr == NULL) 477 { 478 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 479 "SetNACKStatus() failed to locate channel"); 480 return -1; 481 } 482 channelPtr->SetNACKStatus(enable, maxNoPackets); 483 return 0; 484 } 485 486 487 int VoERTP_RTCPImpl::StartRTPDump(int channel, 488 const char fileNameUTF8[1024], 489 RTPDirections direction) 490 { 491 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), 492 "StartRTPDump(channel=%d, fileNameUTF8=%s, direction=%d)", 493 channel, fileNameUTF8, direction); 494 assert(1024 == FileWrapper::kMaxFileNameSize); 495 if (!_shared->statistics().Initialized()) 496 { 497 _shared->SetLastError(VE_NOT_INITED, kTraceError); 498 return -1; 499 } 500 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); 501 voe::Channel* channelPtr = ch.channel(); 502 if (channelPtr == NULL) 503 { 504 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 505 "StartRTPDump() failed to locate channel"); 506 return -1; 507 } 508 return channelPtr->StartRTPDump(fileNameUTF8, direction); 509 } 510 511 int VoERTP_RTCPImpl::StopRTPDump(int channel, RTPDirections direction) 512 { 513 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), 514 "StopRTPDump(channel=%d, direction=%d)", channel, direction); 515 if (!_shared->statistics().Initialized()) 516 { 517 _shared->SetLastError(VE_NOT_INITED, kTraceError); 518 return -1; 519 } 520 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); 521 voe::Channel* channelPtr = ch.channel(); 522 if (channelPtr == NULL) 523 { 524 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 525 "StopRTPDump() failed to locate channel"); 526 return -1; 527 } 528 return channelPtr->StopRTPDump(direction); 529 } 530 531 int VoERTP_RTCPImpl::RTPDumpIsActive(int channel, RTPDirections direction) 532 { 533 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), 534 "RTPDumpIsActive(channel=%d, direction=%d)", 535 channel, direction); 536 if (!_shared->statistics().Initialized()) 537 { 538 _shared->SetLastError(VE_NOT_INITED, kTraceError); 539 return -1; 540 } 541 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); 542 voe::Channel* channelPtr = ch.channel(); 543 if (channelPtr == NULL) 544 { 545 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 546 "StopRTPDump() failed to locate channel"); 547 return -1; 548 } 549 return channelPtr->RTPDumpIsActive(direction); 550 } 551 552 int VoERTP_RTCPImpl::SetVideoEngineBWETarget(int channel, 553 ViENetwork* vie_network, 554 int video_channel) { 555 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), 556 "SetVideoEngineBWETarget(channel=%d, vie_network=?, video_channel=%d)", 557 channel, vie_network, video_channel); 558 559 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); 560 voe::Channel* channelPtr = ch.channel(); 561 if (channelPtr == NULL) { 562 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 563 "SetVideoEngineBWETarget() failed to locate channel"); 564 if (vie_network) { 565 vie_network->Release(); 566 } 567 return -1; 568 } 569 channelPtr->SetVideoEngineBWETarget(vie_network, video_channel); 570 return 0; 571 } 572 573 #endif // #ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API 574 575 } // namespace webrtc 576