Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: media/capture/video/video_frame_receiver.h

Issue 2686763002: [Mojo Video Capture] Split OnIncomingCapturedVideoFrame() to OnNewBuffer() and OnFrameReadyInBuffer( (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
22 virtual void OnError() = 0; 24 // the caller allows the receiver to read from or write to the buffer.
23 virtual void OnLog(const std::string& message) = 0; 25 virtual void OnNewBufferHandle(
26 int buffer_id,
27 std::unique_ptr<VideoCaptureDevice::Client::Buffer::HandleProvider>
28 handle_provider) = 0;
29
30 // Tells the VideoFrameReceiver that a new frame is ready for consumption
31 // in the buffer with id |buffer_id| and allows it to read the data from
32 // the buffer. The producer guarantees that the buffer and its contents stay
33 // alive and unchanged until VideoFrameReceiver releases the given
34 // |buffer_read_permission|.
35 virtual void OnFrameReadyInBuffer(
36 int buffer_id,
37 int frame_feedback_id,
38 std::unique_ptr<
39 VideoCaptureDevice::Client::Buffer::ScopedAccessPermission>
40 buffer_read_permission,
41 mojom::VideoFrameInfoPtr frame_info) = 0;
24 42
25 // Tells the VideoFrameReceiver that the producer is no longer going to use 43 // Tells the VideoFrameReceiver that the producer is no longer going to use
26 // the buffer with id |buffer_id| for frame delivery. This may be called even 44 // the buffer with id |buffer_id| for frame delivery. This may be called even
27 // while the receiver is still consuming the buffer from a call to 45 // while the receiver is still holding |buffer_read_permission| from a call to
28 // OnIncomingCapturedVideoFrame(). In that case, it means that the 46 // OnFrameReadInBuffer() for the same buffer. In that case, it means that the
29 // caller is asking the VideoFrameReceiver to release the buffer 47 // caller is asking the VideoFrameReceiver to release the read permission and
30 // at its earliest convenience. 48 // buffer handle at its earliest convenience.
31 // A producer may reuse a retired |buffer_id| immediately after this call. 49 // A producer may reuse a retired |buffer_id| immediately after this call.
miu 2017/02/14 00:41:27 This sounds like the producer could write new data
chfremer 2017/02/14 21:15:16 Yes, the ID would be reused with a new buffer, not
32 virtual void OnBufferRetired(int buffer_id) = 0; 50 virtual void OnBufferRetired(int buffer_id) = 0;
51
52 virtual void OnError() = 0;
53 virtual void OnLog(const std::string& message) = 0;
33 }; 54 };
34 55
35 } // namespace media 56 } // namespace media
36 57
37 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_FRAME_RECEIVER_H_ 58 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_FRAME_RECEIVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698