Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(985)

Side by Side Diff: webrtc/video_engine/overuse_frame_detector.h

Issue 1250593002: Remove unused overuse detection metric (capture jitter). (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/video_engine/overuse_frame_detector.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_capture_jitter_method(false), 41 : enable_encode_usage_method(true),
42 low_capture_jitter_threshold_ms(20.0f),
43 high_capture_jitter_threshold_ms(30.0f),
44 enable_encode_usage_method(true),
45 low_encode_usage_threshold_percent(55), 42 low_encode_usage_threshold_percent(55),
46 high_encode_usage_threshold_percent(85), 43 high_encode_usage_threshold_percent(85),
47 low_encode_time_rsd_threshold(-1),
48 high_encode_time_rsd_threshold(-1),
49 enable_extended_processing_usage(true), 44 enable_extended_processing_usage(true),
50 frame_timeout_interval_ms(1500), 45 frame_timeout_interval_ms(1500),
51 min_frame_samples(120), 46 min_frame_samples(120),
52 min_process_count(3), 47 min_process_count(3),
53 high_threshold_consecutive_count(2) {} 48 high_threshold_consecutive_count(2) {}
54 49
55 // Method based on inter-arrival jitter of captured frames.
56 bool enable_capture_jitter_method;
57 float low_capture_jitter_threshold_ms; // Threshold for triggering underuse.
58 float high_capture_jitter_threshold_ms; // Threshold for triggering overuse.
59 // Method based on encode time of frames. 50 // Method based on encode time of frames.
60 bool enable_encode_usage_method; 51 bool enable_encode_usage_method;
61 int low_encode_usage_threshold_percent; // Threshold for triggering underuse. 52 int low_encode_usage_threshold_percent; // Threshold for triggering underuse.
62 int high_encode_usage_threshold_percent; // Threshold for triggering overuse. 53 int high_encode_usage_threshold_percent; // Threshold for triggering overuse.
63 // TODO(asapersson): Remove options, not used.
64 int low_encode_time_rsd_threshold; // Additional threshold for triggering
65 // underuse (used in addition to
66 // threshold above if configured).
67 int high_encode_time_rsd_threshold; // Additional threshold for triggering
68 // overuse (used in addition to
69 // threshold above if configured).
70 bool enable_extended_processing_usage; // Include a larger time span (in 54 bool enable_extended_processing_usage; // Include a larger time span (in
71 // addition to encode time) for 55 // addition to encode time) for
72 // measuring the processing time of a 56 // measuring the processing time of a
73 // frame. 57 // frame.
74 // General settings. 58 // General settings.
75 int frame_timeout_interval_ms; // The maximum allowed interval between two 59 int frame_timeout_interval_ms; // The maximum allowed interval between two
76 // frames before resetting estimations. 60 // frames before resetting estimations.
77 int min_frame_samples; // The minimum number of frames required. 61 int min_frame_samples; // The minimum number of frames required.
78 int min_process_count; // The number of initial process times required before 62 int min_process_count; // The number of initial process times required before
79 // triggering an overuse/underuse. 63 // triggering an overuse/underuse.
80 int high_threshold_consecutive_count; // The number of consecutive checks 64 int high_threshold_consecutive_count; // The number of consecutive checks
81 // above the high threshold before 65 // above the high threshold before
82 // triggering an overuse. 66 // triggering an overuse.
83
84 bool Equals(const CpuOveruseOptions& o) const {
85 return enable_capture_jitter_method == o.enable_capture_jitter_method &&
86 low_capture_jitter_threshold_ms == o.low_capture_jitter_threshold_ms &&
87 high_capture_jitter_threshold_ms ==
88 o.high_capture_jitter_threshold_ms &&
89 enable_encode_usage_method == o.enable_encode_usage_method &&
90 low_encode_usage_threshold_percent ==
91 o.low_encode_usage_threshold_percent &&
92 high_encode_usage_threshold_percent ==
93 o.high_encode_usage_threshold_percent &&
94 low_encode_time_rsd_threshold == o.low_encode_time_rsd_threshold &&
95 high_encode_time_rsd_threshold == o.high_encode_time_rsd_threshold &&
96 enable_extended_processing_usage ==
97 o.enable_extended_processing_usage &&
98 frame_timeout_interval_ms == o.frame_timeout_interval_ms &&
99 min_frame_samples == o.min_frame_samples &&
100 min_process_count == o.min_process_count &&
101 high_threshold_consecutive_count == o.high_threshold_consecutive_count;
102 }
103 }; 67 };
104 68
105 struct CpuOveruseMetrics { 69 struct CpuOveruseMetrics {
106 CpuOveruseMetrics() 70 CpuOveruseMetrics()
107 : capture_jitter_ms(-1), 71 : avg_encode_time_ms(-1),
108 avg_encode_time_ms(-1),
109 encode_usage_percent(-1) {} 72 encode_usage_percent(-1) {}
110 73
111 int capture_jitter_ms; // The current estimated jitter in ms based on
112 // incoming captured frames.
113 int avg_encode_time_ms; // The average encode time in ms. 74 int avg_encode_time_ms; // The average encode time in ms.
114 int encode_usage_percent; // The average encode time divided by the average 75 int encode_usage_percent; // The average encode time divided by the average
115 // time difference between incoming captured frames. 76 // time difference between incoming captured frames.
116 }; 77 };
117 78
118 class CpuOveruseMetricsObserver { 79 class CpuOveruseMetricsObserver {
119 public: 80 public:
120 virtual ~CpuOveruseMetricsObserver() {} 81 virtual ~CpuOveruseMetricsObserver() {}
121 virtual void CpuOveruseMetricsUpdated(const CpuOveruseMetrics& metrics) = 0; 82 virtual void CpuOveruseMetricsUpdated(const CpuOveruseMetrics& metrics) = 0;
122 }; 83 };
123 84
124 // TODO(pbos): Move this somewhere appropriate.
125 class Statistics {
126 public:
127 explicit Statistics(const CpuOveruseOptions& options);
128 85
129 void AddSample(float sample_ms); 86 // Use to detect system overuse based on the send-side processing time of
130 void Reset(); 87 // incoming frames.
131
132 float Mean() const;
133 float StdDev() const;
134 uint64_t Count() const;
135
136 private:
137 float InitialMean() const;
138 float InitialVariance() const;
139
140 float sum_;
141 uint64_t count_;
142 const CpuOveruseOptions options_;
143 rtc::scoped_ptr<rtc::ExpFilter> filtered_samples_;
144 rtc::scoped_ptr<rtc::ExpFilter> filtered_variance_;
145 };
146
147 // Use to detect system overuse based on jitter in incoming frames.
148 class OveruseFrameDetector : public Module { 88 class OveruseFrameDetector : public Module {
149 public: 89 public:
150 OveruseFrameDetector(Clock* clock, 90 OveruseFrameDetector(Clock* clock,
151 const CpuOveruseOptions& options, 91 const CpuOveruseOptions& options,
152 CpuOveruseObserver* overuse_observer, 92 CpuOveruseObserver* overuse_observer,
153 CpuOveruseMetricsObserver* metrics_observer); 93 CpuOveruseMetricsObserver* metrics_observer);
154 ~OveruseFrameDetector(); 94 ~OveruseFrameDetector();
155 95
156 // Called for each captured frame. 96 // Called for each captured frame.
157 void FrameCaptured(int width, int height, int64_t capture_time_ms); 97 void FrameCaptured(int width, int height, int64_t capture_time_ms);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 CpuOveruseObserver* const observer_; 145 CpuOveruseObserver* const observer_;
206 146
207 // Stats metrics. 147 // Stats metrics.
208 CpuOveruseMetricsObserver* const metrics_observer_; 148 CpuOveruseMetricsObserver* const metrics_observer_;
209 CpuOveruseMetrics metrics_ GUARDED_BY(crit_); 149 CpuOveruseMetrics metrics_ GUARDED_BY(crit_);
210 150
211 Clock* const clock_; 151 Clock* const clock_;
212 int64_t next_process_time_; // Only accessed on the processing thread. 152 int64_t next_process_time_; // Only accessed on the processing thread.
213 int64_t num_process_times_ GUARDED_BY(crit_); 153 int64_t num_process_times_ GUARDED_BY(crit_);
214 154
215 Statistics capture_deltas_ GUARDED_BY(crit_);
216 int64_t last_capture_time_ GUARDED_BY(crit_); 155 int64_t last_capture_time_ GUARDED_BY(crit_);
217 156
218 // These six members are only accessed on the processing thread. 157 // These six members are only accessed on the processing thread.
219 int64_t last_overuse_time_; 158 int64_t last_overuse_time_;
220 int checks_above_threshold_; 159 int checks_above_threshold_;
221 int num_overuse_detections_; 160 int num_overuse_detections_;
222 161
223 int64_t last_rampup_time_; 162 int64_t last_rampup_time_;
224 bool in_quick_rampup_; 163 bool in_quick_rampup_;
225 int current_rampup_delay_ms_; 164 int current_rampup_delay_ms_;
(...skipping 12 matching lines...) Expand all
238 int64_t last_sample_time_ms_; // Only accessed by one thread. 177 int64_t last_sample_time_ms_; // Only accessed by one thread.
239 178
240 rtc::ThreadChecker processing_thread_; 179 rtc::ThreadChecker processing_thread_;
241 180
242 DISALLOW_COPY_AND_ASSIGN(OveruseFrameDetector); 181 DISALLOW_COPY_AND_ASSIGN(OveruseFrameDetector);
243 }; 182 };
244 183
245 } // namespace webrtc 184 } // namespace webrtc
246 185
247 #endif // WEBRTC_VIDEO_ENGINE_OVERUSE_FRAME_DETECTOR_H_ 186 #endif // WEBRTC_VIDEO_ENGINE_OVERUSE_FRAME_DETECTOR_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/video_engine/overuse_frame_detector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698