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 |
11 #include "webrtc/modules/audio_processing/audio_processing_impl.h" | 11 #include "webrtc/modules/audio_processing/audio_processing_impl.h" |
12 | 12 |
13 #include <algorithm> | 13 #include <algorithm> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 #include "webrtc/base/array_view.h" | 17 #include "webrtc/base/array_view.h" |
18 #include "webrtc/base/criticalsection.h" | 18 #include "webrtc/base/criticalsection.h" |
19 #include "webrtc/base/event.h" | 19 #include "webrtc/base/event.h" |
20 #include "webrtc/base/platform_thread.h" | 20 #include "webrtc/base/platform_thread.h" |
| 21 #include "webrtc/base/random.h" |
21 #include "webrtc/config.h" | 22 #include "webrtc/config.h" |
22 #include "webrtc/modules/audio_processing/test/test_utils.h" | 23 #include "webrtc/modules/audio_processing/test/test_utils.h" |
23 #include "webrtc/modules/include/module_common_types.h" | 24 #include "webrtc/modules/include/module_common_types.h" |
24 #include "webrtc/system_wrappers/include/sleep.h" | 25 #include "webrtc/system_wrappers/include/sleep.h" |
25 #include "webrtc/test/random.h" | |
26 | 26 |
27 namespace webrtc { | 27 namespace webrtc { |
28 | 28 |
29 namespace { | 29 namespace { |
30 | 30 |
31 class AudioProcessingImplLockTest; | 31 class AudioProcessingImplLockTest; |
32 | 32 |
33 // Type of the render thread APM API call to use in the test. | 33 // Type of the render thread APM API call to use in the test. |
34 enum class RenderApiImpl { | 34 enum class RenderApiImpl { |
35 ProcessReverseStreamImpl1, | 35 ProcessReverseStreamImpl1, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 return rand_gen_.Rand(max); | 77 return rand_gen_.Rand(max); |
78 } | 78 } |
79 | 79 |
80 float RandFloat() { | 80 float RandFloat() { |
81 rtc::CritScope cs(&crit_); | 81 rtc::CritScope cs(&crit_); |
82 return rand_gen_.Rand<float>(); | 82 return rand_gen_.Rand<float>(); |
83 } | 83 } |
84 | 84 |
85 private: | 85 private: |
86 rtc::CriticalSection crit_; | 86 rtc::CriticalSection crit_; |
87 test::Random rand_gen_ GUARDED_BY(crit_); | 87 Random rand_gen_ GUARDED_BY(crit_); |
88 }; | 88 }; |
89 | 89 |
90 // Variables related to the audio data and formats. | 90 // Variables related to the audio data and formats. |
91 struct AudioFrameData { | 91 struct AudioFrameData { |
92 explicit AudioFrameData(int max_frame_size) { | 92 explicit AudioFrameData(int max_frame_size) { |
93 // Set up the two-dimensional arrays needed for the APM API calls. | 93 // Set up the two-dimensional arrays needed for the APM API calls. |
94 input_framechannels.resize(2 * max_frame_size); | 94 input_framechannels.resize(2 * max_frame_size); |
95 input_frame.resize(2); | 95 input_frame.resize(2); |
96 input_frame[0] = &input_framechannels[0]; | 96 input_frame[0] = &input_framechannels[0]; |
97 input_frame[1] = &input_framechannels[max_frame_size]; | 97 input_frame[1] = &input_framechannels[max_frame_size]; |
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 DISABLED_AudioProcessingImplLockExtensive, | 1124 DISABLED_AudioProcessingImplLockExtensive, |
1125 AudioProcessingImplLockTest, | 1125 AudioProcessingImplLockTest, |
1126 ::testing::ValuesIn(TestConfig::GenerateExtensiveTestConfigs())); | 1126 ::testing::ValuesIn(TestConfig::GenerateExtensiveTestConfigs())); |
1127 | 1127 |
1128 INSTANTIATE_TEST_CASE_P( | 1128 INSTANTIATE_TEST_CASE_P( |
1129 AudioProcessingImplLockBrief, | 1129 AudioProcessingImplLockBrief, |
1130 AudioProcessingImplLockTest, | 1130 AudioProcessingImplLockTest, |
1131 ::testing::ValuesIn(TestConfig::GenerateBriefTestConfigs())); | 1131 ::testing::ValuesIn(TestConfig::GenerateBriefTestConfigs())); |
1132 | 1132 |
1133 } // namespace webrtc | 1133 } // namespace webrtc |
OLD | NEW |