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 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1021 if (!codec_manager_.RegisterEncoder(codec) || | 1021 if (!codec_manager_.RegisterEncoder(codec) || |
1022 !codec_manager_.MakeEncoder(&rent_a_codec_, audio_coding_.get()) || | 1022 !codec_manager_.MakeEncoder(&rent_a_codec_, audio_coding_.get()) || |
1023 !RegisterReceiveCodec(&audio_coding_, &rent_a_codec_, codec) || | 1023 !RegisterReceiveCodec(&audio_coding_, &rent_a_codec_, codec) || |
1024 _rtpRtcpModule->RegisterSendPayload(codec) == -1) { | 1024 _rtpRtcpModule->RegisterSendPayload(codec) == -1) { |
1025 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), | 1025 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), |
1026 "Channel::Init() failed to register CN (%d/%d) " | 1026 "Channel::Init() failed to register CN (%d/%d) " |
1027 "correctly - 1", | 1027 "correctly - 1", |
1028 codec.pltype, codec.plfreq); | 1028 codec.pltype, codec.plfreq); |
1029 } | 1029 } |
1030 } | 1030 } |
1031 #ifdef WEBRTC_CODEC_RED | |
1032 // Register RED to the receiving side of the ACM. | |
1033 // We will not receive an OnInitializeDecoder() callback for RED. | |
1034 if (!STR_CASE_CMP(codec.plname, "RED")) { | |
1035 if (!RegisterReceiveCodec(&audio_coding_, &rent_a_codec_, codec)) { | |
1036 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), | |
1037 "Channel::Init() failed to register RED (%d/%d) " | |
1038 "correctly", | |
1039 codec.pltype, codec.plfreq); | |
1040 } | |
1041 } | |
1042 #endif | |
1043 } | 1031 } |
1044 | 1032 |
1045 if (rx_audioproc_->noise_suppression()->set_level(kDefaultNsMode) != 0) { | 1033 if (rx_audioproc_->noise_suppression()->set_level(kDefaultNsMode) != 0) { |
1046 LOG(LS_ERROR) << "noise_suppression()->set_level(kDefaultNsMode) failed."; | 1034 LOG(LS_ERROR) << "noise_suppression()->set_level(kDefaultNsMode) failed."; |
1047 return -1; | 1035 return -1; |
1048 } | 1036 } |
1049 if (rx_audioproc_->gain_control()->set_mode(kDefaultRxAgcMode) != 0) { | 1037 if (rx_audioproc_->gain_control()->set_mode(kDefaultRxAgcMode) != 0) { |
1050 LOG(LS_ERROR) << "gain_control()->set_mode(kDefaultRxAgcMode) failed."; | 1038 LOG(LS_ERROR) << "gain_control()->set_mode(kDefaultRxAgcMode) failed."; |
1051 return -1; | 1039 return -1; |
1052 } | 1040 } |
(...skipping 1814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2867 stats.packetsReceived = packetsReceived; | 2855 stats.packetsReceived = packetsReceived; |
2868 | 2856 |
2869 // --- Timestamps | 2857 // --- Timestamps |
2870 { | 2858 { |
2871 rtc::CritScope lock(&ts_stats_lock_); | 2859 rtc::CritScope lock(&ts_stats_lock_); |
2872 stats.capture_start_ntp_time_ms_ = capture_start_ntp_time_ms_; | 2860 stats.capture_start_ntp_time_ms_ = capture_start_ntp_time_ms_; |
2873 } | 2861 } |
2874 return 0; | 2862 return 0; |
2875 } | 2863 } |
2876 | 2864 |
2877 int Channel::SetREDStatus(bool enable, int redPayloadtype) { | |
2878 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), | |
2879 "Channel::SetREDStatus()"); | |
2880 | |
2881 if (enable) { | |
2882 if (redPayloadtype < 0 || redPayloadtype > 127) { | |
2883 _engineStatisticsPtr->SetLastError( | |
2884 VE_PLTYPE_ERROR, kTraceError, | |
2885 "SetREDStatus() invalid RED payload type"); | |
2886 return -1; | |
2887 } | |
2888 | |
2889 if (SetRedPayloadType(redPayloadtype) < 0) { | |
the sun
2016/06/13 08:17:39
Can you remove SetRedPayloadType() as well?
kwiberg-webrtc
2016/06/13 11:21:14
Indeed I can. Good catch.
| |
2890 _engineStatisticsPtr->SetLastError( | |
2891 VE_CODEC_ERROR, kTraceError, | |
2892 "SetSecondarySendCodec() Failed to register RED ACM"); | |
2893 return -1; | |
2894 } | |
2895 } | |
2896 | |
2897 if (!codec_manager_.SetCopyRed(enable) || | |
2898 !codec_manager_.MakeEncoder(&rent_a_codec_, audio_coding_.get())) { | |
2899 _engineStatisticsPtr->SetLastError( | |
2900 VE_AUDIO_CODING_MODULE_ERROR, kTraceError, | |
2901 "SetREDStatus() failed to set RED state in the ACM"); | |
2902 return -1; | |
2903 } | |
2904 return 0; | |
2905 } | |
2906 | |
2907 int Channel::GetREDStatus(bool& enabled, int& redPayloadtype) { | |
2908 enabled = codec_manager_.GetStackParams()->use_red; | |
2909 if (enabled) { | |
2910 int8_t payloadType = 0; | |
2911 if (_rtpRtcpModule->SendREDPayloadType(&payloadType) != 0) { | |
2912 _engineStatisticsPtr->SetLastError( | |
2913 VE_RTP_RTCP_MODULE_ERROR, kTraceError, | |
2914 "GetREDStatus() failed to retrieve RED PT from RTP/RTCP " | |
2915 "module"); | |
2916 return -1; | |
2917 } | |
2918 redPayloadtype = payloadType; | |
2919 return 0; | |
2920 } | |
2921 return 0; | |
2922 } | |
2923 | |
2924 int Channel::SetCodecFECStatus(bool enable) { | 2865 int Channel::SetCodecFECStatus(bool enable) { |
2925 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), | 2866 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), |
2926 "Channel::SetCodecFECStatus()"); | 2867 "Channel::SetCodecFECStatus()"); |
2927 | 2868 |
2928 if (!codec_manager_.SetCodecFEC(enable) || | 2869 if (!codec_manager_.SetCodecFEC(enable) || |
2929 !codec_manager_.MakeEncoder(&rent_a_codec_, audio_coding_.get())) { | 2870 !codec_manager_.MakeEncoder(&rent_a_codec_, audio_coding_.get())) { |
2930 _engineStatisticsPtr->SetLastError( | 2871 _engineStatisticsPtr->SetLastError( |
2931 VE_AUDIO_CODING_MODULE_ERROR, kTraceError, | 2872 VE_AUDIO_CODING_MODULE_ERROR, kTraceError, |
2932 "SetCodecFECStatus() failed to set FEC state"); | 2873 "SetCodecFECStatus() failed to set FEC state"); |
2933 return -1; | 2874 return -1; |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3485 | 3426 |
3486 codec.pltype = red_payload_type; | 3427 codec.pltype = red_payload_type; |
3487 if (!codec_manager_.RegisterEncoder(codec) || | 3428 if (!codec_manager_.RegisterEncoder(codec) || |
3488 !codec_manager_.MakeEncoder(&rent_a_codec_, audio_coding_.get())) { | 3429 !codec_manager_.MakeEncoder(&rent_a_codec_, audio_coding_.get())) { |
3489 _engineStatisticsPtr->SetLastError( | 3430 _engineStatisticsPtr->SetLastError( |
3490 VE_AUDIO_CODING_MODULE_ERROR, kTraceError, | 3431 VE_AUDIO_CODING_MODULE_ERROR, kTraceError, |
3491 "SetRedPayloadType() RED registration in ACM module failed"); | 3432 "SetRedPayloadType() RED registration in ACM module failed"); |
3492 return -1; | 3433 return -1; |
3493 } | 3434 } |
3494 | 3435 |
3495 if (_rtpRtcpModule->SetSendREDPayloadType(red_payload_type) != 0) { | 3436 if (_rtpRtcpModule->SetSendREDPayloadType(red_payload_type) != 0) { |
the sun
2016/06/13 08:21:17
Can you make a follow-up CL to remove also RtpRtcp
kwiberg-webrtc
2016/06/13 11:21:14
Good idea. https://codereview.webrtc.org/206647300
| |
3496 _engineStatisticsPtr->SetLastError( | 3437 _engineStatisticsPtr->SetLastError( |
3497 VE_RTP_RTCP_MODULE_ERROR, kTraceError, | 3438 VE_RTP_RTCP_MODULE_ERROR, kTraceError, |
3498 "SetRedPayloadType() RED registration in RTP/RTCP module failed"); | 3439 "SetRedPayloadType() RED registration in RTP/RTCP module failed"); |
3499 return -1; | 3440 return -1; |
3500 } | 3441 } |
3501 return 0; | 3442 return 0; |
3502 } | 3443 } |
3503 | 3444 |
3504 int Channel::SetSendRtpHeaderExtension(bool enable, | 3445 int Channel::SetSendRtpHeaderExtension(bool enable, |
3505 RTPExtensionType type, | 3446 RTPExtensionType type, |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3577 int64_t min_rtt = 0; | 3518 int64_t min_rtt = 0; |
3578 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != | 3519 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != |
3579 0) { | 3520 0) { |
3580 return 0; | 3521 return 0; |
3581 } | 3522 } |
3582 return rtt; | 3523 return rtt; |
3583 } | 3524 } |
3584 | 3525 |
3585 } // namespace voe | 3526 } // namespace voe |
3586 } // namespace webrtc | 3527 } // namespace webrtc |
OLD | NEW |