| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 class NetEqIlbcQualityTest : public NetEqQualityTest { | 44 class NetEqIlbcQualityTest : public NetEqQualityTest { |
| 45 protected: | 45 protected: |
| 46 NetEqIlbcQualityTest() | 46 NetEqIlbcQualityTest() |
| 47 : NetEqQualityTest(FLAGS_frame_size_ms, | 47 : NetEqQualityTest(FLAGS_frame_size_ms, |
| 48 kInputSampleRateKhz, | 48 kInputSampleRateKhz, |
| 49 kOutputSampleRateKhz, | 49 kOutputSampleRateKhz, |
| 50 NetEqDecoder::kDecoderILBC) {} | 50 NetEqDecoder::kDecoderILBC) {} |
| 51 | 51 |
| 52 void SetUp() override { | 52 void SetUp() override { |
| 53 ASSERT_EQ(1u, channels_) << "iLBC supports only mono audio."; | 53 ASSERT_EQ(1u, channels_) << "iLBC supports only mono audio."; |
| 54 AudioEncoderIlbc::Config config; | 54 AudioEncoderIlbcConfig config; |
| 55 config.frame_size_ms = FLAGS_frame_size_ms; | 55 config.frame_size_ms = FLAGS_frame_size_ms; |
| 56 encoder_.reset(new AudioEncoderIlbc(config)); | 56 encoder_.reset(new AudioEncoderIlbcImpl(config, 102)); |
| 57 NetEqQualityTest::SetUp(); | 57 NetEqQualityTest::SetUp(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 int EncodeBlock(int16_t* in_data, | 60 int EncodeBlock(int16_t* in_data, |
| 61 size_t block_size_samples, | 61 size_t block_size_samples, |
| 62 rtc::Buffer* payload, size_t max_bytes) override { | 62 rtc::Buffer* payload, size_t max_bytes) override { |
| 63 const size_t kFrameSizeSamples = 80; // Samples per 10 ms. | 63 const size_t kFrameSizeSamples = 80; // Samples per 10 ms. |
| 64 size_t encoded_samples = 0; | 64 size_t encoded_samples = 0; |
| 65 uint32_t dummy_timestamp = 0; | 65 uint32_t dummy_timestamp = 0; |
| 66 AudioEncoder::EncodedInfo info; | 66 AudioEncoder::EncodedInfo info; |
| 67 do { | 67 do { |
| 68 info = encoder_->Encode(dummy_timestamp, | 68 info = encoder_->Encode(dummy_timestamp, |
| 69 rtc::ArrayView<const int16_t>( | 69 rtc::ArrayView<const int16_t>( |
| 70 in_data + encoded_samples, kFrameSizeSamples), | 70 in_data + encoded_samples, kFrameSizeSamples), |
| 71 payload); | 71 payload); |
| 72 encoded_samples += kFrameSizeSamples; | 72 encoded_samples += kFrameSizeSamples; |
| 73 } while (info.encoded_bytes == 0); | 73 } while (info.encoded_bytes == 0); |
| 74 return rtc::checked_cast<int>(info.encoded_bytes); | 74 return rtc::checked_cast<int>(info.encoded_bytes); |
| 75 } | 75 } |
| 76 | 76 |
| 77 private: | 77 private: |
| 78 std::unique_ptr<AudioEncoderIlbc> encoder_; | 78 std::unique_ptr<AudioEncoderIlbcImpl> encoder_; |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 TEST_F(NetEqIlbcQualityTest, Test) { | 81 TEST_F(NetEqIlbcQualityTest, Test) { |
| 82 Simulate(); | 82 Simulate(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 } // namespace test | 85 } // namespace test |
| 86 } // namespace webrtc | 86 } // namespace webrtc |
| OLD | NEW |