Add IPC to query capabilities of video input devices.
This IPC is intended to support new spec-compliant functionality for getUserMedia
such as device and settings selection based on constraints, and the applyConstraints
function.
BUG=657733
Review-Url: https://codereview.chromium.org/2646833002
Cr-Commit-Position: refs/heads/master@{#446977}
diff --git a/content/common/media/media_devices.mojom b/content/common/media/media_devices.mojom
index d53232e5..93e94322 100644
--- a/content/common/media/media_devices.mojom
+++ b/content/common/media/media_devices.mojom
@@ -4,6 +4,7 @@
module mojom;
+import "media/capture/mojo/video_capture_types.mojom";
import "url/mojo/origin.mojom";
[Native]
@@ -12,6 +13,24 @@
[Native]
struct MediaDeviceInfo;
+// The values for this enum match the ones defined in
+// https://w3c.github.io/mediacapture-main/#def-constraint-facingMode
+// with the addition of NONE, which would map to the empty string in
+// JavaScript.
+enum FacingMode {
+ NONE,
+ USER,
+ ENVIRONMENT,
+ LEFT,
+ RIGHT
+};
+
+struct VideoInputDeviceCapabilities {
+ string device_id;
+ array<media.mojom.VideoCaptureFormat> formats;
+ FacingMode facing_mode;
+};
+
// This object lives in the browser and is responsible for processing device
// enumeration requests and managing subscriptions for device-change
// notifications.
@@ -24,6 +43,14 @@
bool request_audio_output,
url.mojom.Origin security_origin)
=> (array<array<MediaDeviceInfo>> enumeration);
+
+ // Returns a list of video devices and their capabilities.
+ // If there is a user-preferred device, it is the first in the result.
+ // The result of this function is intended for the implementation details
+ // of algorithms such as settings selection for getUserMedia.
+ // Do not expose the data contained in result of this function to JavaScript.
+ GetVideoInputCapabilities(url.mojom.Origin security_origin)
+ => (array<VideoInputDeviceCapabilities> video_input_device_capabilities);
// Creates a subscription for device-change notifications for the calling
// frame/security origin. It is the responsibility of the caller to send