Update VCS mojoms for M86.

BUG=chromium:1142691
TEST=Verified that the VCS integration works for M86.

Change-Id: Ic30486ed0464f9e1f10ca8fe63d2f20151c571de
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2501129
Tested-by: Luke Sorenson <lasoren@chromium.org>
Commit-Queue: Luke Sorenson <lasoren@chromium.org>
Reviewed-by: Toni Baržić <tbarzic@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2547212
diff --git a/media_perception/BUILD.gn b/media_perception/BUILD.gn
index fdd3b7a..e92f8d4 100644
--- a/media_perception/BUILD.gn
+++ b/media_perception/BUILD.gn
@@ -55,6 +55,7 @@
     "mojom/mailbox_holder.mojom",
     "mojom/media_perception.mojom",
     "mojom/media_perception_service.mojom",
+    "mojom/media_types.mojom",
     "mojom/native_handle_types.mojom",
     "mojom/occupancy_trigger.mojom",
     "mojom/one_touch_autozoom.mojom",
@@ -73,6 +74,7 @@
     "mojom/video_source.mojom",
     "mojom/video_source_provider.mojom",
     "mojom/virtual_device.mojom",
+    "mojom/vulkan_ycbcr_info.mojom",
   ]
 }
 
diff --git a/media_perception/mojo_connector.cc b/media_perception/mojo_connector.cc
index b58313e..7883b51 100644
--- a/media_perception/mojo_connector.cc
+++ b/media_perception/mojo_connector.cc
@@ -297,10 +297,10 @@
       media::mojom::VideoCaptureBufferType::kSharedMemoryViaRawFileDescriptor;
 
   device_it->second.video_source->CreatePushSubscription(
-      video_frame_handler_impl->CreateInterfacePtr(),
-      std::move(requested_settings),
-      force_reopen_with_settings,
-      mojo::MakeRequest(&device_it->second.push_video_stream_subscription),
+      video_frame_handler_impl->CreateInterfacePendingRemote(),
+      std::move(requested_settings), force_reopen_with_settings,
+      device_it->second.push_video_stream_subscription
+          .BindNewPipeAndPassReceiver(),
       base::Bind(&MojoConnector::OnCreatePushSubscriptionCallback,
                  base::Unretained(this), device_id, callback));
 }
diff --git a/media_perception/mojo_connector.h b/media_perception/mojo_connector.h
index b09c33f..aaa094b 100644
--- a/media_perception/mojo_connector.h
+++ b/media_perception/mojo_connector.h
@@ -13,6 +13,7 @@
 #include <base/bind.h>
 #include <base/single_thread_task_runner.h>
 #include <base/threading/thread.h>
+#include <mojo/public/cpp/bindings/remote.h>
 #include <mojo/core/embedder/scoped_ipc_support.h>
 #include <mojo/public/cpp/bindings/binding.h>
 
@@ -154,7 +155,7 @@
 
   struct VideoSourceAndPushSubscription {
     video_capture::mojom::VideoSourcePtr video_source;
-    video_capture::mojom::PushVideoStreamSubscriptionPtr
+    mojo::Remote<video_capture::mojom::PushVideoStreamSubscription>
         push_video_stream_subscription;
   };
 
diff --git a/media_perception/mojom/device.mojom b/media_perception/mojom/device.mojom
index 6734d7e..10b0396 100644
--- a/media_perception/mojom/device.mojom
+++ b/media_perception/mojom/device.mojom
@@ -17,7 +17,7 @@
 // completed and no further events are going to be sent to |handler|.
 interface Device {
   Start(media.mojom.VideoCaptureParams requested_settings,
-        VideoFrameHandler handler);
+        pending_remote<VideoFrameHandler> handler);
   MaybeSuspend();
   Resume();
   GetPhotoState()
diff --git a/media_perception/mojom/device_factory.mojom b/media_perception/mojom/device_factory.mojom
index b410a9a..0b597f6 100644
--- a/media_perception/mojom/device_factory.mojom
+++ b/media_perception/mojom/device_factory.mojom
@@ -37,7 +37,7 @@
   // Note: This design avoids the issue of it not being clear how soon after a
   // |device_receiver| has been (asynchronously) discarded a subsequent call to
   // CreateDevice() would succeed if it were to deny access while still in use.
-  CreateDevice(string device_id, Device& device_request)
+  CreateDevice(string device_id, pending_receiver<Device> device_receiver)
       => (DeviceAccessResultCode result_code);
 
   // Creates a new virtual capture device, which will be exposed by the device
@@ -53,22 +53,22 @@
   // |virtual_device| or the given |producer| is closed.
   AddSharedMemoryVirtualDevice(
       media.mojom.VideoCaptureDeviceInfo device_info,
-      Producer producer,
+      pending_remote<Producer> producer,
       bool send_buffer_handles_to_producer_as_raw_file_descriptors,
-      SharedMemoryVirtualDevice& virtual_device);
+      pending_receiver<SharedMemoryVirtualDevice> virtual_device_receiver);
 
   // Similar to AddSharedMemoryVirtualDevice() but for virtual devices that
   // are fed with textures (via MailboxHolders) allocated by the caller instead
   // of shared memory buffers provided by the service on demand.
   AddTextureVirtualDevice(
       media.mojom.VideoCaptureDeviceInfo device_info,
-      TextureVirtualDevice& virtual_device);
+      pending_receiver<TextureVirtualDevice> virtual_device_receiver);
 
   // Registered observers will get notified whenever a virtual device is added
   // or removed. Note: Changes to non-virtual devices are currently being
   // monitored outside the video capture service, and therefore the service
   // does not offer such monitoring.
   RegisterVirtualDevicesChangedObserver(
-      DevicesChangedObserver observer,
+      pending_remote<DevicesChangedObserver> observer,
       bool raise_event_if_virtual_devices_already_present);
 };
diff --git a/media_perception/mojom/geometry.mojom b/media_perception/mojom/geometry.mojom
index 78d28f0..82218ae 100644
--- a/media_perception/mojom/geometry.mojom
+++ b/media_perception/mojom/geometry.mojom
@@ -4,18 +4,13 @@
 
 module gfx.mojom;
 
-// Don't make backwards-incompatible changes to this definition!
-// It's used in PageState serialization, so backwards incompatible changes
-// would cause stored PageState objects to be un-parseable.
+[Stable]
 struct Point {
   int32 x;
   int32 y;
 };
 
-// Don't make backwards-incompatible changes to this definition!
-// It's used in PageState serialization, so backwards incompatible changes
-// would cause stored PageState objects to be un-parseable. Please contact the
-// page state serialization owners before making such a change.
+[Stable]
 struct PointF {
   float x;
   float y;
diff --git a/media_perception/mojom/media_types.mojom b/media_perception/mojom/media_types.mojom
new file mode 100644
index 0000000..9554ca8
--- /dev/null
+++ b/media_perception/mojom/media_types.mojom
@@ -0,0 +1,461 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+module media.mojom;
+
+import "mojom/mailbox_holder.mojom";
+import "mojom/vulkan_ycbcr_info.mojom";
+import "mojom/time.mojom";
+import "mojom/values.mojom";
+import "mojom/unguessable_token.mojom";
+import "mojom/geometry.mojom";
+import "mojom/buffer_types.mojom";
+import "mojom/color_space.mojom";
+
+// See media/base/audio_codecs.h for descriptions.
+[Native]
+enum AudioCodec;
+[Native]
+enum AudioCodecProfile;
+
+// See media/base/buffering_state.h for descriptions.
+[Native]
+enum BufferingState;
+[Native]
+enum BufferingStateChangeReason;
+
+// See media/base/channel_layout.h for descriptions.
+[Native]
+enum ChannelLayout;
+
+// See media/base/decode_status.h for descriptions.
+[Native]
+enum DecodeStatus;
+
+// See media/base/status_codes.h for descriptions.
+[Native]
+enum StatusCode;
+
+// See media/base/media_log_record.h for description.
+[Native]
+struct MediaLogRecord;
+
+// See media/base/output_device_info.h for descriptions.
+[Native]
+enum OutputDeviceStatus;
+
+// See media/base/pipeline_status.h for descriptions.
+[Native]
+enum PipelineStatus;
+
+// See media/base/sample_format.h for descriptions.
+[Native]
+enum SampleFormat;
+
+// See media/base/video_codecs.h for descriptions.
+[Native]
+enum VideoCodec;
+
+// See media/base/video_codecs.h for descriptions.
+[Native]
+enum VideoCodecProfile;
+
+// See media/base/video_types.h for descriptions.
+[Native]
+enum VideoPixelFormat;
+
+// See media/base/video_transformation.h for descriptions.
+enum VideoRotation {
+  kVideoRotation0,
+  kVideoRotation90,
+  kVideoRotation180,
+  kVideoRotation270,
+};
+
+// see media/base/video_frame_metadata.h for descriptions.
+enum CopyMode {
+  kCopyToNewTexture,
+  kCopyMailboxesOnly,
+};
+
+// See media/base/video_transformation.h for descriptions.
+struct VideoTransformation {
+  VideoRotation rotation;
+  bool mirrored;
+};
+
+// See media/base/waiting.h for descriptions.
+[Native]
+enum WaitingReason;
+
+// See media/base/watch_time_keys.h for descriptions.
+[Native]
+enum WatchTimeKey;
+
+// See media/base/container_names.h for descriptions.
+[Native]
+enum MediaContainerName;
+
+// See media/base/media_status.h for description.
+[Native]
+enum MediaStatusState;
+
+// This defines a mojo transport format for media::EncryptionPattern
+// See media/base/encryption_pattern.h for description.
+struct EncryptionPattern {
+  uint32 crypt_byte_block;
+  uint32 skip_byte_block;
+};
+
+// See media/base/encryption_scheme.h for description.
+[Native]
+enum EncryptionScheme;
+
+// This defines a mojo transport format for media::VideoColorSpace.
+// See media/base/video_color_space.h for description.
+struct VideoColorSpace {
+  [Native]
+  enum PrimaryID;
+
+  [Native]
+  enum TransferID;
+
+  [Native]
+  enum MatrixID;
+
+  [Native]
+  enum RangeID;
+
+  PrimaryID primaries;
+  TransferID transfer;
+  MatrixID matrix;
+  RangeID range;
+};
+
+// This defines a mojo transport format for media::HDRMetadata.
+// See media/base/hdr_metadata.h for description.
+struct MasteringMetadata {
+  gfx.mojom.PointF primary_r;
+  gfx.mojom.PointF primary_g;
+  gfx.mojom.PointF primary_b;
+  gfx.mojom.PointF white_point;
+  float luminance_max;
+  float luminance_min;
+};
+
+struct HDRMetadata {
+  MasteringMetadata mastering_metadata;
+  uint32 max_content_light_level;
+  uint32 max_frame_average_light_level;
+};
+
+// This defines a mojo transport format for media::AudioDecoderConfig.
+// See media/base/audio_decoder_config.h for descriptions.
+struct AudioDecoderConfig {
+  AudioCodec codec;
+  AudioCodecProfile profile;
+  SampleFormat sample_format;
+  ChannelLayout channel_layout;
+  int32 samples_per_second;
+  array<uint8> extra_data;
+  mojo_base.mojom.TimeDelta seek_preroll;
+  int32 codec_delay;
+  EncryptionScheme encryption_scheme;
+};
+
+// This defines a mojo transport format for media::VideoDecoderConfig.
+// See media/base/video_decoder_config.h for descriptions.
+struct VideoDecoderConfig {
+  VideoCodec codec;
+  VideoCodecProfile profile;
+  uint32 level;
+  bool has_alpha;
+  VideoTransformation transformation;
+  gfx.mojom.Size coded_size;
+  gfx.mojom.Rect visible_rect;
+  gfx.mojom.Size natural_size;
+  array<uint8> extra_data;
+  EncryptionScheme encryption_scheme;
+  VideoColorSpace color_space_info;
+  HDRMetadata? hdr_metadata;
+};
+
+// Native struct media::SubsampleEntry;
+[Native]
+struct SubsampleEntry;
+
+// This defines a mojo transport format for media::DecryptConfig.
+// See media/base/decrypt_config.h for descriptions.
+struct DecryptConfig {
+  EncryptionScheme encryption_scheme;
+  string key_id;
+  string iv;
+  array<SubsampleEntry> subsamples;
+  EncryptionPattern? encryption_pattern;
+};
+
+// This defines a mojo transport format for media::DecoderBuffer.
+struct DecoderBuffer {
+  mojo_base.mojom.TimeDelta timestamp;
+  mojo_base.mojom.TimeDelta duration;
+
+  // Whether the buffer is an end-of-stream (EOS) buffer.
+  bool is_end_of_stream;
+
+  // The number of bytes present in this buffer. The data is not serialized
+  // along with this structure and must be read from a separate DataPipe.
+  // Note that |data_size| could be zero even for a non-EOS buffer (e.g.
+  // with non-empty |size_data|). See http://crbug.com/663438
+  uint32 data_size;
+
+  // Indicates whether or not this buffer is a random access point.
+  bool is_key_frame;
+
+  // Empty when |side_data| doesn't exist.
+  array<uint8> side_data;
+
+  // DecryptConfig for a encrypted buffer. NULL if the buffer is not encrypted.
+  DecryptConfig? decrypt_config;
+
+  // These fields indicate the amount of data to discard after decoding.
+  mojo_base.mojom.TimeDelta front_discard;
+  mojo_base.mojom.TimeDelta back_discard;
+};
+
+// This defines a mojo transport format for media::AudioBuffer.
+struct AudioBuffer {
+  // Format of the audio.
+  SampleFormat sample_format;
+
+  // How the channels are laid out.
+  ChannelLayout channel_layout;
+
+  // Number of channels.
+  int32 channel_count;
+
+  // Sample rate of the buffer.
+  int32 sample_rate;
+
+  // Number of frames in the buffer.
+  int32 frame_count;
+
+  // True if end of stream.
+  bool end_of_stream;
+
+  // Timestamp in microseconds of the first frame.
+  mojo_base.mojom.TimeDelta timestamp;
+
+  // Channel data. Will be empty for EOS buffers.
+  array<uint8> data;
+};
+
+// This defines a mojo transport format for an interleaved, signed
+// 16-bit audio buffer.
+struct AudioDataS16 {
+  // Number of channels.
+  int32 channel_count;
+
+  // Sample rate of the buffer.
+  int32 sample_rate;
+
+  // Number of frames in the buffer.
+  int32 frame_count;
+
+  // Channel data.
+  array<int16> data;
+};
+
+// See media/base/video_frame_metadata.h for a description of fields.
+// TODO(crbug.com/657632): Remove |has_*| values and use nullable types.
+struct VideoFrameMetadata {
+  bool allow_overlay;
+
+  mojo_base.mojom.TimeTicks? capture_begin_time;
+  mojo_base.mojom.TimeTicks? capture_end_time;
+
+  bool has_capture_counter;
+  int32 capture_counter;
+
+  gfx.mojom.Rect? capture_update_rect;
+
+  bool has_copy_mode;
+  CopyMode copy_mode;
+
+  bool end_of_stream;
+
+  mojo_base.mojom.TimeDelta? frame_duration;
+
+  bool has_frame_rate;
+  double frame_rate;
+
+  bool interactive_content;
+
+  mojo_base.mojom.TimeTicks? reference_time;
+
+  bool has_resource_utilization;
+  double resource_utilization;
+
+  bool read_lock_fences_enabled;
+
+  bool has_rotation;
+  VideoRotation rotation;
+
+  bool texture_owner;
+
+  bool wants_promotion_hint;
+
+  bool protected_video;
+
+  bool hw_protected;
+
+  mojo_base.mojom.UnguessableToken? overlay_plane_id;
+
+  bool power_efficient;
+
+  bool has_device_scale_factor;
+  double device_scale_factor;
+
+  bool has_page_scale_factor;
+  double page_scale_factor;
+
+  bool has_root_scroll_offset_x;
+  double root_scroll_offset_x;
+
+  bool has_root_scroll_offset_y;
+  double root_scroll_offset_y;
+
+  bool has_top_controls_visible_height;
+  double top_controls_visible_height;
+
+  mojo_base.mojom.TimeTicks? decode_begin_time;
+  mojo_base.mojom.TimeTicks? decode_end_time;
+
+  mojo_base.mojom.TimeDelta? processing_time;
+
+  bool has_rtp_timestamp;
+  double rtp_timestamp;
+
+  mojo_base.mojom.TimeTicks? receive_time;
+
+  mojo_base.mojom.TimeDelta? wallclock_frame_duration;
+};
+
+// This defines a mojo transport format for media::VideoFrame.
+struct VideoFrame {
+  // Format of the frame.
+  VideoPixelFormat format;
+
+  // Width and height of the video frame, in pixels.
+  gfx.mojom.Size coded_size;
+
+  // Visible size of the frame.
+  gfx.mojom.Rect visible_rect;
+
+  // Natural size of the frame.
+  gfx.mojom.Size natural_size;
+
+  // Timestamp in microseconds of the associated frame.
+  mojo_base.mojom.TimeDelta timestamp;
+
+  // Contents of the video frame (or EOS marker).
+  VideoFrameData data;
+
+  // Extra properties associated with the VideoFrame.
+  VideoFrameMetadata metadata;
+
+  gfx.mojom.ColorSpace color_space;
+  HDRMetadata? hdr_metadata;
+};
+
+// Possible choices for storing VideoFrame data.
+union VideoFrameData {
+  EosVideoFrameData eos_data;
+  SharedBufferVideoFrameData shared_buffer_data;
+  DmabufVideoFrameData dmabuf_data;
+  GpuMemoryBufferVideoFrameData gpu_memory_buffer_data;
+  MailboxVideoFrameData mailbox_data;
+};
+
+// A marker for EOS frames.
+struct EosVideoFrameData {
+};
+
+// This defines video frame data stored in a Mojo shared buffer.
+struct SharedBufferVideoFrameData {
+  // Reference to the shared memory containing the frame's data.
+  handle<shared_buffer> frame_data;
+  uint64 frame_data_size;
+
+  // Stride and offsets for each plane. Offsets are relative to the start
+  // of |frame_data|.
+  array<int32> strides;
+  array<uint32> offsets;
+};
+
+// This defines video frame data stored in dmabuf.
+struct DmabufVideoFrameData {
+  // Size depends on media::VideoFrame::NumPlanes with frame format.
+  array<handle> dmabuf_fds;
+};
+
+struct GpuMemoryBufferVideoFrameData {
+  gfx.mojom.GpuMemoryBufferHandle gpu_memory_buffer_handle;
+  array<gpu.mojom.MailboxHolder, 4> mailbox_holder;
+};
+
+// This defines video frame data stored in texture mailboxes.
+struct MailboxVideoFrameData {
+  // Size must be kept in sync with media::VideoFrame::kMaxPlanes.
+  array<gpu.mojom.MailboxHolder, 4> mailbox_holder;
+  gpu.mojom.VulkanYCbCrInfo? ycbcr_data;
+};
+
+struct PipelineStatistics {
+  uint64 audio_bytes_decoded;
+  uint64 video_bytes_decoded;
+  uint32 video_frames_decoded;
+  uint32 video_frames_dropped;
+  int64 audio_memory_usage;
+  int64 video_memory_usage;
+};
+
+// Set of features for MediaCapabilities prediction.
+// TODO(liberato): consider generalizing this.
+struct PredictionFeatures {
+    // It would be nice to initialize this to VIDEO_CODEC_PROFILE_UNKNOWN (-1),
+    // but we can't do that with native enums.
+    VideoCodecProfile profile;
+    gfx.mojom.Size video_size;
+    // Frames per second may ultimately be a bucketed as an integer, but we want
+    // to do that as late as possible. Using a double avoids early truncation.
+    double frames_per_sec = 0;
+    // Name of the key system used for EME playbacks.
+    string key_system;
+    // Indicates when CDM will use HW secure decoding for EME playbacks.
+    bool use_hw_secure_codecs = false;
+};
+
+// Target values for MediaCapabilities predictions.
+// TODO(liberato): consider generalizing this.
+struct PredictionTargets {
+  uint32 frames_decoded = 0;
+  uint32 frames_dropped = 0;
+  uint32 frames_power_efficient = 0;
+};
+
+// See media/base/pipeline/status.h for descriptions.
+struct PipelineDecoderInfo {
+  string decoder_name;
+  bool is_platform_decoder = false;
+  bool has_decrypting_demuxer_stream = false;
+};
+
+// See media/base/status.h for descriptions.
+struct Status {
+  StatusCode code;
+  string? message;
+  array<mojo_base.mojom.Value> frames;
+  array<media.mojom.Status> causes;
+  mojo_base.mojom.Value? data;
+};
diff --git a/media_perception/mojom/time.mojom b/media_perception/mojom/time.mojom
index 78cde1a..64777e5 100644
--- a/media_perception/mojom/time.mojom
+++ b/media_perception/mojom/time.mojom
@@ -4,6 +4,7 @@
 
 module mojo_base.mojom;
 
+[Stable]
 struct Time {
   // The internal value is expressed in terms of microseconds since a fixed but
   // intentionally unspecified epoch.
diff --git a/media_perception/mojom/video_capture_types.mojom b/media_perception/mojom/video_capture_types.mojom
index fecca9c..372a6c8 100644
--- a/media_perception/mojom/video_capture_types.mojom
+++ b/media_perception/mojom/video_capture_types.mojom
@@ -5,9 +5,9 @@
 module media.mojom;
 
 import "mojom/mailbox_holder.mojom";
+import "mojom/media_types.mojom";
 import "mojom/shared_memory.mojom";
 import "mojom/time.mojom";
-import "mojom/values.mojom";
 import "mojom/geometry.mojom";
 import "mojom/buffer_types.mojom";
 import "mojom/color_space.mojom";
@@ -279,7 +279,7 @@
 
 struct VideoFrameInfo{
   mojo_base.mojom.TimeDelta timestamp;
-  mojo_base.mojom.DictionaryValue metadata;
+  VideoFrameMetadata metadata;
   VideoCapturePixelFormat pixel_format;
   gfx.mojom.Size coded_size;
   gfx.mojom.Rect visible_rect;
@@ -293,15 +293,22 @@
   PlaneStrides? strides;
 };
 
+// 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|
+// disambiguates the API.
 struct VideoCaptureDeviceDescriptor {
   string display_name;
   string device_id;
   string model_id;
   VideoFacingMode facing_mode;
   VideoCaptureApi capture_api;
+  bool pan_tilt_zoom_supported;
   VideoCaptureTransportType transport_type;
 };
 
+// Bundles a VideoCaptureDeviceDescriptor with corresponding supported
+// video formats.
 struct VideoCaptureDeviceInfo {
   VideoCaptureDeviceDescriptor descriptor;
   array<VideoCaptureFormat> supported_formats;
diff --git a/media_perception/mojom/video_frame_handler.mojom b/media_perception/mojom/video_frame_handler.mojom
index c7e46bd..f97c915 100644
--- a/media_perception/mojom/video_frame_handler.mojom
+++ b/media_perception/mojom/video_frame_handler.mojom
@@ -24,7 +24,7 @@
   // 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,
-                       ScopedAccessPermission access_permission,
+                       pending_remote<ScopedAccessPermission> access_permission,
                        media.mojom.VideoFrameInfo frame_info);
 
   // Indicates that the producer is no longer going to use the buffer with id
diff --git a/media_perception/mojom/video_source.mojom b/media_perception/mojom/video_source.mojom
index 9691211..4b9bc8a 100644
--- a/media_perception/mojom/video_source.mojom
+++ b/media_perception/mojom/video_source.mojom
@@ -81,10 +81,10 @@
   // potentially briefly interrupt the video stream received by other
   // subscribers.
   CreatePushSubscription(
-      VideoFrameHandler subscriber,
+      pending_remote<VideoFrameHandler> subscriber,
       media.mojom.VideoCaptureParams requested_settings,
       bool force_reopen_with_new_settings,
-      PushVideoStreamSubscription& subscription)
+      pending_receiver<PushVideoStreamSubscription> subscription)
       => (CreatePushSubscriptionResultCode result_code,
           media.mojom.VideoCaptureParams settings_source_was_opened_with);
 };
diff --git a/media_perception/mojom/video_source_provider.mojom b/media_perception/mojom/video_source_provider.mojom
index 8fe419b..ff227cd 100644
--- a/media_perception/mojom/video_source_provider.mojom
+++ b/media_perception/mojom/video_source_provider.mojom
@@ -17,7 +17,7 @@
   // This essentially constrains things down to a particular source. This is
   // useful for subsequently passing the resulting |stream| to clients that
   // are supposed to get access to only a particular source.
-  GetVideoSource(string source_id, VideoSource& stream);
+  GetVideoSource(string source_id, pending_receiver<VideoSource> stream);
 
   // Creates a new virtual capture device, which will be exposed
   // using the given |device_info|. The returned |virtual_device| is to
@@ -32,23 +32,23 @@
   // |virtual_device| or the given |producer| is closed.
   AddSharedMemoryVirtualDevice(
       media.mojom.VideoCaptureDeviceInfo device_info,
-      Producer producer,
+      pending_remote<Producer> producer,
       bool send_buffer_handles_to_producer_as_raw_file_descriptors,
-      SharedMemoryVirtualDevice& virtual_device_receiver);
+      pending_receiver<SharedMemoryVirtualDevice> virtual_device_receiver);
 
   // Similar to AddSharedMemoryVirtualDevice() but for virtual devices that
   // are fed with textures (via MailboxHolders) allocated by the caller instead
   // of shared memory buffers provided by the service on demand.
   AddTextureVirtualDevice(
       media.mojom.VideoCaptureDeviceInfo device_info,
-      TextureVirtualDevice& virtual_device_receiver);
+      pending_receiver<TextureVirtualDevice> virtual_device_receiver);
 
   // Registered observers will get notified whenever a virtual device is added
   // or removed. Note: Changes to non-virtual devices are currently being
   // monitored outside the video capture service, and therefore the service
   // does not offer such monitoring.
   RegisterVirtualDevicesChangedObserver(
-      DevicesChangedObserver observer,
+      pending_remote<DevicesChangedObserver> observer,
       bool raise_event_if_virtual_devices_already_present);
 
   // Closes the connection and allows clients to wait until the disconnect has
diff --git a/media_perception/mojom/virtual_device.mojom b/media_perception/mojom/virtual_device.mojom
index 57da046..16cfb23 100644
--- a/media_perception/mojom/virtual_device.mojom
+++ b/media_perception/mojom/virtual_device.mojom
@@ -59,7 +59,7 @@
   // of the frame, i.e. using |visible_rect| to crop to subregions of the frame
   // is not supported.
   OnFrameReadyInBuffer(int32 buffer_id,
-                       ScopedAccessPermission access_permission,
+                       pending_remote<ScopedAccessPermission> access_permission,
                        media.mojom.VideoFrameInfo frame_info);
   // Unregisters a set of mailbox holders previously registered via
   // OnNewMailboxHolderBufferHandle(). Note, that this should not be called
diff --git a/media_perception/mojom/vulkan_ycbcr_info.mojom b/media_perception/mojom/vulkan_ycbcr_info.mojom
new file mode 100644
index 0000000..c606dd5
--- /dev/null
+++ b/media_perception/mojom/vulkan_ycbcr_info.mojom
@@ -0,0 +1,20 @@
+// Copyright 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+module gpu.mojom;
+
+// Sampler Ycbcr conversion information. All of this struct parameters are
+// enums defined in the vulkan api which are passed as uint32/uint64 over ipc.
+// We use all of these values in an "opaque" way and don't consume it directly
+// in chrome.
+// See gpu/ipc/common/vulkan_ycbcr_info.h.
+struct VulkanYCbCrInfo {
+  uint32 image_format;
+  uint64 external_format;
+  uint32 suggested_ycbcr_model;
+  uint32 suggested_ycbcr_range;
+  uint32 suggested_xchroma_offset;
+  uint32 suggested_ychroma_offset;
+  uint32 format_features;
+};
diff --git a/media_perception/producer_impl.cc b/media_perception/producer_impl.cc
index 088d97c..662e324 100644
--- a/media_perception/producer_impl.cc
+++ b/media_perception/producer_impl.cc
@@ -13,18 +13,19 @@
 
 namespace mri {
 
-video_capture::mojom::ProducerPtr ProducerImpl::CreateInterfacePtr() {
-  video_capture::mojom::ProducerPtr server_ptr;
-  binding_.Bind(mojo::MakeRequest(&server_ptr));
-  return server_ptr;
+mojo::PendingRemote<video_capture::mojom::Producer>
+ProducerImpl::CreateInterfacePendingRemote() {
+  mojo::PendingRemote<video_capture::mojom::Producer> producer;
+  receiver_.Bind(producer.InitWithNewPipeAndPassReceiver());
+  return producer;
 }
 
 void ProducerImpl::RegisterVirtualDevice(
     video_capture::mojom::VideoSourceProviderPtr* provider,
     media::mojom::VideoCaptureDeviceInfoPtr info) {
-  (*provider)->AddSharedMemoryVirtualDevice(std::move(info),
-                                           CreateInterfacePtr(), true,
-                                           mojo::MakeRequest(&virtual_device_));
+  (*provider)->AddSharedMemoryVirtualDevice(
+      std::move(info), CreateInterfacePendingRemote(), true,
+      mojo::MakeRequest(&virtual_device_));
 }
 
 void ProducerImpl::OnNewBuffer(int32_t buffer_id,
@@ -87,7 +88,7 @@
   rect->width = width;
   rect->height = height;
   info->visible_rect = std::move(rect);
-  info->metadata = mojo_base::mojom::DictionaryValue::New();
+  info->metadata = media::mojom::VideoFrameMetadata::New();
 
   SharedMemoryProvider* outgoing_buffer =
       outgoing_buffer_id_to_buffer_map_.at(buffer_id).get();
diff --git a/media_perception/producer_impl.h b/media_perception/producer_impl.h
index fca9a6f..9c71587 100644
--- a/media_perception/producer_impl.h
+++ b/media_perception/producer_impl.h
@@ -8,6 +8,8 @@
 #include <base/bind.h>
 #include <map>
 #include <memory>
+#include <mojo/public/cpp/bindings/pending_remote.h>
+#include <mojo/public/cpp/bindings/receiver.h>
 
 #include "media_perception/shared_memory_provider.h"
 #include "mojom/producer.mojom.h"
@@ -18,7 +20,7 @@
 
 class ProducerImpl : public video_capture::mojom::Producer {
  public:
-  ProducerImpl() : binding_(this) {}
+  ProducerImpl() : receiver_(this) {}
 
   // factory is owned by the caller.
   void RegisterVirtualDevice(
@@ -38,10 +40,11 @@
   void OnBufferRetired(int32_t buffer_id) override;
 
  private:
-  // Creates a ProducerPtr that is bound to this instance through a message
-  // pipe. When calling this more than once, the previously return ProducerPtr
-  // will get unbound.
-  video_capture::mojom::ProducerPtr CreateInterfacePtr();
+  // Creates a Producer PendingRemote that is bound to this instance through
+  // a message pipe. When calling this more than once, the previously return
+  // PendingRemote will get unbound.
+  mojo::PendingRemote<video_capture::mojom::Producer>
+  CreateInterfacePendingRemote();
 
   void OnFrameBufferReceived(std::shared_ptr<ProducerImpl> producer_impl,
                              base::TimeDelta timestamp,
@@ -51,7 +54,7 @@
                              int width, int height, int32_t buffer_id);
 
   // Binding of the Producer interface to message pipe.
-  mojo::Binding<video_capture::mojom::Producer> binding_;
+  mojo::Receiver<video_capture::mojom::Producer> receiver_;
 
   // Provides an interface to a created virtual device.
   video_capture::mojom::SharedMemoryVirtualDevicePtr virtual_device_;
diff --git a/media_perception/proto_mojom_conversion.cc b/media_perception/proto_mojom_conversion.cc
index cefc6c3..f835434 100644
--- a/media_perception/proto_mojom_conversion.cc
+++ b/media_perception/proto_mojom_conversion.cc
@@ -321,7 +321,9 @@
   if (status_ptr.is_null())
     return status;
   status.set_success(status_ptr->success);
-  status.set_failure_reason(*status_ptr->failure_reason);
+  if (status_ptr->failure_reason.has_value()) {
+    status.set_failure_reason(*status_ptr->failure_reason);
+  }
   return status;
 }
 
@@ -358,8 +360,12 @@
   if (device_ptr.is_null())
     return device;
   device.set_id(device_ptr->id);
-  device.set_display_name(*device_ptr->display_name);
-  device.set_model_id(*device_ptr->model_id);
+  if (device_ptr->display_name.has_value()) {
+    device.set_display_name(*device_ptr->display_name);
+  }
+  if (device_ptr->model_id.has_value()) {
+    device.set_model_id(*device_ptr->model_id);
+  }
   for (int i = 0; i < device_ptr->supported_configurations.size(); i++) {
     mri::VideoStreamParams* params = device.add_supported_configurations();
     *params = ToProto(device_ptr->supported_configurations[i]);
@@ -419,7 +425,9 @@
     return device;
 
   device.set_id(device_ptr->id);
-  device.set_display_name(*device_ptr->display_name);
+  if (device_ptr->display_name.has_value()) {
+    device.set_display_name(*device_ptr->display_name);
+  }
   for (int i = 0; i < device_ptr->supported_configurations.size(); i++) {
     mri::AudioStreamParams* params = device.add_supported_configurations();
     *params = ToProto(device_ptr->supported_configurations[i]);
@@ -571,7 +579,9 @@
     return entity;
 
   entity.set_type(ToProto(entity_ptr->type));
-  entity.set_label(*entity_ptr->label);
+  if (entity_ptr->label.has_value()) {
+    entity.set_label(*entity_ptr->label);
+  }
   *entity.mutable_bounding_box() = ToProto(entity_ptr->bounding_box);
   entity.set_confidence(entity_ptr->confidence);
   *entity.mutable_depth() = ToProto(entity_ptr->depth);
@@ -637,8 +647,12 @@
   if (error_ptr.is_null())
     return error;
   error.set_error_type(ToProto(error_ptr->error_type));
-  error.set_error_source(*error_ptr->error_source);
-  error.set_error_string(*error_ptr->error_string);
+  if (error_ptr->error_source.has_value()) {
+    error.set_error_source(*error_ptr->error_source);
+  }
+  if (error_ptr->error_string.has_value()) {
+    error.set_error_string(*error_ptr->error_string);
+  }
   return error;
 }
 
@@ -650,7 +664,9 @@
   state.set_status(ToProto(state_ptr->status));
 
   *state.mutable_error() = ToProto(state_ptr->error);
-  state.set_configuration_name(*state_ptr->configuration_name);
+  if (state_ptr->configuration_name.has_value()) {
+    state.set_configuration_name(*state_ptr->configuration_name);
+  }
   return state;
 }
 
diff --git a/media_perception/video_frame_handler_impl.cc b/media_perception/video_frame_handler_impl.cc
index 66444e4..0a4a4f5 100644
--- a/media_perception/video_frame_handler_impl.cc
+++ b/media_perception/video_frame_handler_impl.cc
@@ -54,10 +54,11 @@
   return true;
 }
 
-video_capture::mojom::VideoFrameHandlerPtr VideoFrameHandlerImpl::CreateInterfacePtr() {
-  video_capture::mojom::VideoFrameHandlerPtr server_ptr;
-  binding_.Bind(mojo::MakeRequest(&server_ptr));
-  return server_ptr;
+mojo::PendingRemote<video_capture::mojom::VideoFrameHandler>
+VideoFrameHandlerImpl::CreateInterfacePendingRemote() {
+  mojo::PendingRemote<video_capture::mojom::VideoFrameHandler> handler;
+  receiver_.Bind(handler.InitWithNewPipeAndPassReceiver());
+  return handler;
 }
 
 void VideoFrameHandlerImpl::OnNewBuffer(
@@ -80,8 +81,10 @@
 }
 
 void VideoFrameHandlerImpl::OnFrameReadyInBuffer(
-    int32_t buffer_id, int32_t frame_feedback_id,
-    video_capture::mojom::ScopedAccessPermissionPtr permission,
+    int32_t buffer_id,
+    int32_t frame_feedback_id,
+    mojo::PendingRemote<video_capture::mojom::ScopedAccessPermission>
+        permission,
     media::mojom::VideoFrameInfoPtr frame_info) {
   SharedMemoryProvider* incoming_buffer =
       incoming_buffer_id_to_buffer_map_.at(buffer_id).get();
diff --git a/media_perception/video_frame_handler_impl.h b/media_perception/video_frame_handler_impl.h
index b7cc3c6..ddbfb57 100644
--- a/media_perception/video_frame_handler_impl.h
+++ b/media_perception/video_frame_handler_impl.h
@@ -9,6 +9,12 @@
 #include <map>
 #include <memory>
 #include <mojo/public/cpp/bindings/binding.h>
+#include <mojo/public/cpp/bindings/pending_remote.h>
+#include <mojo/public/cpp/bindings/receiver.h>
+#include <string>
+
+#include <base/memory/unsafe_shared_memory_region.h>
+#include <mojo/public/cpp/bindings/binding.h>
 #include <string>
 
 #include "base/logging.h"
@@ -22,9 +28,7 @@
 
 class VideoFrameHandlerImpl : public video_capture::mojom::VideoFrameHandler {
  public:
-  VideoFrameHandlerImpl() :
-    frame_handler_id_counter_(0),
-    binding_(this) {}
+  VideoFrameHandlerImpl() : frame_handler_id_counter_(0), receiver_(this) {}
 
   bool HasValidCaptureFormat();
 
@@ -35,8 +39,9 @@
   // Checks if the frame dimensions match the current dimensions.
   bool CaptureFormatsMatch(const VideoStreamParams& params);
 
-  // Creates a local proxy of the VideoFrameHandlerPtr interface.
-  video_capture::mojom::VideoFrameHandlerPtr CreateInterfacePtr();
+  // Creates a local proxy of the VideoFrameHandler interface.
+  mojo::PendingRemote<video_capture::mojom::VideoFrameHandler>
+  CreateInterfacePendingRemote();
 
   // Returns the count of active frame handlers on this handler.
   int GetFrameHandlerCount();
@@ -53,8 +58,10 @@
   void OnNewBuffer(int32_t buffer_id,
                    media::mojom::VideoBufferHandlePtr buffer_handle) override;
   void OnFrameReadyInBuffer(
-      int32_t buffer_id, int32_t frame_feedback_id,
-      video_capture::mojom::ScopedAccessPermissionPtr permission,
+      int32_t buffer_id,
+      int32_t frame_feedback_id,
+      mojo::PendingRemote<video_capture::mojom::ScopedAccessPermission>
+          permission,
       media::mojom::VideoFrameInfoPtr frame_info) override;
   void OnFrameDropped(
       ::media::mojom::VideoCaptureFrameDropReason reason) override;
@@ -73,7 +80,7 @@
   std::map<int, VideoCaptureServiceClient::FrameHandler> frame_handler_map_;
 
   // Binding of the Recevier interface to message pipe.
-  mojo::Binding<video_capture::mojom::VideoFrameHandler> binding_;
+  mojo::Receiver<video_capture::mojom::VideoFrameHandler> receiver_;
 
   // Stores the capture format requested from the open device.
   VideoStreamParams capture_format_;