Chromium Code Reviews| Index: content/common/video_capture.mojom |
| diff --git a/content/common/video_capture.mojom b/content/common/video_capture.mojom |
| index 672b720fbdc95dafb6da75bc2dc1994601cb630b..466696485546593c5c9859fe0aebe27e54385e82 100644 |
| --- a/content/common/video_capture.mojom |
| +++ b/content/common/video_capture.mojom |
| @@ -11,6 +11,48 @@ import "services/video_capture/public/interfaces/video_capture_device_proxy.mojo |
| import "services/video_capture/public/interfaces/video_capture_format.mojom"; |
| import "ui/gfx/geometry/mojo/geometry.mojom"; |
| +// This file decribes the communication between a given Renderer Host interface |
| +// implementation (VideoCaptureHost) and a remote VideoCaptureObserver. |
| +// VideoCaptureHost offers a stateless part (GetDeviceSupportedFormats() and |
| +// GetDeviceFormatsInUse()) that can be invoked at any time, and a stateful part |
| +// sandwiched between Start() and Stop(). A Client's OnStateChanged() can be |
| +// notified any time during the stateful part. The stateful part is composed of |
| +// a preamble where a Renderer client sends a command to Start() the capture, |
| +// registering itself as the associated remote VideoCaptureObserver. The Host |
| +// will then create and pre- share a number of buffers: |
| +// |
| +// Observer VideoCaptureHost |
| +// | --------- StartCapture --------> | |
| +// | <------ OnStateChanged(STARTED) ---- | |
| +// | <------- OnBufferCreated(1) -------- | |
| +// | <------- OnBufferCreated(2) -------- | |
| +// |
| +// and capture will then refer to those preallocated buffers: |
| +// | | |
| +// | <-------- OnBufferReady(1) --------- | |
| +// | <-------- OnBufferReady(2) --------- | |
| +// | -------- ReleaseBuffer(1) ---------> | |
| +// | <-------- OnBufferReady(1) --------- | |
| +// | -------- ReleaseBuffer(2) ---------> | |
| +// | <-------- OnBufferReady(2) --------- | |
| +// | -------- ReleaseBuffer(1) ---------> | |
|
ncarter (slow)
2016/10/19 18:58:21
This might be easier to look at with more whitespa
mcasas
2016/10/19 19:29:51
Good suggestion. Done.
|
| +// | ... | |
| +// = = |
| +// | ... (resolution change) | |
| +// | <------ OnBufferDestroyed(1) ------- | Buffers can be re-allocated |
| +// | <------- OnBufferCreated(3) -------- | with a larger size, as |
| +// | <-------- OnBufferReady(3) --------- | needed. |
| +// | -------- ReleaseBuffer(1) ---------> | |
| +// | <------ OnBufferDestroyed(2) ------- | |
| +// | <------- OnBufferCreated(5) -------- | |
| +// | <-------- OnBufferReady(5) --------- | |
| +// |
| +// In the communication epilogue, the client Stop()s capture, receiving a last |
| +// status update: |
| +// |
| +// | --------- StopCapture ---------> | |
| +// | <------ OnStateChanged(STOPPED) ---- | |
| + |
| struct VideoCaptureParams { |
| video_capture.mojom.VideoCaptureFormat requested_format; |
| video_capture.mojom.ResolutionChangePolicy resolution_change_policy; |
| @@ -41,14 +83,15 @@ interface VideoCaptureObserver { |
| // Gets notified about a VideoCaptureState update. |
| OnStateChanged(VideoCaptureState state); |
| + // A new buffer identified by |buffer_id| has been created for video capture. |
| + OnBufferCreated(int32 buffer_id, handle<shared_buffer> handle_fd); |
| + |
| // |buffer_id| has video capture data with |info| containing the associated |
| // VideoFrame constituent parts. |
| OnBufferReady(int32 buffer_id, VideoFrameInfo info); |
| // |buffer_id| has been released by VideoCaptureHost and must not be used. |
| OnBufferDestroyed(int32 buffer_id); |
| - |
| - // TODO(mcasas): Migrate the rest of the messages, https://crbug.com/651897. |
| }; |
| interface VideoCaptureHost { |