Index: content/common/video_capture.mojom |
diff --git a/content/common/video_capture.mojom b/content/common/video_capture.mojom |
index 672b720fbdc95dafb6da75bc2dc1994601cb630b..b7e200702de08c963387b1142aa5d449b74d45c1 100644 |
--- a/content/common/video_capture.mojom |
+++ b/content/common/video_capture.mojom |
@@ -11,6 +11,47 @@ 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) | |
+// | ... | |
+// = = |
+// Buffers can be reallocated with a larger size, if e.g. resolution changes. |
+// | (resolution change) | |
+// | OnBufferDestroyed(1) <--- | |
+// | OnBufferCreated(3) <--- | |
+// | OnBufferReady(3) <--- | |
+// | ---> ReleaseBuffer(2) | |
+// | 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 +82,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 { |