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

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

Issue 2716643002: Add framerate to VideoSinkWants and ability to signal on overuse (Closed)
Patch Set: Comments Created 3 years, 9 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 | « webrtc/video/end_to_end_tests.cc ('k') | webrtc/video/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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // Called for each captured frame. 80 // Called for each captured frame.
81 void FrameCaptured(const VideoFrame& frame, int64_t time_when_first_seen_us); 81 void FrameCaptured(const VideoFrame& frame, int64_t time_when_first_seen_us);
82 82
83 // Called for each sent frame. 83 // Called for each sent frame.
84 void FrameSent(uint32_t timestamp, int64_t time_sent_in_us); 84 void FrameSent(uint32_t timestamp, int64_t time_sent_in_us);
85 85
86 protected: 86 protected:
87 void CheckForOveruse(); // Protected for test purposes. 87 void CheckForOveruse(); // Protected for test purposes.
88 88
89 private: 89 private:
90 class OverdoseInjector;
90 class SendProcessingUsage; 91 class SendProcessingUsage;
91 class CheckOveruseTask; 92 class CheckOveruseTask;
92 struct FrameTiming { 93 struct FrameTiming {
93 FrameTiming(int64_t capture_time_us, uint32_t timestamp, int64_t now) 94 FrameTiming(int64_t capture_time_us, uint32_t timestamp, int64_t now)
94 : capture_time_us(capture_time_us), 95 : capture_time_us(capture_time_us),
95 timestamp(timestamp), 96 timestamp(timestamp),
96 capture_us(now), 97 capture_us(now),
97 last_send_us(-1) {} 98 last_send_us(-1) {}
98 int64_t capture_time_us; 99 int64_t capture_time_us;
99 uint32_t timestamp; 100 uint32_t timestamp;
100 int64_t capture_us; 101 int64_t capture_us;
101 int64_t last_send_us; 102 int64_t last_send_us;
102 }; 103 };
103 104
104 void EncodedFrameTimeMeasured(int encode_duration_ms); 105 void EncodedFrameTimeMeasured(int encode_duration_ms);
105 bool IsOverusing(const CpuOveruseMetrics& metrics); 106 bool IsOverusing(const CpuOveruseMetrics& metrics);
106 bool IsUnderusing(const CpuOveruseMetrics& metrics, int64_t time_now); 107 bool IsUnderusing(const CpuOveruseMetrics& metrics, int64_t time_now);
107 108
108 bool FrameTimeoutDetected(int64_t now) const; 109 bool FrameTimeoutDetected(int64_t now) const;
109 bool FrameSizeChanged(int num_pixels) const; 110 bool FrameSizeChanged(int num_pixels) const;
110 111
111 void ResetAll(int num_pixels); 112 void ResetAll(int num_pixels);
112 113
114 static std::unique_ptr<SendProcessingUsage> CreateSendProcessingUsage(
115 const CpuOveruseOptions& options);
116
113 rtc::SequencedTaskChecker task_checker_; 117 rtc::SequencedTaskChecker task_checker_;
114 // Owned by the task queue from where StartCheckForOveruse is called. 118 // Owned by the task queue from where StartCheckForOveruse is called.
115 CheckOveruseTask* check_overuse_task_; 119 CheckOveruseTask* check_overuse_task_;
116 120
117 const CpuOveruseOptions options_; 121 const CpuOveruseOptions options_;
118 122
119 // Observer getting overuse reports. 123 // Observer getting overuse reports.
120 AdaptationObserverInterface* const observer_; 124 AdaptationObserverInterface* const observer_;
121 EncodedFrameObserver* const encoder_timing_; 125 EncodedFrameObserver* const encoder_timing_;
122 126
(...skipping 19 matching lines...) Expand all
142 // allocs)? 146 // allocs)?
143 const std::unique_ptr<SendProcessingUsage> usage_ GUARDED_BY(task_checker_); 147 const std::unique_ptr<SendProcessingUsage> usage_ GUARDED_BY(task_checker_);
144 std::list<FrameTiming> frame_timing_ GUARDED_BY(task_checker_); 148 std::list<FrameTiming> frame_timing_ GUARDED_BY(task_checker_);
145 149
146 RTC_DISALLOW_COPY_AND_ASSIGN(OveruseFrameDetector); 150 RTC_DISALLOW_COPY_AND_ASSIGN(OveruseFrameDetector);
147 }; 151 };
148 152
149 } // namespace webrtc 153 } // namespace webrtc
150 154
151 #endif // WEBRTC_VIDEO_OVERUSE_FRAME_DETECTOR_H_ 155 #endif // WEBRTC_VIDEO_OVERUSE_FRAME_DETECTOR_H_
OLDNEW
« no previous file with comments | « webrtc/video/end_to_end_tests.cc ('k') | webrtc/video/overuse_frame_detector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698