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

Side by Side Diff: content/browser/renderer_host/media/web_contents_video_capture_device.h

Issue 13956003: Tab capture: do 200 rendundant captures of static content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Self-review fixes. Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/renderer_host/media/web_contents_video_capture_device.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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_WEB_CONTENTS_VIDEO_CAPTURE_DEVICE_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_WEB_CONTENTS_VIDEO_CAPTURE_DEVICE_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_WEB_CONTENTS_VIDEO_CAPTURE_DEVICE_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_WEB_CONTENTS_VIDEO_CAPTURE_DEVICE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 Name device_name_; 67 Name device_name_;
68 const scoped_ptr<Impl> impl_; 68 const scoped_ptr<Impl> impl_;
69 69
70 DISALLOW_COPY_AND_ASSIGN(WebContentsVideoCaptureDevice); 70 DISALLOW_COPY_AND_ASSIGN(WebContentsVideoCaptureDevice);
71 }; 71 };
72 72
73 // Filters a sequence of events to achieve a target frequency. 73 // Filters a sequence of events to achieve a target frequency.
74 class CONTENT_EXPORT SmoothEventSampler { 74 class CONTENT_EXPORT SmoothEventSampler {
75 public: 75 public:
76 explicit SmoothEventSampler(base::TimeDelta capture_period, 76 explicit SmoothEventSampler(base::TimeDelta capture_period,
77 bool events_are_reliable); 77 bool events_are_reliable,
78 int redundant_capture_goal);
78 79
79 // Add a new event to the event history, and return whether it ought to be 80 // Add a new event to the event history, and return whether it ought to be
80 // sampled per to the sampling frequency limit. Even if this method returns 81 // sampled per to the sampling frequency limit. Even if this method returns
81 // true, the event is not recorded as a sample until RecordSample() is called. 82 // true, the event is not recorded as a sample until RecordSample() is called.
82 bool AddEventAndConsiderSampling(base::Time now); 83 bool AddEventAndConsiderSampling(base::Time now);
83 84
84 // Operates on the last event added by AddEventAndConsiderSampling(), marking 85 // Operates on the last event added by AddEventAndConsiderSampling(), marking
85 // it as sampled. After this point we are current in the stream of events, as 86 // it as sampled. After this point we are current in the stream of events, as
86 // we have sampled the most recent event. 87 // we have sampled the most recent event.
87 void RecordSample(); 88 void RecordSample();
88 89
89 // Returns true if, at time |now|, sampling should occur because too much time 90 // Returns true if, at time |now|, sampling should occur because too much time
90 // will have passed relative to the last event and/or sample. 91 // will have passed relative to the last event and/or sample.
91 bool IsOverdueForSamplingAt(base::Time now) const; 92 bool IsOverdueForSamplingAt(base::Time now) const;
92 93
93 base::Time GetLastSampledEvent(); 94 base::Time GetLastSampledEvent();
94 95
95 private: 96 private:
96 const bool events_are_reliable_; 97 const bool events_are_reliable_;
97 const base::TimeDelta capture_period_; 98 const base::TimeDelta capture_period_;
99 const int redundant_capture_goal_;
98 base::Time current_event_; 100 base::Time current_event_;
99 base::Time last_sample_; 101 base::Time last_sample_;
102 int last_sample_count_;
100 DISALLOW_COPY_AND_ASSIGN(SmoothEventSampler); 103 DISALLOW_COPY_AND_ASSIGN(SmoothEventSampler);
101 }; 104 };
102 105
103 } // namespace content 106 } // namespace content
104 107
105 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_WEB_CONTENTS_VIDEO_CAPTURE_DEVICE _H_ 108 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_WEB_CONTENTS_VIDEO_CAPTURE_DEVICE _H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/media/web_contents_video_capture_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698