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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 | 201 |
202 // We run |kRunTimeMs| milliseconds of pure silence. | 202 // We run |kRunTimeMs| milliseconds of pure silence. |
203 const int kRunTimeMs = 4500; | 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 = 4000; | 208 const int kCheckTimeMs = 4000; |
209 | 209 |
210 #if defined(OPUS_FIXED_POINT) | 210 #if defined(OPUS_FIXED_POINT) |
211 const uint16_t kOutputValueBound = 20; | 211 // Fixed-point Opus generates a random (comfort) noise, which has a less |
| 212 // predictable value bound than its floating-point Opus. This value depends on |
| 213 // input signal, and the time window for checking the output values (between |
| 214 // |kCheckTimeMs| and |kRunTimeMs|). |
| 215 const uint16_t kOutputValueBound = 30; |
| 216 |
212 #else | 217 #else |
213 const uint16_t kOutputValueBound = 2; | 218 const uint16_t kOutputValueBound = 2; |
214 #endif | 219 #endif |
215 | 220 |
216 int time = 0; | 221 int time = 0; |
217 while (time < kRunTimeMs) { | 222 while (time < kRunTimeMs) { |
218 // DTX mode is maintained for maximum |max_dtx_frames| frames. | 223 // DTX mode is maintained for maximum |max_dtx_frames| frames. |
219 int i = 0; | 224 int i = 0; |
220 for (; i < max_dtx_frames; ++i) { | 225 for (; i < max_dtx_frames; ++i) { |
221 time += block_length_ms; | 226 time += block_length_ms; |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_)); | 672 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_)); |
668 EXPECT_EQ(0, WebRtcOpus_DecoderFree(opus_decoder_)); | 673 EXPECT_EQ(0, WebRtcOpus_DecoderFree(opus_decoder_)); |
669 } | 674 } |
670 | 675 |
671 INSTANTIATE_TEST_CASE_P(VariousMode, | 676 INSTANTIATE_TEST_CASE_P(VariousMode, |
672 OpusTest, | 677 OpusTest, |
673 Combine(Values(1, 2), Values(0, 1))); | 678 Combine(Values(1, 2), Values(0, 1))); |
674 | 679 |
675 | 680 |
676 } // namespace webrtc | 681 } // namespace webrtc |
OLD | NEW |