Chromium Code Reviews| 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 module content.mojom; | 5 module content.mojom; |
| 6 | 6 |
| 7 import "gpu/ipc/common/sync_token.mojom"; | 7 import "gpu/ipc/common/sync_token.mojom"; |
| 8 import "media/mojo/interfaces/media_types.mojom"; | 8 import "media/mojo/interfaces/media_types.mojom"; |
| 9 import "mojo/common/common_custom_types.mojom"; | 9 import "mojo/common/common_custom_types.mojom"; |
| 10 import "services/video_capture/public/interfaces/video_capture_device_proxy.mojo m"; | 10 import "services/video_capture/public/interfaces/video_capture_device_proxy.mojo m"; |
| 11 import "services/video_capture/public/interfaces/video_capture_format.mojom"; | 11 import "services/video_capture/public/interfaces/video_capture_format.mojom"; |
| 12 import "ui/gfx/geometry/mojo/geometry.mojom"; | 12 import "ui/gfx/geometry/mojo/geometry.mojom"; |
| 13 | 13 |
| 14 // This file decribes the communication between a given Renderer Host interface | |
| 15 // implementation (VideoCaptureHost) and a remote VideoCaptureObserver. | |
| 16 // VideoCaptureHost offers a stateless part (GetDeviceSupportedFormats() and | |
| 17 // GetDeviceFormatsInUse()) that can be invoked at any time, and a stateful part | |
| 18 // sandwiched between Start() and Stop(). A Client's OnStateChanged() can be | |
| 19 // notified any time during the stateful part. The stateful part is composed of | |
| 20 // a preamble where a Renderer client sends a command to Start() the capture, | |
| 21 // registering itself as the associated remote VideoCaptureObserver. The Host | |
| 22 // will then create and pre- share a number of buffers: | |
| 23 // | |
| 24 // Observer VideoCaptureHost | |
| 25 // | --------- StartCapture --------> | | |
| 26 // | <------ OnStateChanged(STARTED) ---- | | |
| 27 // | <------- OnBufferCreated(1) -------- | | |
| 28 // | <------- OnBufferCreated(2) -------- | | |
| 29 // | |
| 30 // and capture will then refer to those preallocated buffers: | |
| 31 // | | | |
| 32 // | <-------- OnBufferReady(1) --------- | | |
| 33 // | <-------- OnBufferReady(2) --------- | | |
| 34 // | -------- ReleaseBuffer(1) ---------> | | |
| 35 // | <-------- OnBufferReady(1) --------- | | |
| 36 // | -------- ReleaseBuffer(2) ---------> | | |
| 37 // | <-------- OnBufferReady(2) --------- | | |
| 38 // | -------- 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.
| |
| 39 // | ... | | |
| 40 // = = | |
| 41 // | ... (resolution change) | | |
| 42 // | <------ OnBufferDestroyed(1) ------- | Buffers can be re-allocated | |
| 43 // | <------- OnBufferCreated(3) -------- | with a larger size, as | |
| 44 // | <-------- OnBufferReady(3) --------- | needed. | |
| 45 // | -------- ReleaseBuffer(1) ---------> | | |
| 46 // | <------ OnBufferDestroyed(2) ------- | | |
| 47 // | <------- OnBufferCreated(5) -------- | | |
| 48 // | <-------- OnBufferReady(5) --------- | | |
| 49 // | |
| 50 // In the communication epilogue, the client Stop()s capture, receiving a last | |
| 51 // status update: | |
| 52 // | |
| 53 // | --------- StopCapture ---------> | | |
| 54 // | <------ OnStateChanged(STOPPED) ---- | | |
| 55 | |
| 14 struct VideoCaptureParams { | 56 struct VideoCaptureParams { |
| 15 video_capture.mojom.VideoCaptureFormat requested_format; | 57 video_capture.mojom.VideoCaptureFormat requested_format; |
| 16 video_capture.mojom.ResolutionChangePolicy resolution_change_policy; | 58 video_capture.mojom.ResolutionChangePolicy resolution_change_policy; |
| 17 video_capture.mojom.PowerLineFrequency power_line_frequency; | 59 video_capture.mojom.PowerLineFrequency power_line_frequency; |
| 18 }; | 60 }; |
| 19 | 61 |
| 20 struct VideoFrameInfo{ | 62 struct VideoFrameInfo{ |
| 21 mojo.common.mojom.TimeDelta timestamp; | 63 mojo.common.mojom.TimeDelta timestamp; |
| 22 mojo.common.mojom.DictionaryValue metadata; | 64 mojo.common.mojom.DictionaryValue metadata; |
| 23 media.mojom.VideoPixelFormat pixel_format; | 65 media.mojom.VideoPixelFormat pixel_format; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 34 FAILED, | 76 FAILED, |
| 35 ENDED, | 77 ENDED, |
| 36 }; | 78 }; |
| 37 | 79 |
| 38 // Interface for notifications from Browser/Host back to Renderer/Client. This | 80 // Interface for notifications from Browser/Host back to Renderer/Client. This |
| 39 // interface is used between VideoCaptureHost.Start() and Stop(). | 81 // interface is used between VideoCaptureHost.Start() and Stop(). |
| 40 interface VideoCaptureObserver { | 82 interface VideoCaptureObserver { |
| 41 // Gets notified about a VideoCaptureState update. | 83 // Gets notified about a VideoCaptureState update. |
| 42 OnStateChanged(VideoCaptureState state); | 84 OnStateChanged(VideoCaptureState state); |
| 43 | 85 |
| 86 // A new buffer identified by |buffer_id| has been created for video capture. | |
| 87 OnBufferCreated(int32 buffer_id, handle<shared_buffer> handle_fd); | |
| 88 | |
| 44 // |buffer_id| has video capture data with |info| containing the associated | 89 // |buffer_id| has video capture data with |info| containing the associated |
| 45 // VideoFrame constituent parts. | 90 // VideoFrame constituent parts. |
| 46 OnBufferReady(int32 buffer_id, VideoFrameInfo info); | 91 OnBufferReady(int32 buffer_id, VideoFrameInfo info); |
| 47 | 92 |
| 48 // |buffer_id| has been released by VideoCaptureHost and must not be used. | 93 // |buffer_id| has been released by VideoCaptureHost and must not be used. |
| 49 OnBufferDestroyed(int32 buffer_id); | 94 OnBufferDestroyed(int32 buffer_id); |
| 50 | |
| 51 // TODO(mcasas): Migrate the rest of the messages, https://crbug.com/651897. | |
| 52 }; | 95 }; |
| 53 | 96 |
| 54 interface VideoCaptureHost { | 97 interface VideoCaptureHost { |
| 55 // Start the |session_id| session with |params|. The video capture will be | 98 // Start the |session_id| session with |params|. The video capture will be |
| 56 // identified as |device_id|, a new id picked by the renderer process. | 99 // identified as |device_id|, a new id picked by the renderer process. |
| 57 // |observer| will be used for notifications. | 100 // |observer| will be used for notifications. |
| 58 Start(int32 device_id, int32 session_id, VideoCaptureParams params, | 101 Start(int32 device_id, int32 session_id, VideoCaptureParams params, |
| 59 VideoCaptureObserver observer); | 102 VideoCaptureObserver observer); |
| 60 | 103 |
| 61 // Closes the video capture specified by |device_id|. | 104 // Closes the video capture specified by |device_id|. |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 77 double consumer_resource_utilization); | 120 double consumer_resource_utilization); |
| 78 | 121 |
| 79 // Get the formats supported by a device referenced by |session_id|. | 122 // Get the formats supported by a device referenced by |session_id|. |
| 80 GetDeviceSupportedFormats(int32 device_id, int32 session_id) | 123 GetDeviceSupportedFormats(int32 device_id, int32 session_id) |
| 81 => (array<video_capture.mojom.VideoCaptureFormat> formats_supported); | 124 => (array<video_capture.mojom.VideoCaptureFormat> formats_supported); |
| 82 | 125 |
| 83 // Get the format(s) in use by a device referenced by |session_id|. | 126 // Get the format(s) in use by a device referenced by |session_id|. |
| 84 GetDeviceFormatsInUse(int32 device_id, int32 session_id) | 127 GetDeviceFormatsInUse(int32 device_id, int32 session_id) |
| 85 => (array<video_capture.mojom.VideoCaptureFormat> formats_in_use); | 128 => (array<video_capture.mojom.VideoCaptureFormat> formats_in_use); |
| 86 }; | 129 }; |
| OLD | NEW |