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 20 matching lines...) Expand all Loading... |
31 virtual void OveruseDetected() = 0; | 31 virtual void OveruseDetected() = 0; |
32 // Called periodically when the system is not overused any longer. | 32 // Called periodically when the system is not overused any longer. |
33 virtual void NormalUsage() = 0; | 33 virtual void NormalUsage() = 0; |
34 | 34 |
35 protected: | 35 protected: |
36 virtual ~CpuOveruseObserver() {} | 36 virtual ~CpuOveruseObserver() {} |
37 }; | 37 }; |
38 | 38 |
39 struct CpuOveruseOptions { | 39 struct CpuOveruseOptions { |
40 CpuOveruseOptions() | 40 CpuOveruseOptions() |
41 : enable_encode_usage_method(true), | 41 : low_encode_usage_threshold_percent(55), |
42 low_encode_usage_threshold_percent(55), | |
43 high_encode_usage_threshold_percent(85), | 42 high_encode_usage_threshold_percent(85), |
44 enable_extended_processing_usage(true), | |
45 frame_timeout_interval_ms(1500), | 43 frame_timeout_interval_ms(1500), |
46 min_frame_samples(120), | 44 min_frame_samples(120), |
47 min_process_count(3), | 45 min_process_count(3), |
48 high_threshold_consecutive_count(2) {} | 46 high_threshold_consecutive_count(2) {} |
49 | 47 |
50 // Method based on encode time of frames. | |
51 bool enable_encode_usage_method; | |
52 int low_encode_usage_threshold_percent; // Threshold for triggering underuse. | 48 int low_encode_usage_threshold_percent; // Threshold for triggering underuse. |
53 int high_encode_usage_threshold_percent; // Threshold for triggering overuse. | 49 int high_encode_usage_threshold_percent; // Threshold for triggering overuse. |
54 bool enable_extended_processing_usage; // Include a larger time span (in | |
55 // addition to encode time) for | |
56 // measuring the processing time of a | |
57 // frame. | |
58 // General settings. | 50 // General settings. |
59 int frame_timeout_interval_ms; // The maximum allowed interval between two | 51 int frame_timeout_interval_ms; // The maximum allowed interval between two |
60 // frames before resetting estimations. | 52 // frames before resetting estimations. |
61 int min_frame_samples; // The minimum number of frames required. | 53 int min_frame_samples; // The minimum number of frames required. |
62 int min_process_count; // The number of initial process times required before | 54 int min_process_count; // The number of initial process times required before |
63 // triggering an overuse/underuse. | 55 // triggering an overuse/underuse. |
64 int high_threshold_consecutive_count; // The number of consecutive checks | 56 int high_threshold_consecutive_count; // The number of consecutive checks |
65 // above the high threshold before | 57 // above the high threshold before |
66 // triggering an overuse. | 58 // triggering an overuse. |
67 }; | 59 }; |
(...skipping 18 matching lines...) Expand all Loading... |
86 public: | 78 public: |
87 OveruseFrameDetector(Clock* clock, | 79 OveruseFrameDetector(Clock* clock, |
88 const CpuOveruseOptions& options, | 80 const CpuOveruseOptions& options, |
89 CpuOveruseObserver* overuse_observer, | 81 CpuOveruseObserver* overuse_observer, |
90 CpuOveruseMetricsObserver* metrics_observer); | 82 CpuOveruseMetricsObserver* metrics_observer); |
91 ~OveruseFrameDetector(); | 83 ~OveruseFrameDetector(); |
92 | 84 |
93 // Called for each captured frame. | 85 // Called for each captured frame. |
94 void FrameCaptured(int width, int height, int64_t capture_time_ms); | 86 void FrameCaptured(int width, int height, int64_t capture_time_ms); |
95 | 87 |
96 // Called for each encoded frame. | |
97 void FrameEncoded(int encode_time_ms); | |
98 | |
99 // Called for each sent frame. | 88 // Called for each sent frame. |
100 void FrameSent(int64_t capture_time_ms); | 89 void FrameSent(int64_t capture_time_ms); |
101 | 90 |
102 // Only public for testing. | 91 // Only public for testing. |
103 int LastProcessingTimeMs() const; | 92 int LastProcessingTimeMs() const; |
104 int FramesInQueue() const; | 93 int FramesInQueue() const; |
105 | 94 |
106 // Implements Module. | 95 // Implements Module. |
107 int64_t TimeUntilNextProcess() override; | 96 int64_t TimeUntilNextProcess() override; |
108 int32_t Process() override; | 97 int32_t Process() override; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 const rtc::scoped_ptr<FrameQueue> frame_queue_ GUARDED_BY(crit_); | 155 const rtc::scoped_ptr<FrameQueue> frame_queue_ GUARDED_BY(crit_); |
167 | 156 |
168 rtc::ThreadChecker processing_thread_; | 157 rtc::ThreadChecker processing_thread_; |
169 | 158 |
170 RTC_DISALLOW_COPY_AND_ASSIGN(OveruseFrameDetector); | 159 RTC_DISALLOW_COPY_AND_ASSIGN(OveruseFrameDetector); |
171 }; | 160 }; |
172 | 161 |
173 } // namespace webrtc | 162 } // namespace webrtc |
174 | 163 |
175 #endif // WEBRTC_VIDEO_OVERUSE_FRAME_DETECTOR_H_ | 164 #endif // WEBRTC_VIDEO_OVERUSE_FRAME_DETECTOR_H_ |
OLD | NEW |