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 23 matching lines...) Expand all Loading... |
34 #include "media/capture/video_capture_types.h" | 34 #include "media/capture/video_capture_types.h" |
35 #include "mojo/public/cpp/bindings/array.h" | 35 #include "mojo/public/cpp/bindings/array.h" |
36 #include "ui/gfx/gpu_memory_buffer.h" | 36 #include "ui/gfx/gpu_memory_buffer.h" |
37 | 37 |
38 namespace tracked_objects { | 38 namespace tracked_objects { |
39 class Location; | 39 class Location; |
40 } // namespace tracked_objects | 40 } // namespace tracked_objects |
41 | 41 |
42 namespace media { | 42 namespace media { |
43 | 43 |
44 class CAPTURE_EXPORT FrameBufferPool { | |
45 public: | |
46 virtual ~FrameBufferPool() {} | |
47 | |
48 virtual void SetBufferHold(int buffer_id) = 0; | |
49 virtual void ReleaseBufferHold(int buffer_id) = 0; | |
50 virtual mojo::ScopedSharedBufferHandle GetHandleForTransit(int buffer_id) = 0; | |
51 }; | |
52 | |
53 class CAPTURE_EXPORT VideoFrameConsumerFeedbackObserver { | 44 class CAPTURE_EXPORT VideoFrameConsumerFeedbackObserver { |
54 public: | 45 public: |
55 virtual ~VideoFrameConsumerFeedbackObserver() {} | 46 virtual ~VideoFrameConsumerFeedbackObserver() {} |
56 | 47 |
57 // During processing of a video frame, consumers may report back their | 48 // During processing of a video frame, consumers may report back their |
58 // utilization level to the source device. The device may use this information | 49 // utilization level to the source device. The device may use this information |
59 // to adjust the rate of data it pushes out. Values are interpreted as | 50 // to adjust the rate of data it pushes out. Values are interpreted as |
60 // follows: | 51 // follows: |
61 // Less than 0.0 is meaningless and should be ignored. 1.0 indicates a | 52 // Less than 0.0 is meaningless and should be ignored. 1.0 indicates a |
62 // maximum sustainable utilization. Greater than 1.0 indicates the consumer | 53 // maximum sustainable utilization. Greater than 1.0 indicates the consumer |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 // Captured new video data, held in |frame| or |buffer|, respectively for | 141 // Captured new video data, held in |frame| or |buffer|, respectively for |
151 // OnIncomingCapturedVideoFrame() and OnIncomingCapturedBuffer(). | 142 // OnIncomingCapturedVideoFrame() and OnIncomingCapturedBuffer(). |
152 // | 143 // |
153 // In both cases, as the frame is backed by a reservation returned by | 144 // In both cases, as the frame is backed by a reservation returned by |
154 // ReserveOutputBuffer(), delivery is guaranteed and will require no | 145 // ReserveOutputBuffer(), delivery is guaranteed and will require no |
155 // additional copies in the browser process. | 146 // additional copies in the browser process. |
156 // See OnIncomingCapturedData for details of |reference_time| and | 147 // See OnIncomingCapturedData for details of |reference_time| and |
157 // |timestamp|. | 148 // |timestamp|. |
158 // TODO(chfremer): Consider removing one of the two in order to simplify the | 149 // TODO(chfremer): Consider removing one of the two in order to simplify the |
159 // interface. | 150 // interface. |
160 virtual void OnIncomingCapturedBuffer(std::unique_ptr<Buffer> buffer, | 151 virtual void OnIncomingCapturedBuffer( |
161 const VideoCaptureFormat& format, | 152 std::unique_ptr<Buffer> buffer, |
162 base::TimeTicks reference_time, | 153 const VideoCaptureFormat& frame_format, |
163 base::TimeDelta timestamp) = 0; | 154 base::TimeTicks reference_time, |
| 155 base::TimeDelta timestamp) = 0; |
164 virtual void OnIncomingCapturedVideoFrame( | 156 virtual void OnIncomingCapturedVideoFrame( |
165 std::unique_ptr<Buffer> buffer, | 157 std::unique_ptr<Buffer> buffer, |
166 scoped_refptr<VideoFrame> frame) = 0; | 158 scoped_refptr<VideoFrame> frame) = 0; |
167 | 159 |
168 // Attempts to reserve the same Buffer provided in the last call to one of | 160 // Attempts to reserve the same Buffer provided in the last call to one of |
169 // the OnIncomingCapturedXXX() methods. This will fail if the content of the | 161 // the OnIncomingCapturedXXX() methods. This will fail if the content of the |
170 // Buffer has not been preserved, or if the |dimensions|, |format|, or | 162 // Buffer has not been preserved, or if the |dimensions|, |format|, or |
171 // |storage| disagree with how it was reserved via ReserveOutputBuffer(). | 163 // |storage| disagree with how it was reserved via ReserveOutputBuffer(). |
172 // When this operation fails, nullptr will be returned. | 164 // When this operation fails, nullptr will be returned. |
173 virtual std::unique_ptr<Buffer> ResurrectLastOutputBuffer( | 165 virtual std::unique_ptr<Buffer> ResurrectLastOutputBuffer( |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 267 |
276 private: | 268 private: |
277 // Gets the power line frequency from the current system time zone if this is | 269 // Gets the power line frequency from the current system time zone if this is |
278 // defined, otherwise returns 0. | 270 // defined, otherwise returns 0. |
279 PowerLineFrequency GetPowerLineFrequencyForLocation() const; | 271 PowerLineFrequency GetPowerLineFrequencyForLocation() const; |
280 }; | 272 }; |
281 | 273 |
282 } // namespace media | 274 } // namespace media |
283 | 275 |
284 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_H_ | 276 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_H_ |
OLD | NEW |