| 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_CONTENT_SCREEN_CAPTURE_DEVICE_CORE_H_ | 5 #ifndef MEDIA_CAPTURE_CONTENT_SCREEN_CAPTURE_DEVICE_CORE_H_ |
| 6 #define MEDIA_CAPTURE_CONTENT_SCREEN_CAPTURE_DEVICE_CORE_H_ | 6 #define MEDIA_CAPTURE_CONTENT_SCREEN_CAPTURE_DEVICE_CORE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 public: | 30 public: |
| 31 VideoCaptureMachine(); | 31 VideoCaptureMachine(); |
| 32 virtual ~VideoCaptureMachine(); | 32 virtual ~VideoCaptureMachine(); |
| 33 | 33 |
| 34 // Starts capturing. | 34 // Starts capturing. |
| 35 // |callback| is invoked with true if succeeded. Otherwise, with false. | 35 // |callback| is invoked with true if succeeded. Otherwise, with false. |
| 36 virtual void Start(const scoped_refptr<ThreadSafeCaptureOracle>& oracle_proxy, | 36 virtual void Start(const scoped_refptr<ThreadSafeCaptureOracle>& oracle_proxy, |
| 37 const VideoCaptureParams& params, | 37 const VideoCaptureParams& params, |
| 38 const base::Callback<void(bool)> callback) = 0; | 38 const base::Callback<void(bool)> callback) = 0; |
| 39 | 39 |
| 40 // Suspend/Resume frame delivery. Implementations of these are optional. |
| 41 virtual void Suspend() {} |
| 42 virtual void Resume() {} |
| 43 |
| 40 // Stops capturing. | 44 // Stops capturing. |
| 41 // |callback| is invoked after the capturing has stopped. | 45 // |callback| is invoked after the capturing has stopped. |
| 42 virtual void Stop(const base::Closure& callback) = 0; | 46 virtual void Stop(const base::Closure& callback) = 0; |
| 43 | 47 |
| 44 // Returns true if the video capture is configured to monitor end-to-end | 48 // 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 | 49 // system utilization, and alter frame sizes and/or frame rates to mitigate |
| 46 // overloading or under-utilization. | 50 // overloading or under-utilization. |
| 47 virtual bool IsAutoThrottlingEnabled() const; | 51 virtual bool IsAutoThrottlingEnabled() const; |
| 48 | 52 |
| 49 // Called by ScreenCaptureDeviceCore when it failed to satisfy a "refresh | 53 // Called by ScreenCaptureDeviceCore when it failed to satisfy a "refresh |
| (...skipping 25 matching lines...) Expand all Loading... |
| 75 class CAPTURE_EXPORT ScreenCaptureDeviceCore | 79 class CAPTURE_EXPORT ScreenCaptureDeviceCore |
| 76 : public base::SupportsWeakPtr<ScreenCaptureDeviceCore> { | 80 : public base::SupportsWeakPtr<ScreenCaptureDeviceCore> { |
| 77 public: | 81 public: |
| 78 ScreenCaptureDeviceCore(std::unique_ptr<VideoCaptureMachine> capture_machine); | 82 ScreenCaptureDeviceCore(std::unique_ptr<VideoCaptureMachine> capture_machine); |
| 79 virtual ~ScreenCaptureDeviceCore(); | 83 virtual ~ScreenCaptureDeviceCore(); |
| 80 | 84 |
| 81 // Asynchronous requests to change ScreenCaptureDeviceCore state. | 85 // Asynchronous requests to change ScreenCaptureDeviceCore state. |
| 82 void AllocateAndStart(const VideoCaptureParams& params, | 86 void AllocateAndStart(const VideoCaptureParams& params, |
| 83 std::unique_ptr<VideoCaptureDevice::Client> client); | 87 std::unique_ptr<VideoCaptureDevice::Client> client); |
| 84 void RequestRefreshFrame(); | 88 void RequestRefreshFrame(); |
| 89 void Suspend(); |
| 90 void Resume(); |
| 85 void StopAndDeAllocate(); | 91 void StopAndDeAllocate(); |
| 86 | 92 |
| 87 private: | 93 private: |
| 88 // Flag indicating current state. | 94 // Flag indicating current state. |
| 89 enum State { kIdle, kCapturing, kError, kLastCaptureState }; | 95 enum State { kIdle, kCapturing, kSuspended, kError, kLastCaptureState }; |
| 90 | 96 |
| 91 void TransitionStateTo(State next_state); | 97 void TransitionStateTo(State next_state); |
| 92 | 98 |
| 93 // Called back in response to StartCaptureMachine(). |success| is true if | 99 // Called back in response to StartCaptureMachine(). |success| is true if |
| 94 // capture machine succeeded to start. | 100 // capture machine succeeded to start. |
| 95 void CaptureStarted(bool success); | 101 void CaptureStarted(bool success); |
| 96 | 102 |
| 97 // Stops capturing and notifies client_ of an error state. | 103 // Stops capturing and notifies client_ of an error state. |
| 98 void Error(const tracked_objects::Location& from_here, | 104 void Error(const tracked_objects::Location& from_here, |
| 99 const std::string& reason); | 105 const std::string& reason); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 113 // capture pipeline. Besides the VideoCaptureDevice itself, it is the only | 119 // capture pipeline. Besides the VideoCaptureDevice itself, it is the only |
| 114 // component of the system with direct access to |client_|. | 120 // component of the system with direct access to |client_|. |
| 115 scoped_refptr<ThreadSafeCaptureOracle> oracle_proxy_; | 121 scoped_refptr<ThreadSafeCaptureOracle> oracle_proxy_; |
| 116 | 122 |
| 117 DISALLOW_COPY_AND_ASSIGN(ScreenCaptureDeviceCore); | 123 DISALLOW_COPY_AND_ASSIGN(ScreenCaptureDeviceCore); |
| 118 }; | 124 }; |
| 119 | 125 |
| 120 } // namespace media | 126 } // namespace media |
| 121 | 127 |
| 122 #endif // MEDIA_CAPTURE_CONTENT_SCREEN_CAPTURE_DEVICE_CORE_H_ | 128 #endif // MEDIA_CAPTURE_CONTENT_SCREEN_CAPTURE_DEVICE_CORE_H_ |
| OLD | NEW |