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

Side by Side Diff: media/capture/content/thread_safe_capture_oracle.h

Issue 1864813002: Tab/Desktop Capture: Use requests instead of timer-based refreshing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@video_refresh_from_sinks
Patch Set: Fix WCVCD unit tests that test resize policies. Created 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 MEDIA_CAPTURE_CONTENT_THREAD_SAFE_CAPTURE_ORACLE_H_ 5 #ifndef MEDIA_CAPTURE_CONTENT_THREAD_SAFE_CAPTURE_ORACLE_H_
6 #define MEDIA_CAPTURE_CONTENT_THREAD_SAFE_CAPTURE_ORACLE_H_ 6 #define MEDIA_CAPTURE_CONTENT_THREAD_SAFE_CAPTURE_ORACLE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 24 matching lines...) Expand all
35 bool enable_auto_throttling); 35 bool enable_auto_throttling);
36 36
37 // Called when a captured frame is available or an error has occurred. 37 // Called when a captured frame is available or an error has occurred.
38 // If |success| is true then |frame| is valid and |timestamp| indicates when 38 // If |success| is true then |frame| is valid and |timestamp| indicates when
39 // the frame was painted. 39 // the frame was painted.
40 // If |success| is false, all other parameters are invalid. 40 // If |success| is false, all other parameters are invalid.
41 typedef base::Callback<void(const scoped_refptr<VideoFrame>& frame, 41 typedef base::Callback<void(const scoped_refptr<VideoFrame>& frame,
42 base::TimeTicks timestamp, 42 base::TimeTicks timestamp,
43 bool success)> CaptureFrameCallback; 43 bool success)> CaptureFrameCallback;
44 44
45 // Record a change |event| along with its |damage_rect| and |event_time|, and
46 // then make a decision whether to proceed with capture. The decision is based
47 // on recent event history, capture activity, and the availability of
48 // resources.
49 //
50 // If this method returns false, the caller should take no further action.
51 // Otherwise, |storage| is set to the destination for the video frame capture;
52 // and, the caller should initiate capture, and then run |callback| once the
53 // video frame has been populated with its content.
45 bool ObserveEventAndDecideCapture(VideoCaptureOracle::Event event, 54 bool ObserveEventAndDecideCapture(VideoCaptureOracle::Event event,
46 const gfx::Rect& damage_rect, 55 const gfx::Rect& damage_rect,
47 base::TimeTicks event_time, 56 base::TimeTicks event_time,
48 scoped_refptr<VideoFrame>* storage, 57 scoped_refptr<VideoFrame>* storage,
49 CaptureFrameCallback* callback); 58 CaptureFrameCallback* callback);
50 59
60 // Attempt to re-send the last frame to the VideoCaptureDevice::Client.
61 // Returns true if successful. This can fail if the last frame is no longer
62 // available in the buffer pool, or if the VideoCaptureOracle decides to
63 // reject the "passive" refresh.
64 bool AttemptPassiveRefresh();
65
51 base::TimeDelta min_capture_period() const { 66 base::TimeDelta min_capture_period() const {
52 return oracle_.min_capture_period(); 67 return oracle_.min_capture_period();
53 } 68 }
54 69
55 base::TimeTicks last_time_animation_was_detected() const { 70 base::TimeTicks last_time_animation_was_detected() const {
56 return oracle_.last_time_animation_was_detected(); 71 return oracle_.last_time_animation_was_detected();
57 } 72 }
58 73
59 gfx::Size max_frame_size() const { 74 gfx::Size max_frame_size() const {
60 return params_.requested_format.frame_size; 75 return params_.requested_format.frame_size;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // Makes the decision to capture a frame. 116 // Makes the decision to capture a frame.
102 VideoCaptureOracle oracle_; 117 VideoCaptureOracle oracle_;
103 118
104 // The video capture parameters used to construct the oracle proxy. 119 // The video capture parameters used to construct the oracle proxy.
105 const VideoCaptureParams params_; 120 const VideoCaptureParams params_;
106 }; 121 };
107 122
108 } // namespace media 123 } // namespace media
109 124
110 #endif // MEDIA_CAPTURE_CONTENT_THREAD_SAFE_CAPTURE_ORACLE_H_ 125 #endif // MEDIA_CAPTURE_CONTENT_THREAD_SAFE_CAPTURE_ORACLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698