OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 25 matching lines...) Expand all Loading... |
36 static const bool bit_rate_dummy = | 36 static const bool bit_rate_dummy = |
37 RegisterFlagValidator(&FLAGS_bit_rate_kbps, &ValidateBitRate); | 37 RegisterFlagValidator(&FLAGS_bit_rate_kbps, &ValidateBitRate); |
38 | 38 |
39 } // namespace | 39 } // namespace |
40 | 40 |
41 class NetEqIsacQualityTest : public NetEqQualityTest { | 41 class NetEqIsacQualityTest : public NetEqQualityTest { |
42 protected: | 42 protected: |
43 NetEqIsacQualityTest(); | 43 NetEqIsacQualityTest(); |
44 void SetUp() override; | 44 void SetUp() override; |
45 void TearDown() override; | 45 void TearDown() override; |
46 virtual int EncodeBlock(int16_t* in_data, int block_size_samples, | 46 virtual int EncodeBlock(int16_t* in_data, size_t block_size_samples, |
47 uint8_t* payload, int max_bytes); | 47 uint8_t* payload, size_t max_bytes); |
48 private: | 48 private: |
49 ISACFIX_MainStruct* isac_encoder_; | 49 ISACFIX_MainStruct* isac_encoder_; |
50 int bit_rate_kbps_; | 50 int bit_rate_kbps_; |
51 }; | 51 }; |
52 | 52 |
53 NetEqIsacQualityTest::NetEqIsacQualityTest() | 53 NetEqIsacQualityTest::NetEqIsacQualityTest() |
54 : NetEqQualityTest(kIsacBlockDurationMs, | 54 : NetEqQualityTest(kIsacBlockDurationMs, |
55 kIsacInputSamplingKhz, | 55 kIsacInputSamplingKhz, |
56 kIsacOutputSamplingKhz, | 56 kIsacOutputSamplingKhz, |
57 kDecoderISAC), | 57 kDecoderISAC), |
(...skipping 13 matching lines...) Expand all Loading... |
71 NetEqQualityTest::SetUp(); | 71 NetEqQualityTest::SetUp(); |
72 } | 72 } |
73 | 73 |
74 void NetEqIsacQualityTest::TearDown() { | 74 void NetEqIsacQualityTest::TearDown() { |
75 // Free memory. | 75 // Free memory. |
76 EXPECT_EQ(0, WebRtcIsacfix_Free(isac_encoder_)); | 76 EXPECT_EQ(0, WebRtcIsacfix_Free(isac_encoder_)); |
77 NetEqQualityTest::TearDown(); | 77 NetEqQualityTest::TearDown(); |
78 } | 78 } |
79 | 79 |
80 int NetEqIsacQualityTest::EncodeBlock(int16_t* in_data, | 80 int NetEqIsacQualityTest::EncodeBlock(int16_t* in_data, |
81 int block_size_samples, | 81 size_t block_size_samples, |
82 uint8_t* payload, int max_bytes) { | 82 uint8_t* payload, size_t max_bytes) { |
83 // ISAC takes 10 ms for every call. | 83 // ISAC takes 10 ms for every call. |
84 const int subblocks = kIsacBlockDurationMs / 10; | 84 const int subblocks = kIsacBlockDurationMs / 10; |
85 const int subblock_length = 10 * kIsacInputSamplingKhz; | 85 const int subblock_length = 10 * kIsacInputSamplingKhz; |
86 int value = 0; | 86 int value = 0; |
87 | 87 |
88 int pointer = 0; | 88 int pointer = 0; |
89 for (int idx = 0; idx < subblocks; idx++, pointer += subblock_length) { | 89 for (int idx = 0; idx < subblocks; idx++, pointer += subblock_length) { |
90 // The Isac encoder does not perform encoding (and returns 0) until it | 90 // The Isac encoder does not perform encoding (and returns 0) until it |
91 // receives a sequence of sub-blocks that amount to the frame duration. | 91 // receives a sequence of sub-blocks that amount to the frame duration. |
92 EXPECT_EQ(0, value); | 92 EXPECT_EQ(0, value); |
93 value = WebRtcIsacfix_Encode(isac_encoder_, &in_data[pointer], payload); | 93 value = WebRtcIsacfix_Encode(isac_encoder_, &in_data[pointer], payload); |
94 } | 94 } |
95 EXPECT_GT(value, 0); | 95 EXPECT_GT(value, 0); |
96 return value; | 96 return value; |
97 } | 97 } |
98 | 98 |
99 TEST_F(NetEqIsacQualityTest, Test) { | 99 TEST_F(NetEqIsacQualityTest, Test) { |
100 Simulate(); | 100 Simulate(); |
101 } | 101 } |
102 | 102 |
103 } // namespace test | 103 } // namespace test |
104 } // namespace webrtc | 104 } // namespace webrtc |
OLD | NEW |