| 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 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 // RTCP is enabled by default. | 980 // RTCP is enabled by default. |
| 981 _rtpRtcpModule->SetRTCPStatus(RtcpMode::kCompound); | 981 _rtpRtcpModule->SetRTCPStatus(RtcpMode::kCompound); |
| 982 // --- Register all permanent callbacks | 982 // --- Register all permanent callbacks |
| 983 if (audio_coding_->RegisterTransportCallback(this) == -1) { | 983 if (audio_coding_->RegisterTransportCallback(this) == -1) { |
| 984 _engineStatisticsPtr->SetLastError( | 984 _engineStatisticsPtr->SetLastError( |
| 985 VE_CANNOT_INIT_CHANNEL, kTraceError, | 985 VE_CANNOT_INIT_CHANNEL, kTraceError, |
| 986 "Channel::Init() callbacks not registered"); | 986 "Channel::Init() callbacks not registered"); |
| 987 return -1; | 987 return -1; |
| 988 } | 988 } |
| 989 | 989 |
| 990 return 0; | 990 // --- Register all supported codecs to the receiving side of the |
| 991 } | 991 // RTP/RTCP module |
| 992 | 992 |
| 993 void Channel::RegisterLegacyCodecs() { | |
| 994 CodecInst codec; | 993 CodecInst codec; |
| 995 const uint8_t nSupportedCodecs = AudioCodingModule::NumberOfCodecs(); | 994 const uint8_t nSupportedCodecs = AudioCodingModule::NumberOfCodecs(); |
| 996 | 995 |
| 997 for (int idx = 0; idx < nSupportedCodecs; idx++) { | 996 for (int idx = 0; idx < nSupportedCodecs; idx++) { |
| 998 // Open up the RTP/RTCP receiver for all supported codecs | 997 // Open up the RTP/RTCP receiver for all supported codecs |
| 999 if ((audio_coding_->Codec(idx, &codec) == -1) || | 998 if ((audio_coding_->Codec(idx, &codec) == -1) || |
| 1000 (rtp_receiver_->RegisterReceivePayload(codec) == -1)) { | 999 (rtp_receiver_->RegisterReceivePayload(codec) == -1)) { |
| 1001 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), | 1000 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), |
| 1002 "Channel::Init() unable to register %s " | 1001 "Channel::Init() unable to register %s " |
| 1003 "(%d/%d/%" PRIuS "/%d) to RTP/RTCP receiver", | 1002 "(%d/%d/%" PRIuS "/%d) to RTP/RTCP receiver", |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1035 !audio_coding_->RegisterReceiveCodec(codec.pltype, | 1034 !audio_coding_->RegisterReceiveCodec(codec.pltype, |
| 1036 CodecInstToSdp(codec)) || | 1035 CodecInstToSdp(codec)) || |
| 1037 _rtpRtcpModule->RegisterSendPayload(codec) == -1) { | 1036 _rtpRtcpModule->RegisterSendPayload(codec) == -1) { |
| 1038 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), | 1037 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), |
| 1039 "Channel::Init() failed to register CN (%d/%d) " | 1038 "Channel::Init() failed to register CN (%d/%d) " |
| 1040 "correctly - 1", | 1039 "correctly - 1", |
| 1041 codec.pltype, codec.plfreq); | 1040 codec.pltype, codec.plfreq); |
| 1042 } | 1041 } |
| 1043 } | 1042 } |
| 1044 } | 1043 } |
| 1044 |
| 1045 return 0; |
| 1045 } | 1046 } |
| 1046 | 1047 |
| 1047 void Channel::Terminate() { | 1048 void Channel::Terminate() { |
| 1048 RTC_DCHECK(construction_thread_.CalledOnValidThread()); | 1049 RTC_DCHECK(construction_thread_.CalledOnValidThread()); |
| 1049 // Must be called on the same thread as Init(). | 1050 // Must be called on the same thread as Init(). |
| 1050 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId, _channelId), | 1051 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId, _channelId), |
| 1051 "Channel::Terminate"); | 1052 "Channel::Terminate"); |
| 1052 | 1053 |
| 1053 rtp_receive_statistics_->RegisterRtcpStatisticsCallback(NULL); | 1054 rtp_receive_statistics_->RegisterRtcpStatisticsCallback(NULL); |
| 1054 | 1055 |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1352 int32_t Channel::GetVADStatus(bool& enabledVAD, | 1353 int32_t Channel::GetVADStatus(bool& enabledVAD, |
| 1353 ACMVADMode& mode, | 1354 ACMVADMode& mode, |
| 1354 bool& disabledDTX) { | 1355 bool& disabledDTX) { |
| 1355 const auto* params = codec_manager_.GetStackParams(); | 1356 const auto* params = codec_manager_.GetStackParams(); |
| 1356 enabledVAD = params->use_cng; | 1357 enabledVAD = params->use_cng; |
| 1357 mode = params->vad_mode; | 1358 mode = params->vad_mode; |
| 1358 disabledDTX = !params->use_cng; | 1359 disabledDTX = !params->use_cng; |
| 1359 return 0; | 1360 return 0; |
| 1360 } | 1361 } |
| 1361 | 1362 |
| 1362 void Channel::SetReceiveCodecs(const std::map<int, SdpAudioFormat>& codecs) { | |
| 1363 rtp_payload_registry_->SetAudioReceivePayloads(codecs); | |
| 1364 audio_coding_->SetReceiveCodecs(codecs); | |
| 1365 } | |
| 1366 | |
| 1367 int32_t Channel::SetRecPayloadType(const CodecInst& codec) { | 1363 int32_t Channel::SetRecPayloadType(const CodecInst& codec) { |
| 1368 return SetRecPayloadType(codec.pltype, CodecInstToSdp(codec)); | 1364 return SetRecPayloadType(codec.pltype, CodecInstToSdp(codec)); |
| 1369 } | 1365 } |
| 1370 | 1366 |
| 1371 int32_t Channel::SetRecPayloadType(int payload_type, | 1367 int32_t Channel::SetRecPayloadType(int payload_type, |
| 1372 const SdpAudioFormat& format) { | 1368 const SdpAudioFormat& format) { |
| 1373 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), | 1369 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), |
| 1374 "Channel::SetRecPayloadType()"); | 1370 "Channel::SetRecPayloadType()"); |
| 1375 | 1371 |
| 1376 if (channel_state_.Get().playing) { | 1372 if (channel_state_.Get().playing) { |
| (...skipping 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3033 int64_t min_rtt = 0; | 3029 int64_t min_rtt = 0; |
| 3034 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != | 3030 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != |
| 3035 0) { | 3031 0) { |
| 3036 return 0; | 3032 return 0; |
| 3037 } | 3033 } |
| 3038 return rtt; | 3034 return rtt; |
| 3039 } | 3035 } |
| 3040 | 3036 |
| 3041 } // namespace voe | 3037 } // namespace voe |
| 3042 } // namespace webrtc | 3038 } // namespace webrtc |
| OLD | NEW |