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 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 EXPECT_EQ(kMinBitrateBps, encoder_->bitrate_bps()); | |
| 92 // Set a too high bitrate. | |
| 93 encoder_->SetTargetBitrate(kMaxBitrateBps + 1); | |
| 94 EXPECT_EQ(kMaxBitrateBps, encoder_->GetTargetBitrate()); | |
| 95 EXPECT_EQ(kMaxBitrateBps, encoder_->bitrate_bps()); | |
| 96 // Set the minimum rate. | |
| 97 encoder_->SetTargetBitrate(kMinBitrateBps); | |
| 98 EXPECT_EQ(kMinBitrateBps, encoder_->GetTargetBitrate()); | |
| 99 EXPECT_EQ(kMinBitrateBps, encoder_->bitrate_bps()); | |
| 100 // Set the maximum rate. | |
| 101 encoder_->SetTargetBitrate(kMaxBitrateBps); | |
| 102 EXPECT_EQ(kMaxBitrateBps, encoder_->GetTargetBitrate()); | |
| 103 EXPECT_EQ(kMaxBitrateBps, encoder_->bitrate_bps()); | |
| 104 // Set rates from 1000 up to 32000 bps. | |
| 105 for (int rate = 1000; rate <= 32000; rate += 1000) { | |
| 106 encoder_->SetTargetBitrate(rate); | |
| 107 EXPECT_EQ(rate, encoder_->GetTargetBitrate()); | |
| 108 EXPECT_EQ(rate, encoder_->bitrate_bps()); | |
| 109 } | |
|
kwiberg-webrtc
2015/06/17 14:36:31
This test is repetitive now, since GetTargetBitrat
hlundin-webrtc
2015/06/18 08:52:18
Done.
| |
| 110 } | |
| 82 #endif // WEBRTC_CODEC_OPUS | 111 #endif // WEBRTC_CODEC_OPUS |
| 83 | 112 |
| 84 } // namespace acm2 | 113 } // namespace acm2 |
| 85 } // namespace webrtc | 114 } // namespace webrtc |
| OLD | NEW |