Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 // VideoCaptureDevice is the abstract base class for realizing video capture | 5 // VideoCaptureDevice is the abstract base class for realizing video capture |
| 6 // device support in Chromium. It provides the interface for OS dependent | 6 // device support in Chromium. It provides the interface for OS dependent |
| 7 // implementations. | 7 // implementations. |
| 8 // The class is created and functions are invoked on a thread owned by | 8 // The class is created and functions are invoked on a thread owned by |
| 9 // VideoCaptureManager. Capturing is done on other threads, depending on the OS | 9 // VideoCaptureManager. Capturing is done on other threads, depending on the OS |
| 10 // specific implementation. | 10 // specific implementation. |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 class CAPTURE_EXPORT VideoCaptureDevice | 79 class CAPTURE_EXPORT VideoCaptureDevice |
| 80 : public VideoFrameConsumerFeedbackObserver { | 80 : public VideoFrameConsumerFeedbackObserver { |
| 81 public: | 81 public: |
| 82 | 82 |
| 83 // Interface defining the methods that clients of VideoCapture must have. It | 83 // Interface defining the methods that clients of VideoCapture must have. It |
| 84 // is actually two-in-one: clients may implement OnIncomingCapturedData() or | 84 // is actually two-in-one: clients may implement OnIncomingCapturedData() or |
| 85 // ReserveOutputBuffer() + OnIncomingCapturedVideoFrame(), or all of them. | 85 // ReserveOutputBuffer() + OnIncomingCapturedVideoFrame(), or all of them. |
| 86 // All clients must implement OnError(). | 86 // All clients must implement OnError(). |
| 87 // All clients must implement OnStarted(). Captured frames can be delivered | |
| 88 // as soon as AllocateAndStart() is called, despite of OnStarted processing. | |
|
chfremer
2017/02/22 19:13:58
As discussed offline, the "All clients must implem
braveyao
2017/02/23 00:06:26
Done.
| |
| 87 class CAPTURE_EXPORT Client { | 89 class CAPTURE_EXPORT Client { |
| 88 public: | 90 public: |
| 89 // Move-only type representing access to a buffer handle as well as | 91 // Move-only type representing access to a buffer handle as well as |
| 90 // read-write permission to its contents. | 92 // read-write permission to its contents. |
| 91 class CAPTURE_EXPORT Buffer { | 93 class CAPTURE_EXPORT Buffer { |
| 92 public: | 94 public: |
| 93 // Destructor-only interface for encapsulating scoped access permission to | 95 // Destructor-only interface for encapsulating scoped access permission to |
| 94 // a Buffer. | 96 // a Buffer. |
| 95 class CAPTURE_EXPORT ScopedAccessPermission { | 97 class CAPTURE_EXPORT ScopedAccessPermission { |
| 96 public: | 98 public: |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 207 // be StopAndDeAllocate()-ed. |reason| is a text description of the error. | 209 // be StopAndDeAllocate()-ed. |reason| is a text description of the error. |
| 208 virtual void OnError(const tracked_objects::Location& from_here, | 210 virtual void OnError(const tracked_objects::Location& from_here, |
| 209 const std::string& reason) = 0; | 211 const std::string& reason) = 0; |
| 210 | 212 |
| 211 // VideoCaptureDevice requests the |message| to be logged. | 213 // VideoCaptureDevice requests the |message| to be logged. |
| 212 virtual void OnLog(const std::string& message) {} | 214 virtual void OnLog(const std::string& message) {} |
| 213 | 215 |
| 214 // Returns the current buffer pool utilization, in the range 0.0 (no buffers | 216 // Returns the current buffer pool utilization, in the range 0.0 (no buffers |
| 215 // are in use by producers or consumers) to 1.0 (all buffers are in use). | 217 // are in use by producers or consumers) to 1.0 (all buffers are in use). |
| 216 virtual double GetBufferPoolUtilization() const = 0; | 218 virtual double GetBufferPoolUtilization() const = 0; |
| 219 | |
| 220 // VideoCaptureDevice reports it's successfully started. | |
| 221 // This method may be called either synchronously from an invocation of | |
| 222 // VideoCaptureDevice::AllocateAndStart() or asynchronously from any thread | |
| 223 // after AllocateAndStart() has returned. | |
|
chfremer
2017/02/22 19:13:58
According to the latest design, it may actually be
braveyao
2017/02/23 00:06:26
Done.
| |
| 224 virtual void OnStarted() = 0; | |
| 217 }; | 225 }; |
| 218 | 226 |
| 219 ~VideoCaptureDevice() override; | 227 ~VideoCaptureDevice() override; |
| 220 | 228 |
| 221 // Prepares the video capturer for use. StopAndDeAllocate() must be called | 229 // Prepares the video capturer for use. StopAndDeAllocate() must be called |
| 222 // before the object is deleted. | 230 // before the object is deleted. |
| 223 virtual void AllocateAndStart(const VideoCaptureParams& params, | 231 virtual void AllocateAndStart(const VideoCaptureParams& params, |
| 224 std::unique_ptr<Client> client) = 0; | 232 std::unique_ptr<Client> client) = 0; |
| 225 | 233 |
| 226 // In cases where the video capturer self-pauses (e.g., a screen capturer | 234 // In cases where the video capturer self-pauses (e.g., a screen capturer |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 302 | 310 |
| 303 private: | 311 private: |
| 304 // Gets the power line frequency from the current system time zone if this is | 312 // Gets the power line frequency from the current system time zone if this is |
| 305 // defined, otherwise returns 0. | 313 // defined, otherwise returns 0. |
| 306 PowerLineFrequency GetPowerLineFrequencyForLocation() const; | 314 PowerLineFrequency GetPowerLineFrequencyForLocation() const; |
| 307 }; | 315 }; |
| 308 | 316 |
| 309 } // namespace media | 317 } // namespace media |
| 310 | 318 |
| 311 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_H_ | 319 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_H_ |
| OLD | NEW |