| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 RentACodec::RegisterRedPayloadType(&red_payload_types, ci); | 246 RentACodec::RegisterRedPayloadType(&red_payload_types, ci); |
| 247 } | 247 } |
| 248 } | 248 } |
| 249 | 249 |
| 250 RentACodec::StackParameters::~StackParameters() = default; | 250 RentACodec::StackParameters::~StackParameters() = default; |
| 251 | 251 |
| 252 AudioEncoder* RentACodec::RentEncoderStack(AudioEncoder* speech_encoder, | 252 AudioEncoder* RentACodec::RentEncoderStack(AudioEncoder* speech_encoder, |
| 253 StackParameters* param) { | 253 StackParameters* param) { |
| 254 RTC_DCHECK(speech_encoder); | 254 RTC_DCHECK(speech_encoder); |
| 255 | 255 |
| 256 if (param->use_codec_fec) { |
| 257 // Switch FEC on. On failure, remember that FEC is off. |
| 258 if (!speech_encoder->SetFec(true)) |
| 259 param->use_codec_fec = false; |
| 260 } else { |
| 261 // Switch FEC off. This shouldn't fail. |
| 262 const bool success = speech_encoder->SetFec(false); |
| 263 RTC_DCHECK(success); |
| 264 } |
| 265 |
| 256 auto pt = [&speech_encoder](const std::map<int, int>& m) { | 266 auto pt = [&speech_encoder](const std::map<int, int>& m) { |
| 257 auto it = m.find(speech_encoder->SampleRateHz()); | 267 auto it = m.find(speech_encoder->SampleRateHz()); |
| 258 return it == m.end() ? rtc::Optional<int>() | 268 return it == m.end() ? rtc::Optional<int>() |
| 259 : rtc::Optional<int>(it->second); | 269 : rtc::Optional<int>(it->second); |
| 260 }; | 270 }; |
| 261 auto cng_pt = pt(param->cng_payload_types); | 271 auto cng_pt = pt(param->cng_payload_types); |
| 262 param->use_cng = | 272 param->use_cng = |
| 263 param->use_cng && cng_pt && speech_encoder->NumChannels() == 1; | 273 param->use_cng && cng_pt && speech_encoder->NumChannels() == 1; |
| 264 auto red_pt = pt(param->red_payload_types); | 274 auto red_pt = pt(param->red_payload_types); |
| 265 param->use_red = param->use_red && red_pt; | 275 param->use_red = param->use_red && red_pt; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 287 } | 297 } |
| 288 | 298 |
| 289 AudioDecoder* RentACodec::RentIsacDecoder() { | 299 AudioDecoder* RentACodec::RentIsacDecoder() { |
| 290 if (!isac_decoder_) | 300 if (!isac_decoder_) |
| 291 isac_decoder_ = CreateIsacDecoder(&isac_bandwidth_info_); | 301 isac_decoder_ = CreateIsacDecoder(&isac_bandwidth_info_); |
| 292 return isac_decoder_.get(); | 302 return isac_decoder_.get(); |
| 293 } | 303 } |
| 294 | 304 |
| 295 } // namespace acm2 | 305 } // namespace acm2 |
| 296 } // namespace webrtc | 306 } // namespace webrtc |
| OLD | NEW |