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 #include "webrtc/modules/audio_processing/audio_processing_impl.h" | 10 #include "webrtc/modules/audio_processing/audio_processing_impl.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 int RenderMinusCaptureCounters() const { | 195 int RenderMinusCaptureCounters() const { |
196 return -CaptureMinusRenderCounters(); | 196 return -CaptureMinusRenderCounters(); |
197 } | 197 } |
198 | 198 |
199 bool BothCountersExceedeThreshold(int threshold) const { | 199 bool BothCountersExceedeThreshold(int threshold) const { |
200 rtc::CritScope cs(&crit_); | 200 rtc::CritScope cs(&crit_); |
201 return (render_count_ > threshold && capture_count_ > threshold); | 201 return (render_count_ > threshold && capture_count_ > threshold); |
202 } | 202 } |
203 | 203 |
204 private: | 204 private: |
205 mutable rtc::CriticalSection crit_; | 205 rtc::CriticalSection crit_; |
206 int render_count_ GUARDED_BY(crit_) = 0; | 206 int render_count_ GUARDED_BY(crit_) = 0; |
207 int capture_count_ GUARDED_BY(crit_) = 0; | 207 int capture_count_ GUARDED_BY(crit_) = 0; |
208 }; | 208 }; |
209 | 209 |
210 // Class that protects a flag using a lock. | 210 // Class that protects a flag using a lock. |
211 class LockedFlag { | 211 class LockedFlag { |
212 public: | 212 public: |
213 bool get_flag() const { | 213 bool get_flag() const { |
214 rtc::CritScope cs(&crit_); | 214 rtc::CritScope cs(&crit_); |
215 return flag_; | 215 return flag_; |
216 } | 216 } |
217 | 217 |
218 void set_flag() { | 218 void set_flag() { |
219 rtc::CritScope cs(&crit_); | 219 rtc::CritScope cs(&crit_); |
220 flag_ = true; | 220 flag_ = true; |
221 } | 221 } |
222 | 222 |
223 private: | 223 private: |
224 mutable rtc::CriticalSection crit_; | 224 rtc::CriticalSection crit_; |
225 bool flag_ GUARDED_BY(crit_) = false; | 225 bool flag_ GUARDED_BY(crit_) = false; |
226 }; | 226 }; |
227 | 227 |
228 // Parent class for the thread processors. | 228 // Parent class for the thread processors. |
229 class TimedThreadApiProcessor { | 229 class TimedThreadApiProcessor { |
230 public: | 230 public: |
231 TimedThreadApiProcessor(ProcessorType processor_type, | 231 TimedThreadApiProcessor(ProcessorType processor_type, |
232 Random* rand_gen, | 232 Random* rand_gen, |
233 FrameCounters* shared_counters_state, | 233 FrameCounters* shared_counters_state, |
234 LockedFlag* capture_call_checker, | 234 LockedFlag* capture_call_checker, |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 // Run test and verify that it did not time out. | 715 // Run test and verify that it did not time out. |
716 EXPECT_EQ(kEventSignaled, Run()); | 716 EXPECT_EQ(kEventSignaled, Run()); |
717 } | 717 } |
718 | 718 |
719 INSTANTIATE_TEST_CASE_P( | 719 INSTANTIATE_TEST_CASE_P( |
720 AudioProcessingPerformanceTest, | 720 AudioProcessingPerformanceTest, |
721 CallSimulator, | 721 CallSimulator, |
722 ::testing::ValuesIn(SimulationConfig::GenerateSimulationConfigs())); | 722 ::testing::ValuesIn(SimulationConfig::GenerateSimulationConfigs())); |
723 | 723 |
724 } // namespace webrtc | 724 } // namespace webrtc |
OLD | NEW |