Commit 66afc5e5 authored by Lambros Lambrou's avatar Lambros Lambrou Committed by Commit Bot

[remoting host] Simplify capture scheduling logic

This removes an unnecessary section from
WebrtcFrameSchedulerSimple::ScheduleNextFrame()
to address review comments on
https://chromium-review.googlesource.com/940449
and potentially improves performance and b/w utilization.

Bug: 816727
Change-Id: I76aaf326a48f985880ea7ff4ba4e16cc246862b3
Reviewed-on: https://chromium-review.googlesource.com/942484Reviewed-by: default avatarZijie He <zijiehe@chromium.org>
Commit-Queue: Lambros Lambrou <lambroslambrou@chromium.org>
Cr-Commit-Position: refs/heads/master@{#540276}
parent f7269311
...@@ -252,27 +252,12 @@ void WebrtcFrameSchedulerSimple::ScheduleNextFrame() { ...@@ -252,27 +252,12 @@ void WebrtcFrameSchedulerSimple::ScheduleNextFrame() {
base::TimeTicks target_capture_time; base::TimeTicks target_capture_time;
if (!last_capture_started_time_.is_null()) { if (!last_capture_started_time_.is_null()) {
// We won't start sending the frame until last one has been sent. // Try to set the capture time so that (if the estimated processing time is
// accurate) the new frame is ready to be sent just when the previous frame
// is finished sending.
target_capture_time = pacing_bucket_.GetEmptyTime() - target_capture_time = pacing_bucket_.GetEmptyTime() -
processing_time_estimator_.EstimatedProcessingTime(key_frame_request_); processing_time_estimator_.EstimatedProcessingTime(key_frame_request_);
// We also try to ensure the next frame will reach the client
// |kTargetFrameInterval| after last frame reached.
// The estimated time when last frame reached or will reach the client.
base::TimeTicks estimated_last_frame_reach_time =
pacing_bucket_.GetEmptyTime();
// The cost of next frame, including both the processing time and transit
// time.
base::TimeDelta estimated_next_frame_cost =
processing_time_estimator_.EstimatedProcessingTime(key_frame_request_) +
processing_time_estimator_.EstimatedTransitTime(key_frame_request_);
base::TimeTicks ideal_capture_time =
estimated_last_frame_reach_time +
kTargetFrameInterval -
estimated_next_frame_cost;
target_capture_time = std::max(target_capture_time, ideal_capture_time);
// Ensure that the capture rate is capped by kTargetFrameInterval, to avoid // Ensure that the capture rate is capped by kTargetFrameInterval, to avoid
// excessive CPU usage by the capturer. // excessive CPU usage by the capturer.
target_capture_time = std::max( target_capture_time = std::max(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment