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

Side by Side Diff: media/capture/content/video_capture_oracle.cc

Issue 2518143004: [Mojo Video Capture] Replace RESOURCE_UTILIZATION with interface ReceiverLoadObserver (Closed)
Patch Set: Fix for android-only code Created 4 years 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 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/capture/content/video_capture_oracle.h" 5 #include "media/capture/content/video_capture_oracle.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/numerics/safe_conversions.h" 10 #include "base/numerics/safe_conversions.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 const base::TimeDelta time_since_last_change = 207 const base::TimeDelta time_since_last_change =
208 event_time - buffer_pool_utilization_.reset_time(); 208 event_time - buffer_pool_utilization_.reset_time();
209 if (time_since_last_change.InMicroseconds() >= kMinSizeChangePeriodMicros) 209 if (time_since_last_change.InMicroseconds() >= kMinSizeChangePeriodMicros)
210 CommitCaptureSizeAndReset(GetFrameTimestamp(next_frame_number_ - 1)); 210 CommitCaptureSizeAndReset(GetFrameTimestamp(next_frame_number_ - 1));
211 } 211 }
212 212
213 SetFrameTimestamp(next_frame_number_, event_time); 213 SetFrameTimestamp(next_frame_number_, event_time);
214 return true; 214 return true;
215 } 215 }
216 216
217 int VideoCaptureOracle::RecordCapture(double pool_utilization) { 217 int VideoCaptureOracle::next_frame_number() const {
218 return next_frame_number_;
219 }
220
221 void VideoCaptureOracle::RecordCapture(double pool_utilization) {
218 DCHECK(std::isfinite(pool_utilization) && pool_utilization >= 0.0); 222 DCHECK(std::isfinite(pool_utilization) && pool_utilization >= 0.0);
219 223
220 smoothing_sampler_.RecordSample(); 224 smoothing_sampler_.RecordSample();
221 const base::TimeTicks timestamp = GetFrameTimestamp(next_frame_number_); 225 const base::TimeTicks timestamp = GetFrameTimestamp(next_frame_number_);
222 content_sampler_.RecordSample(timestamp); 226 content_sampler_.RecordSample(timestamp);
223 227
224 if (auto_throttling_enabled_) { 228 if (auto_throttling_enabled_) {
225 buffer_pool_utilization_.Update(pool_utilization, timestamp); 229 buffer_pool_utilization_.Update(pool_utilization, timestamp);
226 AnalyzeAndAdjust(timestamp); 230 AnalyzeAndAdjust(timestamp);
227 } 231 }
228 232
229 num_frames_pending_++; 233 num_frames_pending_++;
230 return next_frame_number_++; 234 next_frame_number_++;
231 } 235 }
232 236
233 void VideoCaptureOracle::RecordWillNotCapture(double pool_utilization) { 237 void VideoCaptureOracle::RecordWillNotCapture(double pool_utilization) {
234 VLOG(1) << "Client rejects proposal to capture frame (at #" 238 VLOG(1) << "Client rejects proposal to capture frame (at #"
235 << next_frame_number_ << ")."; 239 << next_frame_number_ << ").";
236 240
237 if (auto_throttling_enabled_) { 241 if (auto_throttling_enabled_) {
238 DCHECK(std::isfinite(pool_utilization) && pool_utilization >= 0.0); 242 DCHECK(std::isfinite(pool_utilization) && pool_utilization >= 0.0);
239 const base::TimeTicks timestamp = GetFrameTimestamp(next_frame_number_); 243 const base::TimeTicks timestamp = GetFrameTimestamp(next_frame_number_);
240 buffer_pool_utilization_.Update(pool_utilization, timestamp); 244 buffer_pool_utilization_.Update(pool_utilization, timestamp);
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 // Content is not animating, so permit an immediate increase in the capture 552 // Content is not animating, so permit an immediate increase in the capture
549 // area. This allows the system to quickly improve the quality of 553 // area. This allows the system to quickly improve the quality of
550 // non-animating content (frame drops are not much of a concern). 554 // non-animating content (frame drops are not much of a concern).
551 VLOG(2) << "Proposing a " 555 VLOG(2) << "Proposing a "
552 << (100.0 * (increased_area - current_area) / current_area) 556 << (100.0 * (increased_area - current_area) / current_area)
553 << "% increase in capture area for non-animating content. :-)"; 557 << "% increase in capture area for non-animating content. :-)";
554 return increased_area; 558 return increased_area;
555 } 559 }
556 560
557 } // namespace media 561 } // namespace media
OLDNEW
« no previous file with comments | « media/capture/content/video_capture_oracle.h ('k') | media/capture/content/video_capture_oracle_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698