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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 void TestGetSetBandwidthInfo(const int16_t* speech_data, | 104 void TestGetSetBandwidthInfo(const int16_t* speech_data, |
105 int rate_bits_per_second, | 105 int rate_bits_per_second, |
106 int sample_rate_hz, | 106 int sample_rate_hz, |
107 int frame_size_ms) { | 107 int frame_size_ms) { |
108 const int bit_rate = 32000; | 108 const int bit_rate = 32000; |
109 | 109 |
110 // Conjoined encoder/decoder pair: | 110 // Conjoined encoder/decoder pair: |
111 typename T::instance_type* encdec; | 111 typename T::instance_type* encdec; |
112 ASSERT_EQ(0, T::Create(&encdec)); | 112 ASSERT_EQ(0, T::Create(&encdec)); |
113 ASSERT_EQ(0, T::EncoderInit(encdec, adaptive ? 0 : 1)); | 113 ASSERT_EQ(0, T::EncoderInit(encdec, adaptive ? 0 : 1)); |
114 ASSERT_EQ(0, T::DecoderInit(encdec)); | 114 T::DecoderInit(encdec); |
115 ASSERT_EQ(0, T::SetEncSampRate(encdec, sample_rate_hz)); | 115 ASSERT_EQ(0, T::SetEncSampRate(encdec, sample_rate_hz)); |
116 if (adaptive) | 116 if (adaptive) |
117 ASSERT_EQ(0, T::ControlBwe(encdec, bit_rate, frame_size_ms, false)); | 117 ASSERT_EQ(0, T::ControlBwe(encdec, bit_rate, frame_size_ms, false)); |
118 else | 118 else |
119 ASSERT_EQ(0, T::Control(encdec, bit_rate, frame_size_ms)); | 119 ASSERT_EQ(0, T::Control(encdec, bit_rate, frame_size_ms)); |
120 | 120 |
121 // Disjoint encoder/decoder pair: | 121 // Disjoint encoder/decoder pair: |
122 typename T::instance_type* enc; | 122 typename T::instance_type* enc; |
123 ASSERT_EQ(0, T::Create(&enc)); | 123 ASSERT_EQ(0, T::Create(&enc)); |
124 ASSERT_EQ(0, T::EncoderInit(enc, adaptive ? 0 : 1)); | 124 ASSERT_EQ(0, T::EncoderInit(enc, adaptive ? 0 : 1)); |
125 ASSERT_EQ(0, T::SetEncSampRate(enc, sample_rate_hz)); | 125 ASSERT_EQ(0, T::SetEncSampRate(enc, sample_rate_hz)); |
126 if (adaptive) | 126 if (adaptive) |
127 ASSERT_EQ(0, T::ControlBwe(enc, bit_rate, frame_size_ms, false)); | 127 ASSERT_EQ(0, T::ControlBwe(enc, bit_rate, frame_size_ms, false)); |
128 else | 128 else |
129 ASSERT_EQ(0, T::Control(enc, bit_rate, frame_size_ms)); | 129 ASSERT_EQ(0, T::Control(enc, bit_rate, frame_size_ms)); |
130 typename T::instance_type* dec; | 130 typename T::instance_type* dec; |
131 ASSERT_EQ(0, T::Create(&dec)); | 131 ASSERT_EQ(0, T::Create(&dec)); |
132 ASSERT_EQ(0, T::DecoderInit(dec)); | 132 T::DecoderInit(dec); |
133 T::SetInitialBweBottleneck(dec, bit_rate); | 133 T::SetInitialBweBottleneck(dec, bit_rate); |
134 T::SetEncSampRateInDecoder(dec, sample_rate_hz); | 134 T::SetEncSampRateInDecoder(dec, sample_rate_hz); |
135 | 135 |
136 // 0. Get initial BW info from decoder. | 136 // 0. Get initial BW info from decoder. |
137 auto bi = GetBwInfo<T>(dec); | 137 auto bi = GetBwInfo<T>(dec); |
138 | 138 |
139 BoundedCapacityChannel channel1(sample_rate_hz, rate_bits_per_second), | 139 BoundedCapacityChannel channel1(sample_rate_hz, rate_bits_per_second), |
140 channel2(sample_rate_hz, rate_bits_per_second); | 140 channel2(sample_rate_hz, rate_bits_per_second); |
141 | 141 |
142 int elapsed_time_ms = 0; | 142 int elapsed_time_ms = 0; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 for (int frame_size : frame_sizes) | 245 for (int frame_size : frame_sizes) |
246 if (!(sample_rate == 32000 && frame_size == 60)) | 246 if (!(sample_rate == 32000 && frame_size == 60)) |
247 cases.push_back( | 247 cases.push_back( |
248 {type, adaptive, channel_rate, sample_rate, frame_size}); | 248 {type, adaptive, channel_rate, sample_rate, frame_size}); |
249 return cases; | 249 return cases; |
250 } | 250 } |
251 | 251 |
252 INSTANTIATE_TEST_CASE_P(, IsacCommonTest, testing::ValuesIn(TestCases())); | 252 INSTANTIATE_TEST_CASE_P(, IsacCommonTest, testing::ValuesIn(TestCases())); |
253 | 253 |
254 } // namespace webrtc | 254 } // namespace webrtc |
OLD | NEW |