| 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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 } | 358 } |
| 359 return channel_ptr->GetRemoteRTCPReportBlocks(report_blocks); | 359 return channel_ptr->GetRemoteRTCPReportBlocks(report_blocks); |
| 360 } | 360 } |
| 361 | 361 |
| 362 int VoERTP_RTCPImpl::SetREDStatus(int channel, | 362 int VoERTP_RTCPImpl::SetREDStatus(int channel, |
| 363 bool enable, | 363 bool enable, |
| 364 int redPayloadtype) { | 364 int redPayloadtype) { |
| 365 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | 365 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
| 366 "SetREDStatus(channel=%d, enable=%d, redPayloadtype=%d)", | 366 "SetREDStatus(channel=%d, enable=%d, redPayloadtype=%d)", |
| 367 channel, enable, redPayloadtype); | 367 channel, enable, redPayloadtype); |
| 368 #ifdef WEBRTC_CODEC_RED | |
| 369 if (!_shared->statistics().Initialized()) { | |
| 370 _shared->SetLastError(VE_NOT_INITED, kTraceError); | |
| 371 return -1; | |
| 372 } | |
| 373 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | |
| 374 voe::Channel* channelPtr = ch.channel(); | |
| 375 if (channelPtr == NULL) { | |
| 376 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | |
| 377 "SetREDStatus() failed to locate channel"); | |
| 378 return -1; | |
| 379 } | |
| 380 return channelPtr->SetREDStatus(enable, redPayloadtype); | |
| 381 #else | |
| 382 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, | 368 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, |
| 383 "SetREDStatus() RED is not supported"); | 369 "SetREDStatus() RED is not supported"); |
| 384 return -1; | 370 return -1; |
| 385 #endif | |
| 386 } | 371 } |
| 387 | 372 |
| 388 int VoERTP_RTCPImpl::GetREDStatus(int channel, | 373 int VoERTP_RTCPImpl::GetREDStatus(int channel, |
| 389 bool& enabled, | 374 bool& enabled, |
| 390 int& redPayloadtype) { | 375 int& redPayloadtype) { |
| 391 #ifdef WEBRTC_CODEC_RED | |
| 392 if (!_shared->statistics().Initialized()) { | |
| 393 _shared->SetLastError(VE_NOT_INITED, kTraceError); | |
| 394 return -1; | |
| 395 } | |
| 396 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | |
| 397 voe::Channel* channelPtr = ch.channel(); | |
| 398 if (channelPtr == NULL) { | |
| 399 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | |
| 400 "GetREDStatus() failed to locate channel"); | |
| 401 return -1; | |
| 402 } | |
| 403 return channelPtr->GetREDStatus(enabled, redPayloadtype); | |
| 404 #else | |
| 405 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, | 376 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, |
| 406 "GetREDStatus() RED is not supported"); | 377 "GetREDStatus() RED is not supported"); |
| 407 return -1; | 378 return -1; |
| 408 #endif | |
| 409 } | 379 } |
| 410 | 380 |
| 411 int VoERTP_RTCPImpl::SetNACKStatus(int channel, bool enable, int maxNoPackets) { | 381 int VoERTP_RTCPImpl::SetNACKStatus(int channel, bool enable, int maxNoPackets) { |
| 412 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | 382 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
| 413 "SetNACKStatus(channel=%d, enable=%d, maxNoPackets=%d)", channel, | 383 "SetNACKStatus(channel=%d, enable=%d, maxNoPackets=%d)", channel, |
| 414 enable, maxNoPackets); | 384 enable, maxNoPackets); |
| 415 | 385 |
| 416 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 386 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 417 voe::Channel* channelPtr = ch.channel(); | 387 voe::Channel* channelPtr = ch.channel(); |
| 418 if (channelPtr == NULL) { | 388 if (channelPtr == NULL) { |
| 419 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 389 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
| 420 "SetNACKStatus() failed to locate channel"); | 390 "SetNACKStatus() failed to locate channel"); |
| 421 return -1; | 391 return -1; |
| 422 } | 392 } |
| 423 channelPtr->SetNACKStatus(enable, maxNoPackets); | 393 channelPtr->SetNACKStatus(enable, maxNoPackets); |
| 424 return 0; | 394 return 0; |
| 425 } | 395 } |
| 426 | 396 |
| 427 #endif // #ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API | 397 #endif // #ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API |
| 428 | 398 |
| 429 } // namespace webrtc | 399 } // namespace webrtc |
| OLD | NEW |