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

Side by Side Diff: media/capture/content/screen_capture_device_core.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: Addressed comments from PS2, and sampling decision logic change w.r.t. recent animation. 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_SCREEN_CAPTURE_DEVICE_CORE_H_ 5 #ifndef MEDIA_CAPTURE_SCREEN_CAPTURE_DEVICE_CORE_H_
6 #define MEDIA_CAPTURE_SCREEN_CAPTURE_DEVICE_CORE_H_ 6 #define MEDIA_CAPTURE_SCREEN_CAPTURE_DEVICE_CORE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 28 matching lines...) Expand all
39 39
40 // Stops capturing. 40 // Stops capturing.
41 // |callback| is invoked after the capturing has stopped. 41 // |callback| is invoked after the capturing has stopped.
42 virtual void Stop(const base::Closure& callback) = 0; 42 virtual void Stop(const base::Closure& callback) = 0;
43 43
44 // Returns true if the video capture is configured to monitor end-to-end 44 // Returns true if the video capture is configured to monitor end-to-end
45 // system utilization, and alter frame sizes and/or frame rates to mitigate 45 // system utilization, and alter frame sizes and/or frame rates to mitigate
46 // overloading or under-utilization. 46 // overloading or under-utilization.
47 virtual bool IsAutoThrottlingEnabled() const; 47 virtual bool IsAutoThrottlingEnabled() const;
48 48
49 // Called by ScreenCaptureDeviceCore when it failed to satisfy a "refresh
50 // frame" request by attempting to resurrect the last video frame from the
51 // buffer pool (this is referred to as the "passive" refresh approach). The
52 // failure can happen for a number of reasons (e.g., the oracle decided to
53 // change resolution, or consumers of the last video frame are not yet
54 // finished with it).
55 //
56 // The implementation of this method should consult the oracle, using the
57 // kActiveRefreshRequest event type, to decide whether to initiate a new frame
58 // capture, and then do so if the oracle agrees.
59 virtual void MaybeCaptureForRefresh() = 0;
60
49 private: 61 private:
50 DISALLOW_COPY_AND_ASSIGN(VideoCaptureMachine); 62 DISALLOW_COPY_AND_ASSIGN(VideoCaptureMachine);
51 }; 63 };
52 64
53 // The "meat" of a content video capturer. 65 // The "meat" of a content video capturer.
54 // 66 //
55 // Separating this from the "shell classes" WebContentsVideoCaptureDevice and 67 // Separating this from the "shell classes" WebContentsVideoCaptureDevice and
56 // DesktopCaptureDeviceAura allows safe destruction without needing to block any 68 // DesktopCaptureDeviceAura allows safe destruction without needing to block any
57 // threads, as well as code sharing. 69 // threads, as well as code sharing.
58 // 70 //
59 // ScreenCaptureDeviceCore manages a simple state machine and the pipeline 71 // ScreenCaptureDeviceCore manages a simple state machine and the pipeline
60 // (see notes at top of this file). It times the start of successive captures 72 // (see notes at top of this file). It times the start of successive captures
61 // and facilitates the processing of each through the stages of the 73 // and facilitates the processing of each through the stages of the
62 // pipeline. 74 // pipeline.
63 class MEDIA_EXPORT ScreenCaptureDeviceCore 75 class MEDIA_EXPORT ScreenCaptureDeviceCore
64 : public base::SupportsWeakPtr<ScreenCaptureDeviceCore> { 76 : public base::SupportsWeakPtr<ScreenCaptureDeviceCore> {
65 public: 77 public:
66 ScreenCaptureDeviceCore(scoped_ptr<VideoCaptureMachine> capture_machine); 78 ScreenCaptureDeviceCore(scoped_ptr<VideoCaptureMachine> capture_machine);
67 virtual ~ScreenCaptureDeviceCore(); 79 virtual ~ScreenCaptureDeviceCore();
68 80
69 // Asynchronous requests to change ScreenCaptureDeviceCore state. 81 // Asynchronous requests to change ScreenCaptureDeviceCore state.
70 void AllocateAndStart(const VideoCaptureParams& params, 82 void AllocateAndStart(const VideoCaptureParams& params,
71 scoped_ptr<VideoCaptureDevice::Client> client); 83 scoped_ptr<VideoCaptureDevice::Client> client);
84 void RequestRefreshFrame();
72 void StopAndDeAllocate(); 85 void StopAndDeAllocate();
73 86
74 private: 87 private:
75 // Flag indicating current state. 88 // Flag indicating current state.
76 enum State { kIdle, kCapturing, kError, kLastCaptureState }; 89 enum State { kIdle, kCapturing, kError, kLastCaptureState };
77 90
78 void TransitionStateTo(State next_state); 91 void TransitionStateTo(State next_state);
79 92
80 // Called back in response to StartCaptureMachine(). |success| is true if 93 // Called back in response to StartCaptureMachine(). |success| is true if
81 // capture machine succeeded to start. 94 // capture machine succeeded to start.
(...skipping 18 matching lines...) Expand all
100 // capture pipeline. Besides the VideoCaptureDevice itself, it is the only 113 // capture pipeline. Besides the VideoCaptureDevice itself, it is the only
101 // component of the system with direct access to |client_|. 114 // component of the system with direct access to |client_|.
102 scoped_refptr<ThreadSafeCaptureOracle> oracle_proxy_; 115 scoped_refptr<ThreadSafeCaptureOracle> oracle_proxy_;
103 116
104 DISALLOW_COPY_AND_ASSIGN(ScreenCaptureDeviceCore); 117 DISALLOW_COPY_AND_ASSIGN(ScreenCaptureDeviceCore);
105 }; 118 };
106 119
107 } // namespace media 120 } // namespace media
108 121
109 #endif // MEDIA_CAPTURE_SCREEN_CAPTURE_DEVICE_CORE_H_ 122 #endif // MEDIA_CAPTURE_SCREEN_CAPTURE_DEVICE_CORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698