Chromium Code Reviews| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 config.bitrate_bps = rtc::Optional<int>(kBitrate); | 87 config.bitrate_bps = rtc::Optional<int>(kBitrate); |
| 88 config.frame_length_ms = rtc::Optional<int>(kFrameLength); | 88 config.frame_length_ms = rtc::Optional<int>(kFrameLength); |
| 89 config.enable_fec = rtc::Optional<bool>(kEnableFec); | 89 config.enable_fec = rtc::Optional<bool>(kEnableFec); |
| 90 config.enable_dtx = rtc::Optional<bool>(kEnableDtx); | 90 config.enable_dtx = rtc::Optional<bool>(kEnableDtx); |
| 91 config.num_channels = rtc::Optional<size_t>(kNumChannels); | 91 config.num_channels = rtc::Optional<size_t>(kNumChannels); |
| 92 config.uplink_packet_loss_fraction = | 92 config.uplink_packet_loss_fraction = |
| 93 rtc::Optional<float>(kPacketLossFraction); | 93 rtc::Optional<float>(kPacketLossFraction); |
| 94 return config; | 94 return config; |
| 95 } | 95 } |
| 96 | 96 |
| 97 void CheckEncoderRuntimeConfig( | 97 void CheckEncoderRuntimeConfig( |
|
minyue-webrtc
2016/12/22 14:11:26
I suggest we somehow adding a new feature to this
minyue-webrtc
2016/12/22 16:00:43
Do this
void ApplyEncoderRuntimeConfig(const Audi
| |
| 98 const AudioEncoderOpus* encoder, | 98 const AudioEncoderOpus* encoder, |
| 99 const AudioNetworkAdaptor::EncoderRuntimeConfig& config) { | 99 const AudioNetworkAdaptor::EncoderRuntimeConfig& config) { |
| 100 EXPECT_EQ(*config.bitrate_bps, encoder->GetTargetBitrate()); | 100 EXPECT_EQ(*config.bitrate_bps, encoder->GetTargetBitrate()); |
| 101 EXPECT_EQ(*config.frame_length_ms, encoder->next_frame_length_ms()); | 101 EXPECT_EQ(*config.frame_length_ms, encoder->next_frame_length_ms()); |
| 102 EXPECT_EQ(*config.enable_fec, encoder->fec_enabled()); | 102 EXPECT_EQ(*config.enable_fec, encoder->fec_enabled()); |
| 103 EXPECT_EQ(*config.enable_dtx, encoder->GetDtx()); | 103 EXPECT_EQ(*config.enable_dtx, encoder->GetDtx()); |
| 104 EXPECT_EQ(*config.num_channels, encoder->num_channels_to_encode()); | 104 EXPECT_EQ(*config.num_channels, encoder->num_channels_to_encode()); |
| 105 } | 105 } |
| 106 | 106 |
| 107 } // namespace | 107 } // namespace |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 436 EXPECT_EQ(rtc::Optional<int>(8), config.GetNewComplexity()); | 436 EXPECT_EQ(rtc::Optional<int>(8), config.GetNewComplexity()); |
| 437 | 437 |
| 438 // Bitrate within hysteresis window. Expect empty output. | 438 // Bitrate within hysteresis window. Expect empty output. |
| 439 config.bitrate_bps = rtc::Optional<int>(12500); | 439 config.bitrate_bps = rtc::Optional<int>(12500); |
| 440 EXPECT_EQ(rtc::Optional<int>(), config.GetNewComplexity()); | 440 EXPECT_EQ(rtc::Optional<int>(), config.GetNewComplexity()); |
| 441 | 441 |
| 442 // Bitrate above hysteresis window. Expect lower complexity. | 442 // Bitrate above hysteresis window. Expect lower complexity. |
| 443 config.bitrate_bps = rtc::Optional<int>(14001); | 443 config.bitrate_bps = rtc::Optional<int>(14001); |
| 444 EXPECT_EQ(rtc::Optional<int>(6), config.GetNewComplexity()); | 444 EXPECT_EQ(rtc::Optional<int>(6), config.GetNewComplexity()); |
| 445 } | 445 } |
| 446 | |
| 447 TEST(AudioEncoderOpusTest, ApplyAudioNetworkAdaptorCanHandlerNotDefinedEntrys) { | |
|
minyue-webrtc
2016/12/22 14:11:26
Handler -> Handle
NotDefined -> Empty
Entrys ->
| |
| 448 auto states = CreateCodec(2); | |
| 449 states.encoder->EnableAudioNetworkAdaptor("", nullptr); | |
| 450 | |
| 451 AudioNetworkAdaptor::EncoderRuntimeConfig config; | |
| 452 EXPECT_CALL(**states.mock_audio_network_adaptor, GetEncoderRuntimeConfig()) | |
| 453 .WillOnce(Return(config)); | |
| 454 | |
| 455 // Donne to force a call of ApplyAudioNetworkAdaptor. | |
|
minyue-webrtc
2016/12/22 14:11:26
I suggest remove this comment.
| |
| 456 constexpr size_t kOverhead = 64; | |
| 457 EXPECT_CALL(**states.mock_audio_network_adaptor, SetOverhead(kOverhead)); | |
| 458 states.encoder->OnReceivedOverhead(kOverhead); | |
| 459 } | |
| 460 | |
| 446 } // namespace webrtc | 461 } // namespace webrtc |
| OLD | NEW |