OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef MEDIA_CAPTURE_VIDEO_VIDEO_FRAME_RECEIVER_H_ | 5 #ifndef MEDIA_CAPTURE_VIDEO_VIDEO_FRAME_RECEIVER_H_ |
6 #define MEDIA_CAPTURE_VIDEO_VIDEO_FRAME_RECEIVER_H_ | 6 #define MEDIA_CAPTURE_VIDEO_VIDEO_FRAME_RECEIVER_H_ |
7 | 7 |
8 #include "media/capture/capture_export.h" | 8 #include "media/capture/capture_export.h" |
| 9 #include "media/capture/mojo/video_capture_types.mojom.h" |
| 10 #include "media/capture/video/video_capture_buffer_handle.h" |
9 #include "media/capture/video/video_capture_device.h" | 11 #include "media/capture/video/video_capture_device.h" |
10 | 12 |
11 namespace media { | 13 namespace media { |
12 | 14 |
13 // Callback interface for VideoCaptureDeviceClient to communicate with its | 15 // Callback interface for VideoCaptureDeviceClient to communicate with its |
14 // clients. | 16 // clients. |
15 class CAPTURE_EXPORT VideoFrameReceiver { | 17 class CAPTURE_EXPORT VideoFrameReceiver { |
16 public: | 18 public: |
17 virtual ~VideoFrameReceiver(){}; | 19 virtual ~VideoFrameReceiver(){}; |
18 | 20 |
19 virtual void OnIncomingCapturedVideoFrame( | 21 // Tells the VideoFrameReceiver that the producer is going to subsequently use |
20 media::VideoCaptureDevice::Client::Buffer buffer, | 22 // the provided buffer as one of possibly many for frame delivery via |
21 scoped_refptr<media::VideoFrame> frame) = 0; | 23 // OnFrameReadyInBuffer(). Note, that a call to this method does not mean that |
| 24 // the caller allows the receiver to read from or write to the buffer. |
| 25 virtual void OnNewBufferHandle( |
| 26 int buffer_id, |
| 27 std::unique_ptr<BufferHandleProvider> handle_provider) = 0; |
| 28 |
| 29 // Tells the VideoFrameReceiver that a new frame is ready for consumption |
| 30 // in the buffer with id |buffer_id| and allows it to read the data from |
| 31 // the buffer. The producer guarantees that the buffer and its contents stay |
| 32 // alive and unchanged until VideoFrameReceiver releases the given |
| 33 // |buffer_read_permission|. |
| 34 virtual void OnFrameReadyInBuffer( |
| 35 int buffer_id, |
| 36 int frame_feedback_id, |
| 37 std::unique_ptr<Ownership> buffer_read_permission, |
| 38 mojom::VideoFrameInfoPtr frame_info) = 0; |
| 39 |
| 40 // Tells the VideoFrameReceiver that the producer is no longer going to use |
| 41 // the buffer with id |buffer_id| for frame delivery. This may be called even |
| 42 // while the receiver is still holding |buffer_read_permission| from a call to |
| 43 // OnFrameReadInBuffer() for the same buffer. In that case, it means that the |
| 44 // caller is asking the VideoFrameReceiver to release the read permission and |
| 45 // buffer handle at its earliest convenience. |
| 46 // The producer guarantees that it does not reuse a retired buffer_id before |
| 47 // having cycled through all other possible values. |
| 48 virtual void OnBufferRetired(int buffer_id) = 0; |
| 49 |
22 virtual void OnError() = 0; | 50 virtual void OnError() = 0; |
23 virtual void OnLog(const std::string& message) = 0; | 51 virtual void OnLog(const std::string& message) = 0; |
24 virtual void OnBufferDestroyed(int buffer_id_to_drop) = 0; | |
25 }; | 52 }; |
26 | 53 |
27 } // namespace media | 54 } // namespace media |
28 | 55 |
29 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_FRAME_RECEIVER_H_ | 56 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_FRAME_RECEIVER_H_ |
OLD | NEW |