media_perception: MPS compatibility for M90.
Imports VCS mojom changes and ensures compatibility.
BUG=chromium:1183991
TEST=Verified that the VCS integration works for M90.
Change-Id: I716a2404e18a88f2e6e6bcb9756ccb2907326034
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2728945
Tested-by: Luke Sorenson <lasoren@chromium.org>
Commit-Queue: Luke Sorenson <lasoren@chromium.org>
Reviewed-by: Toni Baržić <tbarzic@chromium.org>
(cherry picked from commit d330f37d27b0c25a1e5bbabf581ae9e8882ee8cc)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/3039918
Reviewed-by: Matthew Ziegelbaum <ziegs@chromium.org>
diff --git a/media_perception/mojom/buffer_types.mojom b/media_perception/mojom/buffer_types.mojom
index 2f3ba36..9641ede 100644
--- a/media_perception/mojom/buffer_types.mojom
+++ b/media_perception/mojom/buffer_types.mojom
@@ -34,7 +34,12 @@
SCANOUT_CPU_READ_WRITE,
SCANOUT_VDA_WRITE,
GPU_READ_CPU_READ_WRITE,
+<<<<<<< HEAD (2781a1 arc: Stop touching /dev/.arc_sensor_ready for container)
SCANOUT_VEA_READ_CAMERA_AND_CPU_READ_WRITE,
+=======
+ SCANOUT_VEA_CPU_READ,
+ VEA_READ_CAMERA_AND_CPU_READ_WRITE,
+>>>>>>> CHANGE (d330f3 media_perception: MPS compatibility for M90.)
};
struct BufferUsageAndFormat {
diff --git a/media_perception/mojom/device.mojom b/media_perception/mojom/device.mojom
index 10b0396..d7a1809 100644
--- a/media_perception/mojom/device.mojom
+++ b/media_perception/mojom/device.mojom
@@ -26,4 +26,7 @@
=> (bool success);
TakePhoto()
=> (media.mojom.Blob? blob);
+ // |feedback| contains consumer feedback like resource utilization,
+ // maximum requested frame-rate and resolution.
+ ProcessFeedback(media.mojom.VideoFrameFeedback feedback);
};
diff --git a/media_perception/mojom/geometry.mojom b/media_perception/mojom/geometry.mojom
index 82218ae..7ed95f6 100644
--- a/media_perception/mojom/geometry.mojom
+++ b/media_perception/mojom/geometry.mojom
@@ -22,6 +22,7 @@
float z;
};
+[Stable]
struct Size {
int32 width;
int32 height;
diff --git a/media_perception/mojom/media_types.mojom b/media_perception/mojom/media_types.mojom
index 9554ca8..3f860ebe 100644
--- a/media_perception/mojom/media_types.mojom
+++ b/media_perception/mojom/media_types.mojom
@@ -37,6 +37,10 @@
[Native]
enum StatusCode;
+// See media/base/media_content_type.h for descriptions.
+[Native]
+enum MediaContentType;
+
// See media/base/media_log_record.h for description.
[Native]
struct MediaLogRecord;
@@ -65,6 +69,14 @@
[Native]
enum VideoPixelFormat;
+// See media/base/decoder.h for descriptions.
+[Native]
+enum VideoDecoderType;
+
+// See media/base/decoder.h for descriptions.
+[Native]
+enum AudioDecoderType;
+
// See media/base/video_transformation.h for descriptions.
enum VideoRotation {
kVideoRotation0,
@@ -79,6 +91,11 @@
kCopyMailboxesOnly,
};
+// see third_party/blink/public/platform/web_fullscreen_video_status.h for
+// descriptions.
+[Native]
+enum FullscreenVideoStatus;
+
// See media/base/video_transformation.h for descriptions.
struct VideoTransformation {
VideoRotation rotation;
@@ -298,8 +315,7 @@
bool read_lock_fences_enabled;
- bool has_rotation;
- VideoRotation rotation;
+ VideoTransformation? transformation;
bool texture_owner;
@@ -339,6 +355,8 @@
mojo_base.mojom.TimeTicks? receive_time;
mojo_base.mojom.TimeDelta? wallclock_frame_duration;
+
+ uint32 hw_protected_validation_id;
};
// This defines a mojo transport format for media::VideoFrame.
@@ -444,9 +462,16 @@
uint32 frames_power_efficient = 0;
};
-// See media/base/pipeline/status.h for descriptions.
-struct PipelineDecoderInfo {
- string decoder_name;
+// See media/base/pipeline_status.h for descriptions.
+struct AudioDecoderInfo {
+ AudioDecoderType decoder_type;
+ bool is_platform_decoder = false;
+ bool has_decrypting_demuxer_stream = false;
+};
+
+// See media/base/pipeline_status.h for descriptions.
+struct VideoDecoderInfo {
+ VideoDecoderType decoder_type;
bool is_platform_decoder = false;
bool has_decrypting_demuxer_stream = false;
};
@@ -459,3 +484,15 @@
array<media.mojom.Status> causes;
mojo_base.mojom.Value? data;
};
+
+// Types of media stream, categorised by the media stream's source.
+// The enum values are emitted to metrics. Do not reorder.
+enum MediaStreamType {
+ kLocalElementCapture = 0, // The source is a local capture from element.
+ kLocalDeviceCapture = 1, // The source is a local device capture, e.g. webcam.
+ kLocalTabCapture = 2, // The source is a local tab capture.
+ kLocalDesktopCapture = 3, // The source is a local desktop capture.
+ kLocalDisplayCapture = 4, // The source is a local display capture.
+ kRemote = 5, // The source is a remote peer connection.
+ kNone = 6, // Not a media stream.
+};
diff --git a/media_perception/mojom/unguessable_token.mojom b/media_perception/mojom/unguessable_token.mojom
index 42aa7e2..fbf1d38 100644
--- a/media_perception/mojom/unguessable_token.mojom
+++ b/media_perception/mojom/unguessable_token.mojom
@@ -5,6 +5,7 @@
module mojo_base.mojom;
// Corresponds to |base::UnguessableToken| in base/unguessable_token.h
+[Stable]
struct UnguessableToken {
uint64 high;
uint64 low;
diff --git a/media_perception/mojom/video_capture_types.mojom b/media_perception/mojom/video_capture_types.mojom
index 372a6c8..71cd162 100644
--- a/media_perception/mojom/video_capture_types.mojom
+++ b/media_perception/mojom/video_capture_types.mojom
@@ -43,6 +43,7 @@
XR30,
XB30,
BGRA,
+ RGBAF16,
};
enum ResolutionChangePolicy {
@@ -222,6 +223,12 @@
kFuchsiaSysmemInvalidBufferSize,
kFuchsiaUnsupportedPixelFormat,
kFuchsiaFailedToMapSysmemBuffer,
+<<<<<<< HEAD (2781a1 arc: Stop touching /dev/.arc_sensor_ready for container)
+=======
+ kCrosHalV3DeviceContextDuplicatedClient,
+ kDesktopCaptureDeviceMacFailedStreamCreate,
+ kDesktopCaptureDeviceMacFailedStreamStart,
+>>>>>>> CHANGE (d330f3 media_perception: MPS compatibility for M90.)
};
enum VideoCaptureFrameDropReason {
@@ -293,6 +300,13 @@
PlaneStrides? strides;
};
+// Represents a buffer that is ready for consumption. |buffer_id| has video
+// capture data and |info| contains the associated VideoFrame constituent parts.
+struct ReadyBuffer {
+ int32 buffer_id;
+ VideoFrameInfo info;
+};
+
// Represents information about a capture device.
// |device_id| represents a unique id of a physical device. Since the same
// physical device may be accessible through different APIs |capture_api|
diff --git a/media_perception/mojom/video_frame_handler.mojom b/media_perception/mojom/video_frame_handler.mojom
index f97c915..a52739f 100644
--- a/media_perception/mojom/video_frame_handler.mojom
+++ b/media_perception/mojom/video_frame_handler.mojom
@@ -7,6 +7,17 @@
import "mojom/video_capture_types.mojom";
import "mojom/scoped_access_permission.mojom";
+// Describes a new frame that is ready for consumption in the buffer with id
+// |buffer_id| and allows it to read the data from the buffer. The producer
+// guarantees that the buffer and its contents stay alive and unchanged until
+// |access_permission| is released.
+struct ReadyFrameInBuffer {
+ int32 buffer_id;
+ int32 frame_feedback_id;
+ pending_remote<ScopedAccessPermission> access_permission;
+ media.mojom.VideoFrameInfo frame_info;
+};
+
// Callback interface for receiving data and messages from a
// video_capture.mojom.Device or
// video_capture.mojom.PushVideoStreamSubscription.
@@ -19,13 +30,12 @@
// OnFrameReadyInBuffer().
OnNewBuffer(int32 buffer_id, media.mojom.VideoBufferHandle buffer_handle);
- // Indicates that a new frame is ready for consumption in the buffer with id
- // |buffer_id| and allows it to read the data from the buffer. The producer
- // guarantees that the buffer and its contents stay alive and unchanged until
- // VideoFrameHandler releases the given |access_permission|.
- OnFrameReadyInBuffer(int32 buffer_id, int32 frame_feedback_id,
- pending_remote<ScopedAccessPermission> access_permission,
- media.mojom.VideoFrameInfo frame_info);
+ // Indicates that a new frame is ready for consumption and optionally a set of
+ // scaled down versions of that frame. The producer guarantees that the
+ // buffer(s) and their contents stay alive and unchanged until
+ // VideoFrameHandler releases the |access_permission|s.
+ OnFrameReadyInBuffer(ReadyFrameInBuffer buffer,
+ array<ReadyFrameInBuffer> scaled_buffers);
// Indicates that the producer is no longer going to use the buffer with id
// |buffer_id| for frame delivery. This may be called even while the handler
diff --git a/media_perception/mojom/video_source.mojom b/media_perception/mojom/video_source.mojom
index 4b9bc8a..1404bb3 100644
--- a/media_perception/mojom/video_source.mojom
+++ b/media_perception/mojom/video_source.mojom
@@ -55,6 +55,10 @@
// requested for the new subscription will be ignored unless
// |force_reopen_with_new_settings| is set to true.
Close() => ();
+
+ // |feedback| contains consumer feedback like resource utilization,
+ // maximum requested frame-rate and resolution.
+ ProcessFeedback(media.mojom.VideoFrameFeedback feedback);
};
// Provides shared access to a specific video source to potentially multiple
diff --git a/media_perception/video_frame_handler_impl.cc b/media_perception/video_frame_handler_impl.cc
index 6d431f3..fe8ae9c 100644
--- a/media_perception/video_frame_handler_impl.cc
+++ b/media_perception/video_frame_handler_impl.cc
@@ -101,16 +101,13 @@
}
void VideoFrameHandlerImpl::OnFrameReadyInBuffer(
- int32_t buffer_id,
- int32_t frame_feedback_id,
- mojo::PendingRemote<video_capture::mojom::ScopedAccessPermission>
- permission,
- media::mojom::VideoFrameInfoPtr frame_info) {
+ video_capture::mojom::ReadyFrameInBufferPtr buffer,
+ std::vector<video_capture::mojom::ReadyFrameInBufferPtr> scaled_buffers) {
base::WritableSharedMemoryMapping* incoming_buffer =
- &incoming_buffer_id_to_buffer_map_.at(buffer_id);
+ &incoming_buffer_id_to_buffer_map_.at(buffer->buffer_id);
// Loop through all the registered frame handlers and push a frame out.
for (auto& entry : frame_handler_map_) {
- entry.second(frame_info->timestamp->microseconds,
+ entry.second(buffer->frame_info->timestamp->microseconds,
incoming_buffer->GetMemoryAs<const uint8_t>(),
incoming_buffer->size(), capture_format_.width_in_pixels(),
capture_format_.height_in_pixels());
diff --git a/media_perception/video_frame_handler_impl.h b/media_perception/video_frame_handler_impl.h
index ae6b7ef..6819f68 100644
--- a/media_perception/video_frame_handler_impl.h
+++ b/media_perception/video_frame_handler_impl.h
@@ -51,11 +51,9 @@
void OnNewBuffer(int32_t buffer_id,
media::mojom::VideoBufferHandlePtr buffer_handle) override;
void OnFrameReadyInBuffer(
- int32_t buffer_id,
- int32_t frame_feedback_id,
- mojo::PendingRemote<video_capture::mojom::ScopedAccessPermission>
- permission,
- media::mojom::VideoFrameInfoPtr frame_info) override;
+ video_capture::mojom::ReadyFrameInBufferPtr buffer,
+ std::vector<video_capture::mojom::ReadyFrameInBufferPtr> scaled_buffers)
+ override;
void OnFrameDropped(
::media::mojom::VideoCaptureFrameDropReason reason) override;
void OnBufferRetired(int32_t buffer_id) override;