OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 RTC_CHECK_EQ(0, WebRtcOpus_SetBitRate(inst_, config_.GetBitrateBps())); | 484 RTC_CHECK_EQ(0, WebRtcOpus_SetBitRate(inst_, config_.GetBitrateBps())); |
485 const auto new_complexity = config_.GetNewComplexity(); | 485 const auto new_complexity = config_.GetNewComplexity(); |
486 if (new_complexity && complexity_ != *new_complexity) { | 486 if (new_complexity && complexity_ != *new_complexity) { |
487 complexity_ = *new_complexity; | 487 complexity_ = *new_complexity; |
488 RTC_CHECK_EQ(0, WebRtcOpus_SetComplexity(inst_, complexity_)); | 488 RTC_CHECK_EQ(0, WebRtcOpus_SetComplexity(inst_, complexity_)); |
489 } | 489 } |
490 } | 490 } |
491 | 491 |
492 void AudioEncoderOpus::ApplyAudioNetworkAdaptor() { | 492 void AudioEncoderOpus::ApplyAudioNetworkAdaptor() { |
493 auto config = audio_network_adaptor_->GetEncoderRuntimeConfig(); | 493 auto config = audio_network_adaptor_->GetEncoderRuntimeConfig(); |
494 // |audio_network_adaptor_| is supposed to be configured to output all | 494 RTC_DCHECK(!config.frame_length_ms || *config.frame_length_ms == 20 || |
495 // following parameters. | 495 *config.frame_length_ms == 60); |
496 RTC_DCHECK(config.bitrate_bps); | |
497 RTC_DCHECK(config.frame_length_ms); | |
498 RTC_DCHECK(config.uplink_packet_loss_fraction); | |
499 RTC_DCHECK(config.enable_fec); | |
500 RTC_DCHECK(config.enable_dtx); | |
501 RTC_DCHECK(config.num_channels); | |
502 | 496 |
503 RTC_DCHECK(*config.frame_length_ms == 20 || *config.frame_length_ms == 60); | 497 if (config.bitrate_bps) |
504 | 498 SetTargetBitrate(*config.bitrate_bps); |
505 SetTargetBitrate(*config.bitrate_bps); | 499 if (config.frame_length_ms) |
506 SetFrameLength(*config.frame_length_ms); | 500 SetFrameLength(*config.frame_length_ms); |
507 SetFec(*config.enable_fec); | 501 if (config.enable_fec) |
508 SetProjectedPacketLossRate(*config.uplink_packet_loss_fraction); | 502 SetFec(*config.enable_fec); |
509 SetDtx(*config.enable_dtx); | 503 if (config.uplink_packet_loss_fraction) |
510 SetNumChannelsToEncode(*config.num_channels); | 504 SetProjectedPacketLossRate(*config.uplink_packet_loss_fraction); |
| 505 if (config.enable_dtx) |
| 506 SetDtx(*config.enable_dtx); |
| 507 if (config.num_channels) |
| 508 SetNumChannelsToEncode(*config.num_channels); |
511 } | 509 } |
512 | 510 |
513 std::unique_ptr<AudioNetworkAdaptor> | 511 std::unique_ptr<AudioNetworkAdaptor> |
514 AudioEncoderOpus::DefaultAudioNetworkAdaptorCreator( | 512 AudioEncoderOpus::DefaultAudioNetworkAdaptorCreator( |
515 const std::string& config_string, | 513 const std::string& config_string, |
516 const Clock* clock) const { | 514 const Clock* clock) const { |
517 AudioNetworkAdaptorImpl::Config config; | 515 AudioNetworkAdaptorImpl::Config config; |
518 config.clock = clock; | 516 config.clock = clock; |
519 return std::unique_ptr<AudioNetworkAdaptor>(new AudioNetworkAdaptorImpl( | 517 return std::unique_ptr<AudioNetworkAdaptor>(new AudioNetworkAdaptorImpl( |
520 config, ControllerManagerImpl::Create( | 518 config, ControllerManagerImpl::Create( |
521 config_string, NumChannels(), supported_frame_lengths_ms(), | 519 config_string, NumChannels(), supported_frame_lengths_ms(), |
522 num_channels_to_encode_, next_frame_length_ms_, | 520 num_channels_to_encode_, next_frame_length_ms_, |
523 GetTargetBitrate(), config_.fec_enabled, GetDtx(), clock))); | 521 GetTargetBitrate(), config_.fec_enabled, GetDtx(), clock))); |
524 } | 522 } |
525 | 523 |
526 } // namespace webrtc | 524 } // namespace webrtc |
OLD | NEW |