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

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

Issue 2214533002: move //media/capture to //device/capture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 // 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 "device/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"
11 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
12 12
13 namespace media { 13 namespace device {
14 14
15 namespace { 15 namespace {
16 16
17 // When a non-compositor event arrives after animation has halted, this 17 // When a non-compositor event arrives after animation has halted, this
18 // controls how much time must elapse before deciding to allow a capture. 18 // controls how much time must elapse before deciding to allow a capture.
19 const int kAnimationHaltPeriodBeforeOtherSamplingMicros = 250000; 19 const int kAnimationHaltPeriodBeforeOtherSamplingMicros = 250000;
20 20
21 // When estimating frame durations, this is the hard upper-bound on the 21 // When estimating frame durations, this is the hard upper-bound on the
22 // estimate. 22 // estimate.
23 const int kUpperBoundDurationEstimateMicros = 1000000; // 1 second 23 const int kUpperBoundDurationEstimateMicros = 1000000; // 1 second
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // TODO(miu): Patch FeedbackSignalAccumulator reset behavior and remove this 76 // TODO(miu): Patch FeedbackSignalAccumulator reset behavior and remove this
77 // hack. 77 // hack.
78 base::TimeTicks JustAfter(base::TimeTicks t) { 78 base::TimeTicks JustAfter(base::TimeTicks t) {
79 return t + base::TimeDelta::FromMicroseconds(1); 79 return t + base::TimeDelta::FromMicroseconds(1);
80 } 80 }
81 81
82 // Returns true if updates have been accumulated by |accumulator| for a 82 // Returns true if updates have been accumulated by |accumulator| for a
83 // sufficient amount of time and the latest update was fairly recent, relative 83 // sufficient amount of time and the latest update was fairly recent, relative
84 // to |now|. 84 // to |now|.
85 bool HasSufficientRecentFeedback( 85 bool HasSufficientRecentFeedback(
86 const FeedbackSignalAccumulator<base::TimeTicks>& accumulator, 86 const media::FeedbackSignalAccumulator<base::TimeTicks>& accumulator,
87 base::TimeTicks now) { 87 base::TimeTicks now) {
88 const base::TimeDelta amount_of_history = 88 const base::TimeDelta amount_of_history =
89 accumulator.update_time() - accumulator.reset_time(); 89 accumulator.update_time() - accumulator.reset_time();
90 return (amount_of_history.InMicroseconds() >= kMinSizeChangePeriodMicros) && 90 return (amount_of_history.InMicroseconds() >= kMinSizeChangePeriodMicros) &&
91 ((now - accumulator.update_time()).InMicroseconds() <= 91 ((now - accumulator.update_time()).InMicroseconds() <=
92 kMaxTimeSinceLastFeedbackUpdateMicros); 92 kMaxTimeSinceLastFeedbackUpdateMicros);
93 } 93 }
94 94
95 } // anonymous namespace 95 } // anonymous namespace
96 96
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 547
548 // Content is not animating, so permit an immediate increase in the capture 548 // Content is not animating, so permit an immediate increase in the capture
549 // area. This allows the system to quickly improve the quality of 549 // area. This allows the system to quickly improve the quality of
550 // non-animating content (frame drops are not much of a concern). 550 // non-animating content (frame drops are not much of a concern).
551 VLOG(2) << "Proposing a " 551 VLOG(2) << "Proposing a "
552 << (100.0 * (increased_area - current_area) / current_area) 552 << (100.0 * (increased_area - current_area) / current_area)
553 << "% increase in capture area for non-animating content. :-)"; 553 << "% increase in capture area for non-animating content. :-)";
554 return increased_area; 554 return increased_area;
555 } 555 }
556 556
557 } // namespace media 557 } // namespace device
OLDNEW
« no previous file with comments | « device/capture/content/video_capture_oracle.h ('k') | device/capture/content/video_capture_oracle_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698