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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
384 receiveCodec.pltype = payloadType; | 384 receiveCodec.pltype = payloadType; |
385 receiveCodec.plfreq = frequency; | 385 receiveCodec.plfreq = frequency; |
386 receiveCodec.channels = channels; | 386 receiveCodec.channels = channels; |
387 receiveCodec.rate = rate; | 387 receiveCodec.rate = rate; |
388 strncpy(receiveCodec.plname, payloadName, RTP_PAYLOAD_NAME_SIZE - 1); | 388 strncpy(receiveCodec.plname, payloadName, RTP_PAYLOAD_NAME_SIZE - 1); |
389 | 389 |
390 audio_coding_->Codec(payloadName, &dummyCodec, frequency, channels); | 390 audio_coding_->Codec(payloadName, &dummyCodec, frequency, channels); |
391 receiveCodec.pacsize = dummyCodec.pacsize; | 391 receiveCodec.pacsize = dummyCodec.pacsize; |
392 | 392 |
393 // Register the new codec to the ACM | 393 // Register the new codec to the ACM |
394 if (audio_coding_->RegisterReceiveCodec(receiveCodec) == -1) { | 394 if (audio_coding_->RegisterReceiveCodec(receiveCodec, [&] { |
395 return rent_a_codec_.RentIsacDecoder(); | |
396 }) == -1) { | |
395 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), | 397 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), |
396 "Channel::OnInitializeDecoder() invalid codec (" | 398 "Channel::OnInitializeDecoder() invalid codec (" |
397 "pt=%d, name=%s) received - 1", | 399 "pt=%d, name=%s) received - 1", |
398 payloadType, payloadName); | 400 payloadType, payloadName); |
399 _engineStatisticsPtr->SetLastError(VE_AUDIO_CODING_MODULE_ERROR); | 401 _engineStatisticsPtr->SetLastError(VE_AUDIO_CODING_MODULE_ERROR); |
400 return -1; | 402 return -1; |
401 } | 403 } |
402 | 404 |
403 return 0; | 405 return 0; |
404 } | 406 } |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
959 codec.rate); | 961 codec.rate); |
960 } | 962 } |
961 | 963 |
962 // Ensure that PCMU is used as default codec on the sending side | 964 // Ensure that PCMU is used as default codec on the sending side |
963 if (!STR_CASE_CMP(codec.plname, "PCMU") && (codec.channels == 1)) { | 965 if (!STR_CASE_CMP(codec.plname, "PCMU") && (codec.channels == 1)) { |
964 SetSendCodec(codec); | 966 SetSendCodec(codec); |
965 } | 967 } |
966 | 968 |
967 // Register default PT for outband 'telephone-event' | 969 // Register default PT for outband 'telephone-event' |
968 if (!STR_CASE_CMP(codec.plname, "telephone-event")) { | 970 if (!STR_CASE_CMP(codec.plname, "telephone-event")) { |
969 if ((_rtpRtcpModule->RegisterSendPayload(codec) == -1) || | 971 if (_rtpRtcpModule->RegisterSendPayload(codec) == -1 || |
970 (audio_coding_->RegisterReceiveCodec(codec) == -1)) { | 972 audio_coding_->RegisterReceiveCodec( |
973 codec, [&] { return rent_a_codec_.RentIsacDecoder(); }) == -1) { | |
971 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), | 974 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), |
972 "Channel::Init() failed to register outband " | 975 "Channel::Init() failed to register outband " |
973 "'telephone-event' (%d/%d) correctly", | 976 "'telephone-event' (%d/%d) correctly", |
974 codec.pltype, codec.plfreq); | 977 codec.pltype, codec.plfreq); |
975 } | 978 } |
976 } | 979 } |
977 | 980 |
978 if (!STR_CASE_CMP(codec.plname, "CN")) { | 981 if (!STR_CASE_CMP(codec.plname, "CN")) { |
979 if ((audio_coding_->RegisterSendCodec(codec) == -1) || | 982 if (!codec_manager_.RegisterEncoder(codec) || |
980 (audio_coding_->RegisterReceiveCodec(codec) == -1) || | 983 !codec_manager_.MakeEncoder(&rent_a_codec_, |
981 (_rtpRtcpModule->RegisterSendPayload(codec) == -1)) { | 984 [&](std::unique_ptr<AudioEncoder> enc) { |
985 audio_coding_->SetEncoder( | |
986 std::move(enc)); | |
987 }) || | |
988 audio_coding_->RegisterReceiveCodec( | |
989 codec, [&] { return rent_a_codec_.RentIsacDecoder(); }) == -1 || | |
990 _rtpRtcpModule->RegisterSendPayload(codec) == -1) { | |
982 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), | 991 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), |
983 "Channel::Init() failed to register CN (%d/%d) " | 992 "Channel::Init() failed to register CN (%d/%d) " |
984 "correctly - 1", | 993 "correctly - 1", |
985 codec.pltype, codec.plfreq); | 994 codec.pltype, codec.plfreq); |
986 } | 995 } |
987 } | 996 } |
988 #ifdef WEBRTC_CODEC_RED | 997 #ifdef WEBRTC_CODEC_RED |
989 // Register RED to the receiving side of the ACM. | 998 // Register RED to the receiving side of the ACM. |
990 // We will not receive an OnInitializeDecoder() callback for RED. | 999 // We will not receive an OnInitializeDecoder() callback for RED. |
991 if (!STR_CASE_CMP(codec.plname, "RED")) { | 1000 if (!STR_CASE_CMP(codec.plname, "RED")) { |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1188 _engineStatisticsPtr->SetLastError( | 1197 _engineStatisticsPtr->SetLastError( |
1189 VE_INVALID_OPERATION, kTraceWarning, | 1198 VE_INVALID_OPERATION, kTraceWarning, |
1190 "DeRegisterVoiceEngineObserver() observer already disabled"); | 1199 "DeRegisterVoiceEngineObserver() observer already disabled"); |
1191 return 0; | 1200 return 0; |
1192 } | 1201 } |
1193 _voiceEngineObserverPtr = NULL; | 1202 _voiceEngineObserverPtr = NULL; |
1194 return 0; | 1203 return 0; |
1195 } | 1204 } |
1196 | 1205 |
1197 int32_t Channel::GetSendCodec(CodecInst& codec) { | 1206 int32_t Channel::GetSendCodec(CodecInst& codec) { |
1198 auto send_codec = audio_coding_->SendCodec(); | 1207 auto send_codec = codec_manager_.GetCodecInst(); |
1199 if (send_codec) { | 1208 if (send_codec) { |
1200 codec = *send_codec; | 1209 codec = *send_codec; |
1201 return 0; | 1210 return 0; |
1202 } | 1211 } |
1203 return -1; | 1212 return -1; |
1204 } | 1213 } |
1205 | 1214 |
1206 int32_t Channel::GetRecCodec(CodecInst& codec) { | 1215 int32_t Channel::GetRecCodec(CodecInst& codec) { |
1207 return (audio_coding_->ReceiveCodec(&codec)); | 1216 return (audio_coding_->ReceiveCodec(&codec)); |
1208 } | 1217 } |
1209 | 1218 |
1210 int32_t Channel::SetSendCodec(const CodecInst& codec) { | 1219 int32_t Channel::SetSendCodec(const CodecInst& codec) { |
1211 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), | 1220 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), |
1212 "Channel::SetSendCodec()"); | 1221 "Channel::SetSendCodec()"); |
1213 | 1222 |
1214 if (audio_coding_->RegisterSendCodec(codec) != 0) { | 1223 if (!codec_manager_.RegisterEncoder(codec) || |
1224 !codec_manager_.MakeEncoder( | |
1225 &rent_a_codec_, [&](std::unique_ptr<AudioEncoder> new_enc) { | |
1226 audio_coding_->SetEncoder(std::move(new_enc)); | |
1227 })) { | |
1215 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_instanceId, _channelId), | 1228 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_instanceId, _channelId), |
1216 "SetSendCodec() failed to register codec to ACM"); | 1229 "SetSendCodec() failed to register codec to ACM"); |
1217 return -1; | 1230 return -1; |
1218 } | 1231 } |
1219 | 1232 |
1220 if (_rtpRtcpModule->RegisterSendPayload(codec) != 0) { | 1233 if (_rtpRtcpModule->RegisterSendPayload(codec) != 0) { |
1221 _rtpRtcpModule->DeRegisterSendPayload(codec.pltype); | 1234 _rtpRtcpModule->DeRegisterSendPayload(codec.pltype); |
1222 if (_rtpRtcpModule->RegisterSendPayload(codec) != 0) { | 1235 if (_rtpRtcpModule->RegisterSendPayload(codec) != 0) { |
1223 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_instanceId, _channelId), | 1236 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_instanceId, _channelId), |
1224 "SetSendCodec() failed to register codec to" | 1237 "SetSendCodec() failed to register codec to" |
(...skipping 26 matching lines...) Expand all Loading... | |
1251 0) { | 1264 0) { |
1252 assert(false); // This should not happen. | 1265 assert(false); // This should not happen. |
1253 } | 1266 } |
1254 } | 1267 } |
1255 | 1268 |
1256 int32_t Channel::SetVADStatus(bool enableVAD, | 1269 int32_t Channel::SetVADStatus(bool enableVAD, |
1257 ACMVADMode mode, | 1270 ACMVADMode mode, |
1258 bool disableDTX) { | 1271 bool disableDTX) { |
1259 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), | 1272 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), |
1260 "Channel::SetVADStatus(mode=%d)", mode); | 1273 "Channel::SetVADStatus(mode=%d)", mode); |
1261 assert(!(disableDTX && enableVAD)); // disableDTX mode is deprecated. | 1274 if (!codec_manager_.SetVAD(enableVAD, mode) || |
hlundin-webrtc
2016/03/29 20:23:32
Why did the assert have to go? The last parameter
kwiberg-webrtc
2016/03/29 23:25:32
Good question. I remember removing it for a reason
hlundin-webrtc
2016/03/30 08:36:10
Good.
kwiberg-webrtc
2016/03/30 10:53:50
Done.
| |
1262 // To disable VAD, DTX must be disabled too | 1275 !codec_manager_.MakeEncoder( |
1263 disableDTX = ((enableVAD == false) ? true : disableDTX); | 1276 &rent_a_codec_, [&](std::unique_ptr<AudioEncoder> new_enc) { |
1264 if (audio_coding_->SetVAD(!disableDTX, enableVAD, mode) != 0) { | 1277 audio_coding_->SetEncoder(std::move(new_enc)); |
1278 })) { | |
1265 _engineStatisticsPtr->SetLastError(VE_AUDIO_CODING_MODULE_ERROR, | 1279 _engineStatisticsPtr->SetLastError(VE_AUDIO_CODING_MODULE_ERROR, |
1266 kTraceError, | 1280 kTraceError, |
1267 "SetVADStatus() failed to set VAD"); | 1281 "SetVADStatus() failed to set VAD"); |
1268 return -1; | 1282 return -1; |
1269 } | 1283 } |
1270 return 0; | 1284 return 0; |
1271 } | 1285 } |
1272 | 1286 |
1273 int32_t Channel::GetVADStatus(bool& enabledVAD, | 1287 int32_t Channel::GetVADStatus(bool& enabledVAD, |
1274 ACMVADMode& mode, | 1288 ACMVADMode& mode, |
1275 bool& disabledDTX) { | 1289 bool& disabledDTX) { |
1276 if (audio_coding_->VAD(&disabledDTX, &enabledVAD, &mode) != 0) { | 1290 const auto* params = codec_manager_.GetStackParams(); |
1277 _engineStatisticsPtr->SetLastError( | 1291 enabledVAD = params->use_cng; |
1278 VE_AUDIO_CODING_MODULE_ERROR, kTraceError, | 1292 mode = params->vad_mode; |
1279 "GetVADStatus() failed to get VAD status"); | 1293 disabledDTX = !params->use_cng; |
1280 return -1; | |
1281 } | |
1282 disabledDTX = !disabledDTX; | |
1283 return 0; | 1294 return 0; |
1284 } | 1295 } |
1285 | 1296 |
1286 int32_t Channel::SetRecPayloadType(const CodecInst& codec) { | 1297 int32_t Channel::SetRecPayloadType(const CodecInst& codec) { |
1287 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), | 1298 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), |
1288 "Channel::SetRecPayloadType()"); | 1299 "Channel::SetRecPayloadType()"); |
1289 | 1300 |
1290 if (channel_state_.Get().playing) { | 1301 if (channel_state_.Get().playing) { |
1291 _engineStatisticsPtr->SetLastError( | 1302 _engineStatisticsPtr->SetLastError( |
1292 VE_ALREADY_PLAYING, kTraceError, | 1303 VE_ALREADY_PLAYING, kTraceError, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1335 rtp_receiver_->DeRegisterReceivePayload(codec.pltype); | 1346 rtp_receiver_->DeRegisterReceivePayload(codec.pltype); |
1336 if (rtp_receiver_->RegisterReceivePayload( | 1347 if (rtp_receiver_->RegisterReceivePayload( |
1337 codec.plname, codec.pltype, codec.plfreq, codec.channels, | 1348 codec.plname, codec.pltype, codec.plfreq, codec.channels, |
1338 (codec.rate < 0) ? 0 : codec.rate) != 0) { | 1349 (codec.rate < 0) ? 0 : codec.rate) != 0) { |
1339 _engineStatisticsPtr->SetLastError( | 1350 _engineStatisticsPtr->SetLastError( |
1340 VE_RTP_RTCP_MODULE_ERROR, kTraceError, | 1351 VE_RTP_RTCP_MODULE_ERROR, kTraceError, |
1341 "SetRecPayloadType() RTP/RTCP-module registration failed"); | 1352 "SetRecPayloadType() RTP/RTCP-module registration failed"); |
1342 return -1; | 1353 return -1; |
1343 } | 1354 } |
1344 } | 1355 } |
1345 if (audio_coding_->RegisterReceiveCodec(codec) != 0) { | 1356 if (audio_coding_->RegisterReceiveCodec( |
hlundin-webrtc
2016/03/29 20:23:32
One could wonder if there is any valid case for re
kwiberg-webrtc
2016/03/29 23:25:32
I don’t know of a valid case either.
hlundin-webrtc
2016/03/30 08:36:10
Right. You may want to add a TODO that this is ess
kwiberg-webrtc
2016/03/30 10:53:50
Done.
| |
1357 codec, [&] { return rent_a_codec_.RentIsacDecoder(); }) != 0) { | |
1346 audio_coding_->UnregisterReceiveCodec(codec.pltype); | 1358 audio_coding_->UnregisterReceiveCodec(codec.pltype); |
1347 if (audio_coding_->RegisterReceiveCodec(codec) != 0) { | 1359 if (audio_coding_->RegisterReceiveCodec( |
1360 codec, [&] { return rent_a_codec_.RentIsacDecoder(); }) != 0) { | |
1348 _engineStatisticsPtr->SetLastError( | 1361 _engineStatisticsPtr->SetLastError( |
1349 VE_AUDIO_CODING_MODULE_ERROR, kTraceError, | 1362 VE_AUDIO_CODING_MODULE_ERROR, kTraceError, |
1350 "SetRecPayloadType() ACM registration failed - 1"); | 1363 "SetRecPayloadType() ACM registration failed - 1"); |
1351 return -1; | 1364 return -1; |
1352 } | 1365 } |
1353 } | 1366 } |
1354 return 0; | 1367 return 0; |
1355 } | 1368 } |
1356 | 1369 |
1357 int32_t Channel::GetRecPayloadType(CodecInst& codec) { | 1370 int32_t Channel::GetRecPayloadType(CodecInst& codec) { |
(...skipping 26 matching lines...) Expand all Loading... | |
1384 _engineStatisticsPtr->SetLastError( | 1397 _engineStatisticsPtr->SetLastError( |
1385 VE_AUDIO_CODING_MODULE_ERROR, kTraceError, | 1398 VE_AUDIO_CODING_MODULE_ERROR, kTraceError, |
1386 "SetSendCNPayloadType() failed to retrieve default CN codec " | 1399 "SetSendCNPayloadType() failed to retrieve default CN codec " |
1387 "settings"); | 1400 "settings"); |
1388 return -1; | 1401 return -1; |
1389 } | 1402 } |
1390 | 1403 |
1391 // Modify the payload type (must be set to dynamic range) | 1404 // Modify the payload type (must be set to dynamic range) |
1392 codec.pltype = type; | 1405 codec.pltype = type; |
1393 | 1406 |
1394 if (audio_coding_->RegisterSendCodec(codec) != 0) { | 1407 if (!codec_manager_.RegisterEncoder(codec) || |
1408 !codec_manager_.MakeEncoder(&rent_a_codec_, | |
1409 [&](std::unique_ptr<AudioEncoder> enc) { | |
1410 audio_coding_->SetEncoder(std::move(enc)); | |
1411 })) { | |
1395 _engineStatisticsPtr->SetLastError( | 1412 _engineStatisticsPtr->SetLastError( |
1396 VE_AUDIO_CODING_MODULE_ERROR, kTraceError, | 1413 VE_AUDIO_CODING_MODULE_ERROR, kTraceError, |
1397 "SetSendCNPayloadType() failed to register CN to ACM"); | 1414 "SetSendCNPayloadType() failed to register CN to ACM"); |
1398 return -1; | 1415 return -1; |
1399 } | 1416 } |
1400 | 1417 |
1401 if (_rtpRtcpModule->RegisterSendPayload(codec) != 0) { | 1418 if (_rtpRtcpModule->RegisterSendPayload(codec) != 0) { |
1402 _rtpRtcpModule->DeRegisterSendPayload(codec.pltype); | 1419 _rtpRtcpModule->DeRegisterSendPayload(codec.pltype); |
1403 if (_rtpRtcpModule->RegisterSendPayload(codec) != 0) { | 1420 if (_rtpRtcpModule->RegisterSendPayload(codec) != 0) { |
1404 _engineStatisticsPtr->SetLastError( | 1421 _engineStatisticsPtr->SetLastError( |
(...skipping 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2847 } | 2864 } |
2848 | 2865 |
2849 if (SetRedPayloadType(redPayloadtype) < 0) { | 2866 if (SetRedPayloadType(redPayloadtype) < 0) { |
2850 _engineStatisticsPtr->SetLastError( | 2867 _engineStatisticsPtr->SetLastError( |
2851 VE_CODEC_ERROR, kTraceError, | 2868 VE_CODEC_ERROR, kTraceError, |
2852 "SetSecondarySendCodec() Failed to register RED ACM"); | 2869 "SetSecondarySendCodec() Failed to register RED ACM"); |
2853 return -1; | 2870 return -1; |
2854 } | 2871 } |
2855 } | 2872 } |
2856 | 2873 |
2857 if (audio_coding_->SetREDStatus(enable) != 0) { | 2874 if (!codec_manager_.SetCopyRed(enable) || |
2875 !codec_manager_.MakeEncoder( | |
2876 &rent_a_codec_, [&](std::unique_ptr<AudioEncoder> new_enc) { | |
2877 audio_coding_->SetEncoder(std::move(new_enc)); | |
2878 })) { | |
2858 _engineStatisticsPtr->SetLastError( | 2879 _engineStatisticsPtr->SetLastError( |
2859 VE_AUDIO_CODING_MODULE_ERROR, kTraceError, | 2880 VE_AUDIO_CODING_MODULE_ERROR, kTraceError, |
2860 "SetREDStatus() failed to set RED state in the ACM"); | 2881 "SetREDStatus() failed to set RED state in the ACM"); |
2861 return -1; | 2882 return -1; |
2862 } | 2883 } |
2863 return 0; | 2884 return 0; |
2864 } | 2885 } |
2865 | 2886 |
2866 int Channel::GetREDStatus(bool& enabled, int& redPayloadtype) { | 2887 int Channel::GetREDStatus(bool& enabled, int& redPayloadtype) { |
2867 enabled = audio_coding_->REDStatus(); | 2888 enabled = codec_manager_.GetStackParams()->use_red; |
2868 if (enabled) { | 2889 if (enabled) { |
2869 int8_t payloadType = 0; | 2890 int8_t payloadType = 0; |
2870 if (_rtpRtcpModule->SendREDPayloadType(&payloadType) != 0) { | 2891 if (_rtpRtcpModule->SendREDPayloadType(&payloadType) != 0) { |
2871 _engineStatisticsPtr->SetLastError( | 2892 _engineStatisticsPtr->SetLastError( |
2872 VE_RTP_RTCP_MODULE_ERROR, kTraceError, | 2893 VE_RTP_RTCP_MODULE_ERROR, kTraceError, |
2873 "GetREDStatus() failed to retrieve RED PT from RTP/RTCP " | 2894 "GetREDStatus() failed to retrieve RED PT from RTP/RTCP " |
2874 "module"); | 2895 "module"); |
2875 return -1; | 2896 return -1; |
2876 } | 2897 } |
2877 redPayloadtype = payloadType; | 2898 redPayloadtype = payloadType; |
2878 return 0; | 2899 return 0; |
2879 } | 2900 } |
2880 return 0; | 2901 return 0; |
2881 } | 2902 } |
2882 | 2903 |
2883 int Channel::SetCodecFECStatus(bool enable) { | 2904 int Channel::SetCodecFECStatus(bool enable) { |
2884 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), | 2905 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), |
2885 "Channel::SetCodecFECStatus()"); | 2906 "Channel::SetCodecFECStatus()"); |
2886 | 2907 |
2887 if (audio_coding_->SetCodecFEC(enable) != 0) { | 2908 if (!codec_manager_.SetCodecFEC(enable) || |
2909 !codec_manager_.MakeEncoder( | |
2910 &rent_a_codec_, [&](std::unique_ptr<AudioEncoder> new_enc) { | |
2911 audio_coding_->SetEncoder(std::move(new_enc)); | |
2912 })) { | |
2888 _engineStatisticsPtr->SetLastError( | 2913 _engineStatisticsPtr->SetLastError( |
2889 VE_AUDIO_CODING_MODULE_ERROR, kTraceError, | 2914 VE_AUDIO_CODING_MODULE_ERROR, kTraceError, |
2890 "SetCodecFECStatus() failed to set FEC state"); | 2915 "SetCodecFECStatus() failed to set FEC state"); |
2891 return -1; | 2916 return -1; |
2892 } | 2917 } |
2893 return 0; | 2918 return 0; |
2894 } | 2919 } |
2895 | 2920 |
2896 bool Channel::GetCodecFECStatus() { | 2921 bool Channel::GetCodecFECStatus() { |
2897 bool enabled = audio_coding_->CodecFEC(); | 2922 return codec_manager_.GetStackParams()->use_codec_fec; |
2898 return enabled; | |
2899 } | 2923 } |
2900 | 2924 |
2901 void Channel::SetNACKStatus(bool enable, int maxNumberOfPackets) { | 2925 void Channel::SetNACKStatus(bool enable, int maxNumberOfPackets) { |
2902 // None of these functions can fail. | 2926 // None of these functions can fail. |
2903 // If pacing is enabled we always store packets. | 2927 // If pacing is enabled we always store packets. |
2904 if (!pacing_enabled_) | 2928 if (!pacing_enabled_) |
2905 _rtpRtcpModule->SetStorePacketsStatus(enable, maxNumberOfPackets); | 2929 _rtpRtcpModule->SetStorePacketsStatus(enable, maxNumberOfPackets); |
2906 rtp_receive_statistics_->SetMaxReorderingThreshold(maxNumberOfPackets); | 2930 rtp_receive_statistics_->SetMaxReorderingThreshold(maxNumberOfPackets); |
2907 rtp_receiver_->SetNACKStatus(enable ? kNackRtcp : kNackOff); | 2931 rtp_receiver_->SetNACKStatus(enable ? kNackRtcp : kNackOff); |
2908 if (enable) | 2932 if (enable) |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3430 } | 3454 } |
3431 | 3455 |
3432 if (!found_red) { | 3456 if (!found_red) { |
3433 _engineStatisticsPtr->SetLastError( | 3457 _engineStatisticsPtr->SetLastError( |
3434 VE_CODEC_ERROR, kTraceError, | 3458 VE_CODEC_ERROR, kTraceError, |
3435 "SetRedPayloadType() RED is not supported"); | 3459 "SetRedPayloadType() RED is not supported"); |
3436 return -1; | 3460 return -1; |
3437 } | 3461 } |
3438 | 3462 |
3439 codec.pltype = red_payload_type; | 3463 codec.pltype = red_payload_type; |
3440 if (audio_coding_->RegisterSendCodec(codec) < 0) { | 3464 if (!codec_manager_.RegisterEncoder(codec) || |
3465 !codec_manager_.MakeEncoder( | |
3466 &rent_a_codec_, [&](std::unique_ptr<AudioEncoder> new_enc) { | |
3467 audio_coding_->SetEncoder(std::move(new_enc)); | |
3468 })) { | |
3441 _engineStatisticsPtr->SetLastError( | 3469 _engineStatisticsPtr->SetLastError( |
3442 VE_AUDIO_CODING_MODULE_ERROR, kTraceError, | 3470 VE_AUDIO_CODING_MODULE_ERROR, kTraceError, |
3443 "SetRedPayloadType() RED registration in ACM module failed"); | 3471 "SetRedPayloadType() RED registration in ACM module failed"); |
3444 return -1; | 3472 return -1; |
3445 } | 3473 } |
3446 | 3474 |
3447 if (_rtpRtcpModule->SetSendREDPayloadType(red_payload_type) != 0) { | 3475 if (_rtpRtcpModule->SetSendREDPayloadType(red_payload_type) != 0) { |
3448 _engineStatisticsPtr->SetLastError( | 3476 _engineStatisticsPtr->SetLastError( |
3449 VE_RTP_RTCP_MODULE_ERROR, kTraceError, | 3477 VE_RTP_RTCP_MODULE_ERROR, kTraceError, |
3450 "SetRedPayloadType() RED registration in RTP/RTCP module failed"); | 3478 "SetRedPayloadType() RED registration in RTP/RTCP module failed"); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3529 int64_t min_rtt = 0; | 3557 int64_t min_rtt = 0; |
3530 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != | 3558 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != |
3531 0) { | 3559 0) { |
3532 return 0; | 3560 return 0; |
3533 } | 3561 } |
3534 return rtt; | 3562 return rtt; |
3535 } | 3563 } |
3536 | 3564 |
3537 } // namespace voe | 3565 } // namespace voe |
3538 } // namespace webrtc | 3566 } // namespace webrtc |
OLD | NEW |