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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 193 #endif | 193 #endif |
| 194 }; | 194 }; |
| 195 | 195 |
| 196 virtual ~Client() {} | 196 virtual ~Client() {} |
| 197 | 197 |
| 198 // Captured a new video frame, data for which is pointed to by |data|. | 198 // Captured a new video frame, data for which is pointed to by |data|. |
| 199 // | 199 // |
| 200 // The format of the frame is described by |frame_format|, and is assumed to | 200 // The format of the frame is described by |frame_format|, and is assumed to |
| 201 // be tightly packed. This method will try to reserve an output buffer and | 201 // be tightly packed. This method will try to reserve an output buffer and |
| 202 // copy from |data| into the output buffer. If no output buffer is | 202 // copy from |data| into the output buffer. If no output buffer is |
| 203 // available, the frame will be silently dropped. | 203 // available, the frame will be silently dropped. |referernce_time| is |
|
miu
2016/05/18 22:35:40
typo: s/referernce_time/reference_time/
qiangchen
2016/05/20 17:55:14
Done.
| |
| 204 // estimated system clock time when the capture happened. |timestamp| | |
|
miu
2016/05/18 22:35:40
Remove "estimated" since we really *are* taking a
qiangchen
2016/05/20 17:55:14
Done.
| |
| 205 // measures the ideal time span between the first frame in the stream and | |
| 206 // the current frame; however, the time source is not necessarily the | |
|
miu
2016/05/18 22:35:40
nit: End of this sentence should be: "...however,
qiangchen
2016/05/20 17:55:14
Done.
| |
| 207 // system clock. | |
| 204 virtual void OnIncomingCapturedData(const uint8_t* data, | 208 virtual void OnIncomingCapturedData(const uint8_t* data, |
| 205 int length, | 209 int length, |
| 206 const VideoCaptureFormat& frame_format, | 210 const VideoCaptureFormat& frame_format, |
| 207 int clockwise_rotation, | 211 int clockwise_rotation, |
| 208 const base::TimeTicks& timestamp) = 0; | 212 base::TimeTicks reference_time, |
| 213 base::TimeDelta timestamp) = 0; | |
| 209 | 214 |
| 210 // Reserve an output buffer into which contents can be captured directly. | 215 // Reserve an output buffer into which contents can be captured directly. |
| 211 // The returned Buffer will always be allocated with a memory size suitable | 216 // The returned Buffer will always be allocated with a memory size suitable |
| 212 // for holding a packed video frame with pixels of |format| format, of | 217 // for holding a packed video frame with pixels of |format| format, of |
| 213 // |dimensions| frame dimensions. It is permissible for |dimensions| to be | 218 // |dimensions| frame dimensions. It is permissible for |dimensions| to be |
| 214 // zero; in which case the returned Buffer does not guarantee memory | 219 // zero; in which case the returned Buffer does not guarantee memory |
| 215 // backing, but functions as a reservation for external input for the | 220 // backing, but functions as a reservation for external input for the |
| 216 // purposes of buffer throttling. | 221 // purposes of buffer throttling. |
| 217 // | 222 // |
| 218 // The output buffer stays reserved and mapped for use until the Buffer | 223 // The output buffer stays reserved and mapped for use until the Buffer |
| 219 // object is destroyed or returned. | 224 // object is destroyed or returned. |
| 220 virtual std::unique_ptr<Buffer> ReserveOutputBuffer( | 225 virtual std::unique_ptr<Buffer> ReserveOutputBuffer( |
| 221 const gfx::Size& dimensions, | 226 const gfx::Size& dimensions, |
| 222 VideoPixelFormat format, | 227 VideoPixelFormat format, |
| 223 VideoPixelStorage storage) = 0; | 228 VideoPixelStorage storage) = 0; |
| 224 | 229 |
| 225 // Captured new video data, held in |frame| or |buffer|, respectively for | 230 // Captured new video data, held in |frame| or |buffer|, respectively for |
| 226 // OnIncomingCapturedVideoFrame() and OnIncomingCapturedBuffer(). | 231 // OnIncomingCapturedVideoFrame() and OnIncomingCapturedBuffer(). |
| 227 // | 232 // |
| 228 // In both cases, as the frame is backed by a reservation returned by | 233 // In both cases, as the frame is backed by a reservation returned by |
| 229 // ReserveOutputBuffer(), delivery is guaranteed and will require no | 234 // ReserveOutputBuffer(), delivery is guaranteed and will require no |
| 230 // additional copies in the browser process. | 235 // additional copies in the browser process. |
| 231 virtual void OnIncomingCapturedBuffer( | 236 virtual void OnIncomingCapturedBuffer( |
| 232 std::unique_ptr<Buffer> buffer, | 237 std::unique_ptr<Buffer> buffer, |
| 233 const VideoCaptureFormat& frame_format, | 238 const VideoCaptureFormat& frame_format, |
| 234 const base::TimeTicks& timestamp) = 0; | 239 const base::TimeTicks& timestamp) = 0; |
|
miu
2016/05/18 22:35:40
These two methods need similar changes. Do you int
qiangchen
2016/05/20 17:55:14
I intended to do it in next CL, but now I think it
| |
| 235 virtual void OnIncomingCapturedVideoFrame( | 240 virtual void OnIncomingCapturedVideoFrame( |
| 236 std::unique_ptr<Buffer> buffer, | 241 std::unique_ptr<Buffer> buffer, |
| 237 const scoped_refptr<VideoFrame>& frame, | 242 const scoped_refptr<VideoFrame>& frame, |
| 238 const base::TimeTicks& timestamp) = 0; | 243 const base::TimeTicks& timestamp) = 0; |
|
miu
2016/05/18 22:35:40
BTW--For this method, the TimeTicks argument would
qiangchen
2016/05/20 17:55:14
Done.
| |
| 239 | 244 |
| 240 // Attempts to reserve the same Buffer provided in the last call to one of | 245 // Attempts to reserve the same Buffer provided in the last call to one of |
| 241 // the OnIncomingCapturedXXX() methods. This will fail if the content of the | 246 // the OnIncomingCapturedXXX() methods. This will fail if the content of the |
| 242 // Buffer has not been preserved, or if the |dimensions|, |format|, or | 247 // Buffer has not been preserved, or if the |dimensions|, |format|, or |
| 243 // |storage| disagree with how it was reserved via ReserveOutputBuffer(). | 248 // |storage| disagree with how it was reserved via ReserveOutputBuffer(). |
| 244 // When this operation fails, nullptr will be returned. | 249 // When this operation fails, nullptr will be returned. |
| 245 virtual std::unique_ptr<Buffer> ResurrectLastOutputBuffer( | 250 virtual std::unique_ptr<Buffer> ResurrectLastOutputBuffer( |
| 246 const gfx::Size& dimensions, | 251 const gfx::Size& dimensions, |
| 247 VideoPixelFormat format, | 252 VideoPixelFormat format, |
| 248 VideoPixelStorage storage) = 0; | 253 VideoPixelStorage storage) = 0; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 316 | 321 |
| 317 private: | 322 private: |
| 318 // Gets the power line frequency from the current system time zone if this is | 323 // Gets the power line frequency from the current system time zone if this is |
| 319 // defined, otherwise returns 0. | 324 // defined, otherwise returns 0. |
| 320 PowerLineFrequency GetPowerLineFrequencyForLocation() const; | 325 PowerLineFrequency GetPowerLineFrequencyForLocation() const; |
| 321 }; | 326 }; |
| 322 | 327 |
| 323 } // namespace media | 328 } // namespace media |
| 324 | 329 |
| 325 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ | 330 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ |
| OLD | NEW |