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