Chromium Code Reviews| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 // incoming frames. All methods must be called on a single task queue but it can | 61 // incoming frames. All methods must be called on a single task queue but it can |
| 62 // be created and destroyed on an arbitrary thread. | 62 // be created and destroyed on an arbitrary thread. |
| 63 // OveruseFrameDetector::StartCheckForOveruse must be called to periodically | 63 // OveruseFrameDetector::StartCheckForOveruse must be called to periodically |
| 64 // check for overuse. | 64 // check for overuse. |
| 65 class OveruseFrameDetector { | 65 class OveruseFrameDetector { |
| 66 public: | 66 public: |
| 67 OveruseFrameDetector(const CpuOveruseOptions& options, | 67 OveruseFrameDetector(const CpuOveruseOptions& options, |
| 68 AdaptationObserverInterface* overuse_observer, | 68 AdaptationObserverInterface* overuse_observer, |
| 69 EncodedFrameObserver* encoder_timing_, | 69 EncodedFrameObserver* encoder_timing_, |
| 70 CpuOveruseMetricsObserver* metrics_observer); | 70 CpuOveruseMetricsObserver* metrics_observer); |
| 71 ~OveruseFrameDetector(); | 71 virtual ~OveruseFrameDetector(); |
| 72 | 72 |
| 73 // Start to periodically check for overuse. | 73 // Start to periodically check for overuse. |
| 74 void StartCheckForOveruse(); | 74 void StartCheckForOveruse(); |
| 75 | 75 |
| 76 // StopCheckForOveruse must be called before destruction if | 76 // StopCheckForOveruse must be called before destruction if |
| 77 // StartCheckForOveruse has been called. | 77 // StartCheckForOveruse has been called. |
| 78 void StopCheckForOveruse(); | 78 void StopCheckForOveruse(); |
| 79 | 79 |
| 80 // Defines the current maximum framerate targeted by the capturer. This is | |
| 81 // used to make sure the encode usage percent doesn't drop unduly if the | |
| 82 // capturer has quiet periods (for instance caused by screen capturers with | |
| 83 // variable capture rate depending on content updates), otherwise we might | |
| 84 // experience adaptation toggling. | |
| 85 virtual void OnTargetFramerateUpdated(int framerate_fps); | |
| 86 | |
| 80 // Called for each captured frame. | 87 // Called for each captured frame. |
| 81 void FrameCaptured(const VideoFrame& frame, int64_t time_when_first_seen_us); | 88 void FrameCaptured(const VideoFrame& frame, int64_t time_when_first_seen_us); |
| 82 | 89 |
| 83 // Called for each sent frame. | 90 // Called for each sent frame. |
| 84 void FrameSent(uint32_t timestamp, int64_t time_sent_in_us); | 91 void FrameSent(uint32_t timestamp, int64_t time_sent_in_us); |
| 85 | 92 |
| 86 protected: | 93 protected: |
| 87 void CheckForOveruse(); // Protected for test purposes. | 94 void CheckForOveruse(); // Protected for test purposes. |
| 88 | 95 |
| 89 private: | 96 private: |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 128 CpuOveruseMetricsObserver* const metrics_observer_; | 135 CpuOveruseMetricsObserver* const metrics_observer_; |
| 129 rtc::Optional<CpuOveruseMetrics> metrics_ GUARDED_BY(task_checker_); | 136 rtc::Optional<CpuOveruseMetrics> metrics_ GUARDED_BY(task_checker_); |
| 130 | 137 |
| 131 int64_t num_process_times_ GUARDED_BY(task_checker_); | 138 int64_t num_process_times_ GUARDED_BY(task_checker_); |
| 132 | 139 |
| 133 int64_t last_capture_time_us_ GUARDED_BY(task_checker_); | 140 int64_t last_capture_time_us_ GUARDED_BY(task_checker_); |
| 134 int64_t last_processed_capture_time_us_ GUARDED_BY(task_checker_); | 141 int64_t last_processed_capture_time_us_ GUARDED_BY(task_checker_); |
| 135 | 142 |
| 136 // Number of pixels of last captured frame. | 143 // Number of pixels of last captured frame. |
| 137 int num_pixels_ GUARDED_BY(task_checker_); | 144 int num_pixels_ GUARDED_BY(task_checker_); |
| 145 int framerate_ GUARDED_BY(task_checker_); | |
|
åsapersson
2017/06/13 12:15:09
maybe max_framerate_
sprang_webrtc
2017/06/14 08:39:16
Done.
| |
| 138 int64_t last_overuse_time_ms_ GUARDED_BY(task_checker_); | 146 int64_t last_overuse_time_ms_ GUARDED_BY(task_checker_); |
| 139 int checks_above_threshold_ GUARDED_BY(task_checker_); | 147 int checks_above_threshold_ GUARDED_BY(task_checker_); |
| 140 int num_overuse_detections_ GUARDED_BY(task_checker_); | 148 int num_overuse_detections_ GUARDED_BY(task_checker_); |
| 141 int64_t last_rampup_time_ms_ GUARDED_BY(task_checker_); | 149 int64_t last_rampup_time_ms_ GUARDED_BY(task_checker_); |
| 142 bool in_quick_rampup_ GUARDED_BY(task_checker_); | 150 bool in_quick_rampup_ GUARDED_BY(task_checker_); |
| 143 int current_rampup_delay_ms_ GUARDED_BY(task_checker_); | 151 int current_rampup_delay_ms_ GUARDED_BY(task_checker_); |
| 144 | 152 |
| 145 // TODO(asapersson): Can these be regular members (avoid separate heap | 153 // TODO(asapersson): Can these be regular members (avoid separate heap |
| 146 // allocs)? | 154 // allocs)? |
| 147 const std::unique_ptr<SendProcessingUsage> usage_ GUARDED_BY(task_checker_); | 155 const std::unique_ptr<SendProcessingUsage> usage_ GUARDED_BY(task_checker_); |
| 148 std::list<FrameTiming> frame_timing_ GUARDED_BY(task_checker_); | 156 std::list<FrameTiming> frame_timing_ GUARDED_BY(task_checker_); |
| 149 | 157 |
| 150 RTC_DISALLOW_COPY_AND_ASSIGN(OveruseFrameDetector); | 158 RTC_DISALLOW_COPY_AND_ASSIGN(OveruseFrameDetector); |
| 151 }; | 159 }; |
| 152 | 160 |
| 153 } // namespace webrtc | 161 } // namespace webrtc |
| 154 | 162 |
| 155 #endif // WEBRTC_VIDEO_OVERUSE_FRAME_DETECTOR_H_ | 163 #endif // WEBRTC_VIDEO_OVERUSE_FRAME_DETECTOR_H_ |
| OLD | NEW |