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 FrameBufferHost { | |
mcasas
2016/12/06 20:02:24
In Chromium, Hosts are usually sitting at one end
chfremer
2016/12/06 21:07:41
Done.
| |
45 public: | |
46 virtual ~FrameBufferHost() {} | |
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 }; | |
mcasas
2016/12/06 20:02:24
Move it to a file on its own plz.
chfremer
2016/12/06 21:07:41
Please allow me to defer this as cleanup task by a
| |
52 | |
44 class CAPTURE_EXPORT VideoFrameConsumerFeedbackObserver { | 53 class CAPTURE_EXPORT VideoFrameConsumerFeedbackObserver { |
mcasas
2016/12/06 20:02:24
We should move this fella to a file on its own too
chfremer
2016/12/06 21:07:41
Agreed.
Please allow me to defer this as cleanup t
| |
45 public: | 54 public: |
46 virtual ~VideoFrameConsumerFeedbackObserver() {} | 55 virtual ~VideoFrameConsumerFeedbackObserver() {} |
47 | 56 |
48 // During processing of a video frame, consumers may report back their | 57 // During processing of a video frame, consumers may report back their |
49 // utilization level to the source device. The device may use this information | 58 // utilization level to the source device. The device may use this information |
50 // to adjust the rate of data it pushes out. Values are interpreted as | 59 // to adjust the rate of data it pushes out. Values are interpreted as |
51 // follows: | 60 // follows: |
52 // Less than 0.0 is meaningless and should be ignored. 1.0 indicates a | 61 // Less than 0.0 is meaningless and should be ignored. 1.0 indicates a |
53 // maximum sustainable utilization. Greater than 1.0 indicates the consumer | 62 // maximum sustainable utilization. Greater than 1.0 indicates the consumer |
54 // is likely to stall or drop frames if the data volume is not reduced. | 63 // is likely to stall or drop frames if the data volume is not reduced. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 // Captured new video data, held in |frame| or |buffer|, respectively for | 150 // Captured new video data, held in |frame| or |buffer|, respectively for |
142 // OnIncomingCapturedVideoFrame() and OnIncomingCapturedBuffer(). | 151 // OnIncomingCapturedVideoFrame() and OnIncomingCapturedBuffer(). |
143 // | 152 // |
144 // In both cases, as the frame is backed by a reservation returned by | 153 // In both cases, as the frame is backed by a reservation returned by |
145 // ReserveOutputBuffer(), delivery is guaranteed and will require no | 154 // ReserveOutputBuffer(), delivery is guaranteed and will require no |
146 // additional copies in the browser process. | 155 // additional copies in the browser process. |
147 // See OnIncomingCapturedData for details of |reference_time| and | 156 // See OnIncomingCapturedData for details of |reference_time| and |
148 // |timestamp|. | 157 // |timestamp|. |
149 // TODO(chfremer): Consider removing one of the two in order to simplify the | 158 // TODO(chfremer): Consider removing one of the two in order to simplify the |
150 // interface. | 159 // interface. |
151 virtual void OnIncomingCapturedBuffer( | 160 virtual void OnIncomingCapturedBuffer(std::unique_ptr<Buffer> buffer, |
152 std::unique_ptr<Buffer> buffer, | 161 const VideoCaptureFormat& format, |
153 const VideoCaptureFormat& frame_format, | 162 base::TimeTicks reference_time, |
154 base::TimeTicks reference_time, | 163 base::TimeDelta timestamp) = 0; |
155 base::TimeDelta timestamp) = 0; | |
156 virtual void OnIncomingCapturedVideoFrame( | 164 virtual void OnIncomingCapturedVideoFrame( |
157 std::unique_ptr<Buffer> buffer, | 165 std::unique_ptr<Buffer> buffer, |
158 scoped_refptr<VideoFrame> frame) = 0; | 166 scoped_refptr<VideoFrame> frame) = 0; |
159 | 167 |
160 // Attempts to reserve the same Buffer provided in the last call to one of | 168 // Attempts to reserve the same Buffer provided in the last call to one of |
161 // the OnIncomingCapturedXXX() methods. This will fail if the content of the | 169 // the OnIncomingCapturedXXX() methods. This will fail if the content of the |
162 // Buffer has not been preserved, or if the |dimensions|, |format|, or | 170 // Buffer has not been preserved, or if the |dimensions|, |format|, or |
163 // |storage| disagree with how it was reserved via ReserveOutputBuffer(). | 171 // |storage| disagree with how it was reserved via ReserveOutputBuffer(). |
164 // When this operation fails, nullptr will be returned. | 172 // When this operation fails, nullptr will be returned. |
165 virtual std::unique_ptr<Buffer> ResurrectLastOutputBuffer( | 173 virtual std::unique_ptr<Buffer> ResurrectLastOutputBuffer( |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
267 | 275 |
268 private: | 276 private: |
269 // Gets the power line frequency from the current system time zone if this is | 277 // Gets the power line frequency from the current system time zone if this is |
270 // defined, otherwise returns 0. | 278 // defined, otherwise returns 0. |
271 PowerLineFrequency GetPowerLineFrequencyForLocation() const; | 279 PowerLineFrequency GetPowerLineFrequencyForLocation() const; |
272 }; | 280 }; |
273 | 281 |
274 } // namespace media | 282 } // namespace media |
275 | 283 |
276 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_H_ | 284 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_H_ |
OLD | NEW |