| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  *  Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2  *  Copyright (c) 2015 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 142       return 0; | 142       return 0; | 
| 143     case RentACodec::RegistrationResult::kBadFreq: | 143     case RentACodec::RegistrationResult::kBadFreq: | 
| 144       WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, dummy_id, | 144       WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, dummy_id, | 
| 145                    "RegisterSendCodec() failed, invalid frequency for CNG" | 145                    "RegisterSendCodec() failed, invalid frequency for CNG" | 
| 146                    " registration"); | 146                    " registration"); | 
| 147       return -1; | 147       return -1; | 
| 148     case RentACodec::RegistrationResult::kSkip: | 148     case RentACodec::RegistrationResult::kSkip: | 
| 149       break; | 149       break; | 
| 150   } | 150   } | 
| 151 | 151 | 
| 152   // Set Stereo, and make sure VAD and DTX is turned off. |  | 
| 153   if (send_codec.channels != 1) { |  | 
| 154     if (codec_stack_params_.use_cng) { |  | 
| 155       WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, dummy_id, |  | 
| 156                    "VAD/DTX is turned off, not supported when sending stereo."); |  | 
| 157     } |  | 
| 158     codec_stack_params_.use_cng = false; |  | 
| 159   } |  | 
| 160 |  | 
| 161   // Check if the codec is already registered as send codec. | 152   // Check if the codec is already registered as send codec. | 
| 162   bool new_codec = true; | 153   bool new_codec = true; | 
| 163   if (CurrentEncoder()) { | 154   if (CurrentEncoder()) { | 
| 164     auto new_codec_id = RentACodec::CodecIdByInst(send_codec_inst_); | 155     auto new_codec_id = RentACodec::CodecIdByInst(send_codec_inst_); | 
| 165     RTC_DCHECK(new_codec_id); | 156     RTC_DCHECK(new_codec_id); | 
| 166     auto old_codec_id = RentACodec::CodecIdFromIndex(codec_id); | 157     auto old_codec_id = RentACodec::CodecIdFromIndex(codec_id); | 
| 167     new_codec = !old_codec_id || *new_codec_id != *old_codec_id; | 158     new_codec = !old_codec_id || *new_codec_id != *old_codec_id; | 
| 168   } | 159   } | 
| 169 | 160 | 
| 170   encoder_is_opus_ = IsOpus(send_codec); | 161   encoder_is_opus_ = IsOpus(send_codec); | 
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 224   send_codec_inst_.plfreq = external_speech_encoder->SampleRateHz(); | 215   send_codec_inst_.plfreq = external_speech_encoder->SampleRateHz(); | 
| 225   send_codec_inst_.pacsize = rtc::CheckedDivExact( | 216   send_codec_inst_.pacsize = rtc::CheckedDivExact( | 
| 226       static_cast<int>(external_speech_encoder->Max10MsFramesInAPacket() * | 217       static_cast<int>(external_speech_encoder->Max10MsFramesInAPacket() * | 
| 227                        send_codec_inst_.plfreq), | 218                        send_codec_inst_.plfreq), | 
| 228       100); | 219       100); | 
| 229   send_codec_inst_.pltype = -1;  // Not valid. | 220   send_codec_inst_.pltype = -1;  // Not valid. | 
| 230   send_codec_inst_.rate = -1;    // Not valid. | 221   send_codec_inst_.rate = -1;    // Not valid. | 
| 231   static const char kName[] = "external"; | 222   static const char kName[] = "external"; | 
| 232   memcpy(send_codec_inst_.plname, kName, sizeof(kName)); | 223   memcpy(send_codec_inst_.plname, kName, sizeof(kName)); | 
| 233 | 224 | 
| 234   if (send_codec_inst_.channels != 1) |  | 
| 235     codec_stack_params_.use_cng = false; |  | 
| 236   if (codec_stack_params_.use_codec_fec) { | 225   if (codec_stack_params_.use_codec_fec) { | 
| 237     // Switch FEC on. On failure, remember that FEC is off. | 226     // Switch FEC on. On failure, remember that FEC is off. | 
| 238     if (!external_speech_encoder->SetFec(true)) | 227     if (!external_speech_encoder->SetFec(true)) | 
| 239       codec_stack_params_.use_codec_fec = false; | 228       codec_stack_params_.use_codec_fec = false; | 
| 240   } else { | 229   } else { | 
| 241     // Switch FEC off. This shouldn't fail. | 230     // Switch FEC off. This shouldn't fail. | 
| 242     const bool success = external_speech_encoder->SetFec(false); | 231     const bool success = external_speech_encoder->SetFec(false); | 
| 243     RTC_DCHECK(success); | 232     RTC_DCHECK(success); | 
| 244   } | 233   } | 
| 245 | 234 | 
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 333       CurrentEncoder()->SetFec(enable_codec_fec) && enable_codec_fec; | 322       CurrentEncoder()->SetFec(enable_codec_fec) && enable_codec_fec; | 
| 334   return codec_stack_params_.use_codec_fec == enable_codec_fec ? 0 : -1; | 323   return codec_stack_params_.use_codec_fec == enable_codec_fec ? 0 : -1; | 
| 335 } | 324 } | 
| 336 | 325 | 
| 337 AudioDecoder* CodecManager::GetAudioDecoder(const CodecInst& codec) { | 326 AudioDecoder* CodecManager::GetAudioDecoder(const CodecInst& codec) { | 
| 338   return IsIsac(codec) ? rent_a_codec_.RentIsacDecoder() : nullptr; | 327   return IsIsac(codec) ? rent_a_codec_.RentIsacDecoder() : nullptr; | 
| 339 } | 328 } | 
| 340 | 329 | 
| 341 }  // namespace acm2 | 330 }  // namespace acm2 | 
| 342 }  // namespace webrtc | 331 }  // namespace webrtc | 
| OLD | NEW | 
|---|