OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 } | 193 } |
194 | 194 |
195 // When Opus is in DTX, it wakes up in a regular basis. It sends two packets, | 195 // When Opus is in DTX, it wakes up in a regular basis. It sends two packets, |
196 // one with an arbitrary size and the other of 1-byte, then stops sending for | 196 // one with an arbitrary size and the other of 1-byte, then stops sending for |
197 // a certain number of frames. | 197 // a certain number of frames. |
198 | 198 |
199 // |max_dtx_frames| is the maximum number of frames Opus can stay in DTX. | 199 // |max_dtx_frames| is the maximum number of frames Opus can stay in DTX. |
200 const int max_dtx_frames = 400 / block_length_ms + 1; | 200 const int max_dtx_frames = 400 / block_length_ms + 1; |
201 | 201 |
202 // We run |kRunTimeMs| milliseconds of pure silence. | 202 // We run |kRunTimeMs| milliseconds of pure silence. |
203 const int kRunTimeMs = 2000; | 203 const int kRunTimeMs = 4500; |
204 | 204 |
205 // We check that, after a |kCheckTimeMs| milliseconds (given that the CNG in | 205 // We check that, after a |kCheckTimeMs| milliseconds (given that the CNG in |
206 // Opus needs time to adapt), the absolute values of DTX decoded signal are | 206 // Opus needs time to adapt), the absolute values of DTX decoded signal are |
207 // bounded by |kOutputValueBound|. | 207 // bounded by |kOutputValueBound|. |
208 const int kCheckTimeMs = 1500; | 208 const int kCheckTimeMs = 4000; |
209 | 209 |
210 #if defined(OPUS_FIXED_POINT) | 210 #if defined(OPUS_FIXED_POINT) |
211 const uint16_t kOutputValueBound = 30; | 211 const uint16_t kOutputValueBound = 20; |
212 #else | 212 #else |
213 const uint16_t kOutputValueBound = 8; | 213 const uint16_t kOutputValueBound = 2; |
214 #endif | 214 #endif |
215 | 215 |
216 int time = 0; | 216 int time = 0; |
217 while (time < kRunTimeMs) { | 217 while (time < kRunTimeMs) { |
218 // DTX mode is maintained for maximum |max_dtx_frames| frames. | 218 // DTX mode is maintained for maximum |max_dtx_frames| frames. |
219 int i = 0; | 219 int i = 0; |
220 for (; i < max_dtx_frames; ++i) { | 220 for (; i < max_dtx_frames; ++i) { |
221 time += block_length_ms; | 221 time += block_length_ms; |
222 EXPECT_EQ(samples, | 222 EXPECT_EQ(samples, |
223 static_cast<size_t>(EncodeDecode( | 223 static_cast<size_t>(EncodeDecode( |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_)); | 667 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_)); |
668 EXPECT_EQ(0, WebRtcOpus_DecoderFree(opus_decoder_)); | 668 EXPECT_EQ(0, WebRtcOpus_DecoderFree(opus_decoder_)); |
669 } | 669 } |
670 | 670 |
671 INSTANTIATE_TEST_CASE_P(VariousMode, | 671 INSTANTIATE_TEST_CASE_P(VariousMode, |
672 OpusTest, | 672 OpusTest, |
673 Combine(Values(1, 2), Values(0, 1))); | 673 Combine(Values(1, 2), Values(0, 1))); |
674 | 674 |
675 | 675 |
676 } // namespace webrtc | 676 } // namespace webrtc |
OLD | NEW |