Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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. | |
|
Irfan
2016/04/06 19:53:05
What happens when there is a request from consumer
miu
2016/04/06 22:33:53
Nothing happens. The oracle will decide not to ca
| |
| 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 Loading... | |
| 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_ |
| OLD | NEW |