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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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. |
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 CBR is on. |
| 190 EXPECT_TRUE(states.encoder->GetCbr()); |
| 191 // Turn off CBR. |
| 192 EXPECT_TRUE(states.encoder->SetCbr(false)); |
| 193 // Verify that CBR is off. |
| 194 EXPECT_FALSE(states.encoder->GetCbr()); |
| 195 } |
| 196 |
185 TEST(AudioEncoderOpusTest, | 197 TEST(AudioEncoderOpusTest, |
186 OnReceivedUplinkBandwidthWithoutAudioNetworkAdaptor) { | 198 OnReceivedUplinkBandwidthWithoutAudioNetworkAdaptor) { |
187 auto states = CreateCodec(1); | 199 auto states = CreateCodec(1); |
188 // Constants are replicated from audio_states.encoderopus.cc. | 200 // Constants are replicated from audio_states.encoderopus.cc. |
189 const int kMinBitrateBps = 6000; | 201 const int kMinBitrateBps = 6000; |
190 const int kMaxBitrateBps = 512000; | 202 const int kMaxBitrateBps = 512000; |
191 // Set a too low bitrate. | 203 // Set a too low bitrate. |
192 states.encoder->OnReceivedUplinkBandwidth(kMinBitrateBps - 1, | 204 states.encoder->OnReceivedUplinkBandwidth(kMinBitrateBps - 1, |
193 rtc::Optional<int64_t>()); | 205 rtc::Optional<int64_t>()); |
194 EXPECT_EQ(kMinBitrateBps, states.encoder->GetTargetBitrate()); | 206 EXPECT_EQ(kMinBitrateBps, states.encoder->GetTargetBitrate()); |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 | 552 |
541 // Should encode now. | 553 // Should encode now. |
542 states.encoder->Encode(rtp_timestamp, audio_frames->GetNextBlock(), | 554 states.encoder->Encode(rtp_timestamp, audio_frames->GetNextBlock(), |
543 &encoded); | 555 &encoded); |
544 EXPECT_GT(encoded.size(), 0u); | 556 EXPECT_GT(encoded.size(), 0u); |
545 encoded.Clear(); | 557 encoded.Clear(); |
546 } | 558 } |
547 } | 559 } |
548 | 560 |
549 } // namespace webrtc | 561 } // namespace webrtc |
OLD | NEW |