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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
76 static constexpr double kNoUtilizationRecorded = -1.0; | 76 static constexpr double kNoUtilizationRecorded = -1.0; |
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 methods may be called as soon as AllocateAndStart() of the |
87 // corresponding VideoCaptureDevice is invoked. The methods for buffer | |
88 // reservation and frame delivery may be called from arbitrary threads but | |
89 // are guaranteed to be called non-concurrently. The status reporting methods | |
90 // (OnStarted, OnLog, OnError) may be called concurrently. | |
miu
2017/02/24 22:16:45
FWICT, this is incorrect: The current implementati
chfremer
2017/02/24 22:25:35
Thanks for raising this concern. I think we may ac
braveyao
2017/02/24 22:53:36
Thanks chfremer@ for replying.
Yes, they are all p
miu
2017/02/24 23:02:21
Ah, yes, I forgot about that.
| |
87 class CAPTURE_EXPORT Client { | 91 class CAPTURE_EXPORT Client { |
88 public: | 92 public: |
89 // Move-only type representing access to a buffer handle as well as | 93 // Move-only type representing access to a buffer handle as well as |
90 // read-write permission to its contents. | 94 // read-write permission to its contents. |
91 class CAPTURE_EXPORT Buffer { | 95 class CAPTURE_EXPORT Buffer { |
92 public: | 96 public: |
93 // Destructor-only interface for encapsulating scoped access permission to | 97 // Destructor-only interface for encapsulating scoped access permission to |
94 // a Buffer. | 98 // a Buffer. |
95 class CAPTURE_EXPORT ScopedAccessPermission { | 99 class CAPTURE_EXPORT ScopedAccessPermission { |
96 public: | 100 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. | 211 // be StopAndDeAllocate()-ed. |reason| is a text description of the error. |
208 virtual void OnError(const tracked_objects::Location& from_here, | 212 virtual void OnError(const tracked_objects::Location& from_here, |
209 const std::string& reason) = 0; | 213 const std::string& reason) = 0; |
210 | 214 |
211 // VideoCaptureDevice requests the |message| to be logged. | 215 // VideoCaptureDevice requests the |message| to be logged. |
212 virtual void OnLog(const std::string& message) {} | 216 virtual void OnLog(const std::string& message) {} |
213 | 217 |
214 // Returns the current buffer pool utilization, in the range 0.0 (no buffers | 218 // 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). | 219 // are in use by producers or consumers) to 1.0 (all buffers are in use). |
216 virtual double GetBufferPoolUtilization() const = 0; | 220 virtual double GetBufferPoolUtilization() const = 0; |
221 | |
222 // VideoCaptureDevice reports it's successfully started. | |
223 virtual void OnStarted() = 0; | |
217 }; | 224 }; |
218 | 225 |
219 ~VideoCaptureDevice() override; | 226 ~VideoCaptureDevice() override; |
220 | 227 |
221 // Prepares the video capturer for use. StopAndDeAllocate() must be called | 228 // Prepares the video capturer for use. StopAndDeAllocate() must be called |
222 // before the object is deleted. | 229 // before the object is deleted. |
223 virtual void AllocateAndStart(const VideoCaptureParams& params, | 230 virtual void AllocateAndStart(const VideoCaptureParams& params, |
224 std::unique_ptr<Client> client) = 0; | 231 std::unique_ptr<Client> client) = 0; |
225 | 232 |
226 // In cases where the video capturer self-pauses (e.g., a screen capturer | 233 // 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 | 309 |
303 private: | 310 private: |
304 // Gets the power line frequency from the current system time zone if this is | 311 // Gets the power line frequency from the current system time zone if this is |
305 // defined, otherwise returns 0. | 312 // defined, otherwise returns 0. |
306 PowerLineFrequency GetPowerLineFrequencyForLocation() const; | 313 PowerLineFrequency GetPowerLineFrequencyForLocation() const; |
307 }; | 314 }; |
308 | 315 |
309 } // namespace media | 316 } // namespace media |
310 | 317 |
311 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_H_ | 318 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_H_ |
OLD | NEW |