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

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

Issue 2304363002: Let ViEEncoder express resolution requests as Sinkwants (Closed)
Patch Set: Fix broken test RunOnTqNormalUsage. Created 4 years, 2 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
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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 // Use to detect system overuse based on the send-side processing time of 73 // Use to detect system overuse based on the send-side processing time of
74 // incoming frames. All methods must be called on a single task queue but it can 74 // incoming frames. All methods must be called on a single task queue but it can
75 // be created and destroyed on an arbitrary thread. 75 // be created and destroyed on an arbitrary thread.
76 // OveruseFrameDetector::StartCheckForOveruse must be called to periodically 76 // OveruseFrameDetector::StartCheckForOveruse must be called to periodically
77 // check for overuse. 77 // check for overuse.
78 class OveruseFrameDetector { 78 class OveruseFrameDetector {
79 public: 79 public:
80 OveruseFrameDetector(Clock* clock, 80 OveruseFrameDetector(Clock* clock,
81 const CpuOveruseOptions& options, 81 const CpuOveruseOptions& options,
82 CpuOveruseObserver* overuse_observer, 82 CpuOveruseObserver* overuse_observer,
83 EncodedFrameObserver* encoder_timing_,
84 CpuOveruseMetricsObserver* metrics_observer); 83 CpuOveruseMetricsObserver* metrics_observer);
85 ~OveruseFrameDetector(); 84 ~OveruseFrameDetector();
86 85
87 // Start to periodically check for overuse. 86 // Start to periodically check for overuse.
88 void StartCheckForOveruse(); 87 void StartCheckForOveruse();
89 88
90 // StopCheckForOveruse must be called before destruction if
91 // StartCheckForOveruse has been called.
92 void StopCheckForOveruse();
93
94 // Called for each captured frame. 89 // Called for each captured frame.
95 void FrameCaptured(const VideoFrame& frame, int64_t time_when_first_seen_ms); 90 void FrameCaptured(const VideoFrame& frame, int64_t time_when_first_seen_ms);
96 91
97 // Called for each sent frame. 92 // Called for each sent frame.
98 void FrameSent(uint32_t timestamp, int64_t time_sent_in_ms); 93 void FrameSent(uint32_t timestamp, int64_t time_sent_in_ms);
99 94
100 protected: 95 protected:
101 void CheckForOveruse(); // Protected for test purposes. 96 void CheckForOveruse(); // Protected for test purposes.
102 97
103 private: 98 private:
(...skipping 21 matching lines...) Expand all
125 void ResetAll(int num_pixels); 120 void ResetAll(int num_pixels);
126 121
127 rtc::SequencedTaskChecker task_checker_; 122 rtc::SequencedTaskChecker task_checker_;
128 // Owned by the task queue from where StartCheckForOveruse is called. 123 // Owned by the task queue from where StartCheckForOveruse is called.
129 CheckOveruseTask* check_overuse_task_; 124 CheckOveruseTask* check_overuse_task_;
130 125
131 const CpuOveruseOptions options_; 126 const CpuOveruseOptions options_;
132 127
133 // Observer getting overuse reports. 128 // Observer getting overuse reports.
134 CpuOveruseObserver* const observer_; 129 CpuOveruseObserver* const observer_;
135 EncodedFrameObserver* const encoder_timing_;
136 130
137 // Stats metrics. 131 // Stats metrics.
138 CpuOveruseMetricsObserver* const metrics_observer_; 132 CpuOveruseMetricsObserver* const metrics_observer_;
139 rtc::Optional<CpuOveruseMetrics> metrics_ GUARDED_BY(task_checker_); 133 rtc::Optional<CpuOveruseMetrics> metrics_ GUARDED_BY(task_checker_);
140 Clock* const clock_; 134 Clock* const clock_;
141 135
142 int64_t num_process_times_ GUARDED_BY(task_checker_); 136 int64_t num_process_times_ GUARDED_BY(task_checker_);
143 137
144 int64_t last_capture_time_ms_ GUARDED_BY(task_checker_); 138 int64_t last_capture_time_ms_ GUARDED_BY(task_checker_);
145 int64_t last_processed_capture_time_ms_ GUARDED_BY(task_checker_); 139 int64_t last_processed_capture_time_ms_ GUARDED_BY(task_checker_);
(...skipping 11 matching lines...) Expand all
157 // allocs)? 151 // allocs)?
158 const std::unique_ptr<SendProcessingUsage> usage_ GUARDED_BY(task_checker_); 152 const std::unique_ptr<SendProcessingUsage> usage_ GUARDED_BY(task_checker_);
159 std::list<FrameTiming> frame_timing_ GUARDED_BY(task_checker_); 153 std::list<FrameTiming> frame_timing_ GUARDED_BY(task_checker_);
160 154
161 RTC_DISALLOW_COPY_AND_ASSIGN(OveruseFrameDetector); 155 RTC_DISALLOW_COPY_AND_ASSIGN(OveruseFrameDetector);
162 }; 156 };
163 157
164 } // namespace webrtc 158 } // namespace webrtc
165 159
166 #endif // WEBRTC_VIDEO_OVERUSE_FRAME_DETECTOR_H_ 160 #endif // WEBRTC_VIDEO_OVERUSE_FRAME_DETECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698