| 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 EXPECT_TRUE(states.encoder->GetDtx()); |
| 180 EXPECT_EQ(AudioEncoderOpus::kAudio, states.encoder->application()); | |
| 181 // Turn off DTX. | 180 // Turn off DTX. |
| 182 EXPECT_TRUE(states.encoder->SetDtx(false)); | 181 EXPECT_TRUE(states.encoder->SetDtx(false)); |
| 182 EXPECT_FALSE(states.encoder->GetDtx()); |
| 183 } | 183 } |
| 184 | 184 |
| 185 TEST(AudioEncoderOpusTest, | 185 TEST(AudioEncoderOpusTest, |
| 186 OnReceivedUplinkBandwidthWithoutAudioNetworkAdaptor) { | 186 OnReceivedUplinkBandwidthWithoutAudioNetworkAdaptor) { |
| 187 auto states = CreateCodec(1); | 187 auto states = CreateCodec(1); |
| 188 // Constants are replicated from audio_states.encoderopus.cc. | 188 // Constants are replicated from audio_states.encoderopus.cc. |
| 189 const int kMinBitrateBps = 6000; | 189 const int kMinBitrateBps = 6000; |
| 190 const int kMaxBitrateBps = 512000; | 190 const int kMaxBitrateBps = 512000; |
| 191 // Set a too low bitrate. | 191 // Set a too low bitrate. |
| 192 states.encoder->OnReceivedUplinkBandwidth(kMinBitrateBps - 1, | 192 states.encoder->OnReceivedUplinkBandwidth(kMinBitrateBps - 1, |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 | 540 |
| 541 // Should encode now. | 541 // Should encode now. |
| 542 states.encoder->Encode(rtp_timestamp, audio_frames->GetNextBlock(), | 542 states.encoder->Encode(rtp_timestamp, audio_frames->GetNextBlock(), |
| 543 &encoded); | 543 &encoded); |
| 544 EXPECT_GT(encoded.size(), 0u); | 544 EXPECT_GT(encoded.size(), 0u); |
| 545 encoded.Clear(); | 545 encoded.Clear(); |
| 546 } | 546 } |
| 547 } | 547 } |
| 548 | 548 |
| 549 } // namespace webrtc | 549 } // namespace webrtc |
| OLD | NEW |