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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 TEST_F(AudioEncoderMutableOpusTest, ToggleDtx) { | 73 TEST_F(AudioEncoderMutableOpusTest, ToggleDtx) { |
74 CreateCodec(2); | 74 CreateCodec(2); |
75 // Enable DTX | 75 // Enable DTX |
76 EXPECT_TRUE(encoder_->SetDtx(true)); | 76 EXPECT_TRUE(encoder_->SetDtx(true)); |
77 // Verify that the mode is still kAudio. | 77 // Verify that the mode is still kAudio. |
78 EXPECT_EQ(AudioEncoderOpus::kAudio, encoder_->application()); | 78 EXPECT_EQ(AudioEncoderOpus::kAudio, encoder_->application()); |
79 // Turn off DTX. | 79 // Turn off DTX. |
80 EXPECT_TRUE(encoder_->SetDtx(false)); | 80 EXPECT_TRUE(encoder_->SetDtx(false)); |
81 } | 81 } |
| 82 |
| 83 TEST_F(AudioEncoderMutableOpusTest, SetBitrate) { |
| 84 CreateCodec(1); |
| 85 // Constants are replicated from audio_encoder_opus.cc. |
| 86 const int kMinBitrateBps = 500; |
| 87 const int kMaxBitrateBps = 512000; |
| 88 // Set a too low bitrate. |
| 89 encoder_->SetTargetBitrate(kMinBitrateBps - 1); |
| 90 EXPECT_EQ(kMinBitrateBps, encoder_->GetTargetBitrate()); |
| 91 // Set a too high bitrate. |
| 92 encoder_->SetTargetBitrate(kMaxBitrateBps + 1); |
| 93 EXPECT_EQ(kMaxBitrateBps, encoder_->GetTargetBitrate()); |
| 94 // Set the minimum rate. |
| 95 encoder_->SetTargetBitrate(kMinBitrateBps); |
| 96 EXPECT_EQ(kMinBitrateBps, encoder_->GetTargetBitrate()); |
| 97 // Set the maximum rate. |
| 98 encoder_->SetTargetBitrate(kMaxBitrateBps); |
| 99 EXPECT_EQ(kMaxBitrateBps, encoder_->GetTargetBitrate()); |
| 100 // Set rates from 1000 up to 32000 bps. |
| 101 for (int rate = 1000; rate <= 32000; rate += 1000) { |
| 102 encoder_->SetTargetBitrate(rate); |
| 103 EXPECT_EQ(rate, encoder_->GetTargetBitrate()); |
| 104 } |
| 105 } |
82 #endif // WEBRTC_CODEC_OPUS | 106 #endif // WEBRTC_CODEC_OPUS |
83 | 107 |
84 } // namespace acm2 | 108 } // namespace acm2 |
85 } // namespace webrtc | 109 } // namespace webrtc |
OLD | NEW |