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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 // Trigger a reset again. | 169 // Trigger a reset again. |
| 170 states.encoder->Reset(); | 170 states.encoder->Reset(); |
| 171 // Verify that the mode is still kVoip. | 171 // Verify that the mode is still kVoip. |
| 172 EXPECT_EQ(AudioEncoderOpus::kVoip, states.encoder->application()); | 172 EXPECT_EQ(AudioEncoderOpus::kVoip, states.encoder->application()); |
| 173 } | 173 } |
| 174 | 174 |
| 175 TEST(AudioEncoderOpusTest, ToggleDtx) { | 175 TEST(AudioEncoderOpusTest, ToggleDtx) { |
| 176 auto states = CreateCodec(2); | 176 auto states = CreateCodec(2); |
| 177 // Enable DTX | 177 // Enable DTX |
| 178 EXPECT_TRUE(states.encoder->SetDtx(true)); | 178 EXPECT_TRUE(states.encoder->SetDtx(true)); |
| 179 // Verify that the mode is still kAudio. | 179 // Verify that the mode is still kAudio. |
|
minyue-webrtc
2017/03/30 20:36:17
test kAudio was needed because we used to force kS
minyue-webrtc
2017/03/31 07:49:30
I have made a fix and added you to review. see htt
| |
| 180 EXPECT_EQ(AudioEncoderOpus::kAudio, states.encoder->application()); | 180 EXPECT_EQ(AudioEncoderOpus::kAudio, states.encoder->application()); |
| 181 // Turn off DTX. | 181 // Turn off DTX. |
| 182 EXPECT_TRUE(states.encoder->SetDtx(false)); | 182 EXPECT_TRUE(states.encoder->SetDtx(false)); |
| 183 } | 183 } |
| 184 | 184 |
| 185 TEST(AudioEncoderOpusTest, ToggleCbr) { | |
| 186 auto states = CreateCodec(2); | |
| 187 // Enable CBR | |
| 188 EXPECT_TRUE(states.encoder->SetCbr(true)); | |
| 189 // Verify that the mode is still kAudio. | |
| 190 EXPECT_EQ(AudioEncoderOpus::kAudio, states.encoder->application()); | |
|
minyue-webrtc
2017/03/30 20:36:17
please don't check application here, (see above co
| |
| 191 // Turn off CBR. | |
| 192 EXPECT_TRUE(states.encoder->SetCbr(false)); | |
| 193 } | |
| 194 | |
| 185 TEST(AudioEncoderOpusTest, | 195 TEST(AudioEncoderOpusTest, |
| 186 OnReceivedUplinkBandwidthWithoutAudioNetworkAdaptor) { | 196 OnReceivedUplinkBandwidthWithoutAudioNetworkAdaptor) { |
| 187 auto states = CreateCodec(1); | 197 auto states = CreateCodec(1); |
| 188 // Constants are replicated from audio_states.encoderopus.cc. | 198 // Constants are replicated from audio_states.encoderopus.cc. |
| 189 const int kMinBitrateBps = 6000; | 199 const int kMinBitrateBps = 6000; |
| 190 const int kMaxBitrateBps = 512000; | 200 const int kMaxBitrateBps = 512000; |
| 191 // Set a too low bitrate. | 201 // Set a too low bitrate. |
| 192 states.encoder->OnReceivedUplinkBandwidth(kMinBitrateBps - 1, | 202 states.encoder->OnReceivedUplinkBandwidth(kMinBitrateBps - 1, |
| 193 rtc::Optional<int64_t>()); | 203 rtc::Optional<int64_t>()); |
| 194 EXPECT_EQ(kMinBitrateBps, states.encoder->GetTargetBitrate()); | 204 EXPECT_EQ(kMinBitrateBps, states.encoder->GetTargetBitrate()); |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 540 | 550 |
| 541 // Should encode now. | 551 // Should encode now. |
| 542 states.encoder->Encode(rtp_timestamp, audio_frames->GetNextBlock(), | 552 states.encoder->Encode(rtp_timestamp, audio_frames->GetNextBlock(), |
| 543 &encoded); | 553 &encoded); |
| 544 EXPECT_GT(encoded.size(), 0u); | 554 EXPECT_GT(encoded.size(), 0u); |
| 545 encoded.Clear(); | 555 encoded.Clear(); |
| 546 } | 556 } |
| 547 } | 557 } |
| 548 | 558 |
| 549 } // namespace webrtc | 559 } // namespace webrtc |
| OLD | NEW |