blob: 300ebda584412ab0718b9c5ec8939967ecb64927 [file] [log] [blame]
// Copyright 2017 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 blink.mojom;
import "media/capture/mojom/video_capture_types.mojom";
import "media/mojo/interfaces/audio_parameters.mojom";
import "media/mojo/interfaces/display_media_information.mojom";
// Types of media streams (see public/common/media_stream_request.h).
enum MediaStreamType {
MEDIA_NO_SERVICE,
MEDIA_DEVICE_AUDIO_CAPTURE,
MEDIA_DEVICE_VIDEO_CAPTURE,
MEDIA_GUM_TAB_AUDIO_CAPTURE,
MEDIA_GUM_TAB_VIDEO_CAPTURE,
MEDIA_GUM_DESKTOP_VIDEO_CAPTURE,
MEDIA_GUM_DESKTOP_AUDIO_CAPTURE,
MEDIA_DISPLAY_VIDEO_CAPTURE,
NUM_MEDIA_TYPES
};
// See public/common/media_stream_request.h.
enum MediaStreamRequestResult {
OK,
PERMISSION_DENIED,
PERMISSION_DISMISSED,
INVALID_STATE,
NO_HARDWARE,
INVALID_SECURITY_ORIGIN,
TAB_CAPTURE_FAILURE,
SCREEN_CAPTURE_FAILURE,
CAPTURE_FAILURE,
CONSTRAINT_NOT_SATISFIED,
TRACK_START_FAILURE_AUDIO,
TRACK_START_FAILURE_VIDEO,
NOT_SUPPORTED,
FAILED_DUE_TO_SHUTDOWN,
KILL_SWITCH_ON,
SYSTEM_PERMISSION_DENIED
};
// See public/common/media_stream_request.h.
struct MediaStreamDevice {
MediaStreamType type;
string id;
media.mojom.VideoFacingMode video_facing;
string? group_id;
string? matched_output_device_id;
string name;
media.mojom.AudioParameters input;
int32 session_id;
media.mojom.VideoCaptureDeviceDescriptorCameraCalibration? camera_calibration;
media.mojom.DisplayMediaInformation? display_media_info;
};
// See common/media/media_stream_controls.h.
struct TrackControls {
bool requested;
MediaStreamType stream_type;
string device_id;
};
// See common/media/media_stream_controls.h.
struct StreamControls {
TrackControls audio;
TrackControls video;
bool hotword_enabled;
bool disable_local_echo;
};
// Per-frame renderer-side interface that receives device stopped/change
// notifications from the browser process.
interface MediaStreamDeviceObserver {
OnDeviceStopped(string label, MediaStreamDevice device);
OnDeviceChanged(string label,
MediaStreamDevice old_device,
MediaStreamDevice new_device);
};
// Per-frame browser-side interface that is used by the renderer process to
// make media stream requests.
interface MediaStreamDispatcherHost {
// Requests a new media stream.
GenerateStream(int32 request_id, StreamControls controls, bool user_gesture)
=> (MediaStreamRequestResult result, string label,
array<MediaStreamDevice> audio_devices,
array<MediaStreamDevice> video_devices);
// Cancels the request for a new media stream or opening a device.
CancelRequest(int32 request_id);
// Closes a stream device that has been opened by GenerateStream.
StopStreamDevice(string device_id, int32 session_id);
// Opens a device identified by |device_id|.
OpenDevice(int32 request_id, string device_id, MediaStreamType type)
=> (bool success, string label, MediaStreamDevice device);
// Cancels an open request identified by |label|.
CloseDevice(string label);
// Tells the browser process if the video capture is secure (i.e., all
// connected video sinks meet the requirement of output protection.).
// Note: the browser process only trusts the |is_secure| value in this Mojo
// message if it's comimg from a trusted, whitelisted extension. Extensions
// run in separate render processes. So it shouldn't be possible, for example,
// for a user's visit to a malicious web page to compromise a render process
// running a trusted extension to make it report falsehood in this Mojo
// message.
SetCapturingLinkSecured(int32 session_id, MediaStreamType type,
bool is_secure);
// Tells the browser process that the stream has been started successfully.
OnStreamStarted(string label);
};
// Browser-side interface that is used by the renderer process to notify the
// addition or deletion of tracks.
interface MediaStreamTrackMetricsHost {
// Adds the track with the specified information to the list of tracks.
AddTrack(uint64 id, bool is_audio, bool is_remote);
// Removes the track with the specified ID from the list of tracks.
RemoveTrack(uint64 id);
};