| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 // This API test runs through the APIs for all possible valid and invalid | 59 // This API test runs through the APIs for all possible valid and invalid |
| 60 // combinations. | 60 // combinations. |
| 61 | 61 |
| 62 VadInst* handle = WebRtcVad_Create(); | 62 VadInst* handle = WebRtcVad_Create(); |
| 63 int16_t zeros[kMaxFrameLength] = { 0 }; | 63 int16_t zeros[kMaxFrameLength] = { 0 }; |
| 64 | 64 |
| 65 // Construct a speech signal that will trigger the VAD in all modes. It is | 65 // Construct a speech signal that will trigger the VAD in all modes. It is |
| 66 // known that (i * i) will wrap around, but that doesn't matter in this case. | 66 // known that (i * i) will wrap around, but that doesn't matter in this case. |
| 67 int16_t speech[kMaxFrameLength]; | 67 int16_t speech[kMaxFrameLength]; |
| 68 for (int16_t i = 0; i < kMaxFrameLength; i++) { | 68 for (int16_t i = 0; i < kMaxFrameLength; i++) { |
| 69 speech[i] = (i * i); | 69 speech[i] = static_cast<int16_t>(i * i); |
| 70 } | 70 } |
| 71 | 71 |
| 72 // nullptr instance tests | 72 // nullptr instance tests |
| 73 EXPECT_EQ(-1, WebRtcVad_Init(nullptr)); | 73 EXPECT_EQ(-1, WebRtcVad_Init(nullptr)); |
| 74 EXPECT_EQ(-1, WebRtcVad_set_mode(nullptr, kModes[0])); | 74 EXPECT_EQ(-1, WebRtcVad_set_mode(nullptr, kModes[0])); |
| 75 EXPECT_EQ(-1, | 75 EXPECT_EQ(-1, |
| 76 WebRtcVad_Process(nullptr, kRates[0], speech, kFrameLengths[0])); | 76 WebRtcVad_Process(nullptr, kRates[0], speech, kFrameLengths[0])); |
| 77 | 77 |
| 78 // WebRtcVad_Create() | 78 // WebRtcVad_Create() |
| 79 CHECK(handle); | 79 CHECK(handle); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 EXPECT_EQ(-1, WebRtcVad_ValidRateAndFrameLength(kRates[i], | 147 EXPECT_EQ(-1, WebRtcVad_ValidRateAndFrameLength(kRates[i], |
| 148 kFrameLengths[j])); | 148 kFrameLengths[j])); |
| 149 } | 149 } |
| 150 } | 150 } |
| 151 } | 151 } |
| 152 } | 152 } |
| 153 | 153 |
| 154 // TODO(bjornv): Add a process test, run on file. | 154 // TODO(bjornv): Add a process test, run on file. |
| 155 | 155 |
| 156 } // namespace | 156 } // namespace |
| OLD | NEW |