1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
media / capture / mojom / video_capture_types.mojom [blame]
// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module media.mojom;
import "ui/gfx/geometry/mojom/geometry.mojom";
[Stable, Extensible]
enum VideoCapturePixelFormat {
UNKNOWN,
I420,
YV12,
I422,
I420A,
I444,
NV12,
NV21,
UYVY,
YUY2,
ARGB,
XRGB,
RGB24,
MJPEG,
YUV420P9,
YUV420P10,
YUV422P9,
YUV422P10,
YUV444P9,
YUV444P10,
YUV420P12,
YUV422P12,
YUV444P12,
Y16,
ABGR,
XBGR,
P010LE,
XR30,
XB30,
BGRA,
RGBAF16,
[MinVersion=1] I422A,
[MinVersion=1] I444A,
[MinVersion=1] YUV420AP10,
[MinVersion=1] YUV422AP10,
[MinVersion=1] YUV444AP10,
[MinVersion=2] NV12A,
[MinVersion=3] NV16,
[MinVersion=3] NV24,
[MinVersion=3] P210LE,
[MinVersion=3] P410LE,
};
[Stable, Extensible]
enum ResolutionChangePolicy {
FIXED_RESOLUTION,
FIXED_ASPECT_RATIO,
ANY_WITHIN_LIMIT,
};
[Stable, Extensible]
enum PowerLineFrequency {
DEFAULT,
HZ_50,
HZ_60
};
[Stable, Extensible]
enum VideoFacingMode {
NONE,
USER,
ENVIRONMENT
};
[Stable, Extensible]
enum CameraAvailability {
[Default] kAvailable,
kUnavailableExclusivelyUsedByOtherApplication,
};
[Stable, Extensible]
enum VideoCaptureApi {
LINUX_V4L2_SINGLE_PLANE,
WIN_MEDIA_FOUNDATION,
WIN_MEDIA_FOUNDATION_SENSOR,
WIN_DIRECT_SHOW,
MACOSX_AVFOUNDATION,
MACOSX_DECKLINK,
ANDROID_API1,
ANDROID_API2_LEGACY,
ANDROID_API2_FULL,
ANDROID_API2_LIMITED,
FUCHSIA_CAMERA3,
VIRTUAL_DEVICE,
UNKNOWN,
[MinVersion=1] WEBRTC_LINUX_PIPEWIRE_SINGLE_PLANE,
};
[Stable, Extensible]
enum VideoCaptureTransportType {
// For AVFoundation Api, identify devices that are built-in or USB.
APPLE_USB_OR_BUILT_IN,
OTHER_TRANSPORT
};
[Stable, Extensible]
enum VideoCaptureBufferType {
kSharedMemory,
kSharedMemoryViaRawFileDescriptor_DEPRECATED, // DEPRECATED, DO NOT USE
kMailboxHolder,
kGpuMemoryBuffer
};
// Represents capture device's support for different controls.
[Stable]
struct VideoCaptureControlSupport {
bool pan;
bool tilt;
bool zoom;
};
[Stable, Extensible]
enum VideoCaptureError {
kNone,
kVideoCaptureControllerInvalidOrUnsupportedVideoCaptureParametersRequested,
kVideoCaptureControllerIsAlreadyInErrorState,
kVideoCaptureManagerDeviceConnectionLost,
kFrameSinkVideoCaptureDeviceAlreadyEndedOnFatalError,
kFrameSinkVideoCaptureDeviceEncounteredFatalError,
kV4L2FailedToOpenV4L2DeviceDriverFile,
kV4L2ThisIsNotAV4L2VideoCaptureDevice,
kV4L2FailedToFindASupportedCameraFormat,
kV4L2FailedToSetVideoCaptureFormat,
kV4L2UnsupportedPixelFormat,
kV4L2FailedToSetCameraFramerate,
kV4L2ErrorRequestingMmapBuffers,
kV4L2AllocateBufferFailed,
kV4L2VidiocStreamonFailed,
kV4L2VidiocStreamoffFailed,
kV4L2FailedToVidiocReqbufsWithCount0,
kV4L2PollFailed,
kV4L2MultipleContinuousTimeoutsWhileReadPolling,
kV4L2FailedToDequeueCaptureBuffer,
kV4L2FailedToEnqueueCaptureBuffer,
kSingleClientVideoCaptureHostLostConnectionToDevice,
kSingleClientVideoCaptureDeviceLaunchAborted,
kDesktopCaptureDeviceWebrtcDesktopCapturerHasFailed,
kFileVideoCaptureDeviceCouldNotOpenVideoFile,
kDeviceCaptureLinuxFailedToCreateVideoCaptureDelegate,
kErrorFakeDeviceIntentionallyEmittingErrorEvent,
kDeviceClientTooManyFramesDroppedY16,
kDeviceMediaToMojoAdapterEncounteredUnsupportedBufferType,
kVideoCaptureManagerProcessDeviceStartQueueDeviceInfoNotFound,
kInProcessDeviceLauncherFailedToCreateDeviceInstance,
kServiceDeviceLauncherLostConnectionToDeviceFactoryDuringDeviceStart,
kServiceDeviceLauncherServiceRespondedWithDeviceNotFound,
kServiceDeviceLauncherConnectionLostWhileWaitingForCallback,
kIntentionalErrorRaisedByUnitTest,
kCrosHalV3FailedToStartDeviceThread,
kCrosHalV3DeviceDelegateMojoConnectionError,
kCrosHalV3DeviceDelegateFailedToGetCameraInfo,
kCrosHalV3DeviceDelegateMissingSensorOrientationInfo,
kCrosHalV3DeviceDelegateFailedToOpenCameraDevice,
kCrosHalV3DeviceDelegateFailedToInitializeCameraDevice,
kCrosHalV3DeviceDelegateFailedToConfigureStreams,
kCrosHalV3DeviceDelegateWrongNumberOfStreamsConfigured,
kCrosHalV3DeviceDelegateFailedToGetDefaultRequestSettings,
kCrosHalV3BufferManagerHalRequestedTooManyBuffers,
kCrosHalV3BufferManagerFailedToCreateGpuMemoryBuffer,
kCrosHalV3BufferManagerFailedToMapGpuMemoryBuffer,
kCrosHalV3BufferManagerUnsupportedVideoPixelFormat,
kCrosHalV3BufferManagerFailedToDupFd,
kCrosHalV3BufferManagerFailedToWrapGpuMemoryHandle,
kCrosHalV3BufferManagerFailedToRegisterBuffer,
kCrosHalV3BufferManagerProcessCaptureRequestFailed,
kCrosHalV3BufferManagerInvalidPendingResultId,
kCrosHalV3BufferManagerReceivedDuplicatedPartialMetadata,
kCrosHalV3BufferManagerIncorrectNumberOfOutputBuffersReceived,
kCrosHalV3BufferManagerInvalidTypeOfOutputBuffersReceived,
kCrosHalV3BufferManagerReceivedMultipleResultBuffersForFrame,
kCrosHalV3BufferManagerUnknownStreamInCamera3NotifyMsg,
kCrosHalV3BufferManagerReceivedInvalidShutterTime,
kCrosHalV3BufferManagerFatalDeviceError,
kCrosHalV3BufferManagerReceivedFrameIsOutOfOrder,
kCrosHalV3BufferManagerFailedToUnwrapReleaseFenceFd,
kCrosHalV3BufferManagerSyncWaitOnReleaseFenceTimedOut,
kCrosHalV3BufferManagerInvalidJpegBlob,
kAndroidFailedToAllocate,
kAndroidFailedToStartCapture,
kAndroidFailedToStopCapture,
kAndroidApi1CameraErrorCallbackReceived,
kAndroidApi2CameraDeviceErrorReceived,
kAndroidApi2CaptureSessionConfigureFailed,
kAndroidApi2ImageReaderUnexpectedImageFormat,
kAndroidApi2ImageReaderSizeDidNotMatchImageSize,
kAndroidApi2ErrorRestartingPreview,
kAndroidScreenCaptureUnsupportedFormat,
kAndroidScreenCaptureFailedToStartCaptureMachine,
kAndroidScreenCaptureTheUserDeniedScreenCapture,
kAndroidScreenCaptureFailedToStartScreenCapture,
kWinDirectShowCantGetCaptureFormatSettings,
kWinDirectShowFailedToGetNumberOfCapabilities,
kWinDirectShowFailedToGetCaptureDeviceCapabilities,
kWinDirectShowFailedToSetCaptureDeviceOutputFormat,
kWinDirectShowFailedToConnectTheCaptureGraph,
kWinDirectShowFailedToPauseTheCaptureDevice,
kWinDirectShowFailedToStartTheCaptureDevice,
kWinDirectShowFailedToStopTheCaptureGraph,
kWinMediaFoundationEngineIsNull,
kWinMediaFoundationEngineGetSourceFailed ,
kWinMediaFoundationFillPhotoCapabilitiesFailed ,
kWinMediaFoundationFillVideoCapabilitiesFailed,
kWinMediaFoundationNoVideoCapabilityFound,
kWinMediaFoundationGetAvailableDeviceMediaTypeFailed,
kWinMediaFoundationSetCurrentDeviceMediaTypeFailed,
kWinMediaFoundationEngineGetSinkFailed,
kWinMediaFoundationSinkQueryCapturePreviewInterfaceFailed,
kWinMediaFoundationSinkRemoveAllStreamsFailed,
kWinMediaFoundationCreateSinkVideoMediaTypeFailed,
kWinMediaFoundationConvertToVideoSinkMediaTypeFailed,
kWinMediaFoundationSinkAddStreamFailed,
kWinMediaFoundationSinkSetSampleCallbackFailed,
kWinMediaFoundationEngineStartPreviewFailed,
kWinMediaFoundationGetMediaEventStatusFailed,
kMacSetCaptureDeviceFailed,
kMacCouldNotStartCaptureDevice,
kMacReceivedFrameWithUnexpectedResolution,
kMacUpdateCaptureResolutionFailed,
kMacDeckLinkDeviceIdNotFoundInTheSystem,
kMacDeckLinkErrorQueryingInputInterface,
kMacDeckLinkErrorCreatingDisplayModeIterator,
kMacDeckLinkCouldNotFindADisplayMode,
kMacDeckLinkCouldNotSelectTheVideoFormatWeLike,
kMacDeckLinkCouldNotStartCapturing,
kMacDeckLinkUnsupportedPixelFormat,
kMacAvFoundationReceivedAVCaptureSessionRuntimeErrorNotification,
kAndroidApi2ErrorConfiguringCamera,
kCrosHalV3DeviceDelegateFailedToFlush,
kFuchsiaCameraDeviceDisconnected,
kFuchsiaCameraStreamDisconnected,
kFuchsiaSysmemDidNotSetImageFormat,
kFuchsiaSysmemInvalidBufferIndex,
kFuchsiaSysmemInvalidBufferSize,
kFuchsiaUnsupportedPixelFormat,
kFuchsiaFailedToMapSysmemBuffer,
kCrosHalV3DeviceContextDuplicatedClient,
kDesktopCaptureDeviceMacFailedStreamCreate,
kDesktopCaptureDeviceMacFailedStreamStart,
kCrosHalV3BufferManagerFailedToReserveBuffers,
[MinVersion=1] kWinMediaFoundationSystemPermissionDenied,
[MinVersion=2] kVideoCaptureImplTimedOutOnStart,
[MinVersion=3] kLacrosVideoCaptureDeviceProxyAlreadyEndedOnFatalError,
[MinVersion=3] kLacrosVideoCaptureDeviceProxyEncounteredFatalError,
[MinVersion=4] kScreenCaptureKitFailedGetShareableContent,
[MinVersion=4] kScreenCaptureKitFailedAddStreamOutput,
[MinVersion=4] kScreenCaptureKitFailedStartCapture,
[MinVersion=4] kScreenCaptureKitFailedStopCapture,
[MinVersion=4] kScreenCaptureKitStreamError,
[MinVersion=4] kScreenCaptureKitFailedToFindSCDisplay,
[MinVersion=5] kVideoCaptureControllerInvalid,
[MinVersion=5] kVideoCaptureDeviceFactoryChromeOSCreateDeviceFailed,
[MinVersion=5] kVideoCaptureControllerUnsupportedPixelFormat,
[MinVersion=5] kVideoCaptureDeviceAlreadyReleased,
[MinVersion=5] kVideoCaptureSystemDeviceIdNotFound,
[MinVersion=5] kVideoCaptureDeviceFactoryWinUnknownError,
[MinVersion=5] kWinMediaFoundationDeviceInitializationFailed,
[MinVersion=5] kWinMediaFoundationSourceCreationFailed,
[MinVersion=5] kWinDirectShowDeviceFilterCreationFailed,
[MinVersion=5] kWinDirectShowDeviceInitializationFailed,
[MinVersion=6] kVideoCaptureDeviceFactorySecondCreateDenied,
[MinVersion=7] kScreenCaptureKitResetStreamError,
[MinVersion=8] kWinMediaFoundationCameraBusy,
[MinVersion=9] kWebRtcStartCaptureFailed,
};
[Stable, Extensible]
enum VideoCaptureFrameDropReason {
kNone,
kDeviceClientFrameHasInvalidFormat,
kDeviceClientLibyuvConvertToI420Failed,
kV4L2BufferErrorFlagWasSet,
kV4L2InvalidNumberOfBytesInBuffer,
kAndroidThrottling,
kAndroidGetByteArrayElementsFailed,
kAndroidApi1UnexpectedDataLength,
kAndroidApi2AcquiredImageIsNull,
kWinDirectShowUnexpectedSampleLength,
kWinDirectShowFailedToGetMemoryPointerFromMediaSample,
kWinMediaFoundationReceivedSampleIsNull,
kWinMediaFoundationLockingBufferDelieveredNullptr,
kWinMediaFoundationGetBufferByIndexReturnedNull,
kBufferPoolMaxBufferCountExceeded,
kBufferPoolBufferAllocationFailed,
kVideoCaptureImplNotInStartedState,
kVideoCaptureImplFailedToWrapDataAsMediaVideoFrame,
kVideoTrackAdapterHasNoResolutionAdapters,
kResolutionAdapterFrameIsNotValid,
kResolutionAdapterWrappingFrameForCroppingFailed,
kResolutionAdapterTimestampTooCloseToPrevious_DEPRECATED,
kResolutionAdapterFrameRateIsHigherThanRequested,
kResolutionAdapterHasNoCallbacks,
kVideoTrackFrameDelivererNotEnabledReplacingWithBlackFrame,
kRendererSinkFrameDelivererIsNotStarted,
[MinVersion=1] kCropVersionNotCurrent_DEPRECATED,
[MinVersion=5] kGpuMemoryBufferMapFailed,
[MinVersion=12] kSubCaptureTargetVersionNotCurrent,
[MinVersion=13] kPostProcessingFailed,
};
[Stable]
struct VideoCaptureFormat {
gfx.mojom.Size frame_size;
float frame_rate;
VideoCapturePixelFormat pixel_format;
};
[Stable]
struct VideoCaptureParams {
VideoCaptureFormat requested_format;
VideoCaptureBufferType buffer_type;
ResolutionChangePolicy resolution_change_policy;
PowerLineFrequency power_line_frequency;
bool enable_face_detection;
// TODO(crbug.com/40255351): remove this once HiDPI is enabled for
// all video capture sessions.
[MinVersion=1] bool is_high_dpi_enabled;
};
[Stable, RenamedFrom="media.mojom.VideoFrameFeedback"]
struct VideoCaptureFeedback {
// Reports that the frame incurred some fractional utilization of the
// downstream pipeline's per-frame processing capacity.
// See code comments in media::base::VideoFrameMetadata for a discussion of
// how utilization is interpreted. The capturer uses this information to
// auto-adjust the capture resolution based on performance variances in the
// live system environment.
// -1.0 means no value present.
double resource_utilization;
// The requested maximum frame-rate, float::inifinty used to signal no limit.
float max_framerate_fps;
// The requested maximum resolution (in sense of image area).
// int::max used to signal no limit.
int32 max_pixels;
// Set by the consumer to request a CPU readable frame. Currently, only
// supported for NV12 frames obtained from the Windows Media Foundation
// camera capturer.
bool require_mapped_frame;
// DEPRECATED - DO NOT USE. Only kept for backwards compatibility.
[MinVersion=1] array<gfx.mojom.Size>? DEPRECATED_mapped_sizes;
// The frame that this feedback is associated with. Some consumers do not
// break down their analysis on a per-frame basis; while some may expect to
// hear any reports with a particular frame, so they can build a "timeline" of
// performance (e.g. to know if they have recovered). This struct is often
// funneled through multiple layers, so this frame_id may only be used by an
// intermediate layer to help route the feedback accordingly.
// This should usually be set to the same value as the |frame_feedback_id|
// received with the frame (often from a received `ReadyFrameInBuffer`).
[MinVersion=2] int32 frame_id = 0;
// Indicates whether or not the value in |frame_id| is valid.
// TODO(crbug.com/40489779): Remove this and replace frame_id with an
// optional type.
[MinVersion=2] bool has_frame_id = false;
};
// Contains one stride value per image plane. Stride means the number of bytes
// per row. If the image format uses fewer than kMaxPlanes planes, the values
// for higher plane indices are ignored. For example, for a YUV format, plane
// index 0 corresponds to the Y plane, index 1 to the U plane, and index 2 to
// the V plane.
struct PlaneStrides {
// Size must be kept in sync with media::VideoFrame::kMaxPlanes.
array<uint32, 4> stride_by_plane;
};
// 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.
[Stable]
struct VideoCaptureDeviceDescriptor {
string display_name;
string device_id;
string model_id;
VideoFacingMode facing_mode;
VideoCaptureApi capture_api;
VideoCaptureControlSupport control_support;
VideoCaptureTransportType transport_type;
[MinVersion=1] CameraAvailability? availability;
};
// Bundles a VideoCaptureDeviceDescriptor with corresponding supported
// video formats.
[Stable]
struct VideoCaptureDeviceInfo {
VideoCaptureDeviceDescriptor descriptor;
array<VideoCaptureFormat> supported_formats;
};
enum SubCaptureTargetType {
kCropTarget,
kRestrictionTarget
};
// The result of an attempt by the client to start/stop cropping,
// restricting or otherwise applying a sub-capture target.
// TODO(crbug.com/40203554): Remove kNotImplemented.
enum ApplySubCaptureTargetResult {
kSuccess,
kErrorGeneric,
kUnsupportedCaptureDevice,
kNotImplemented,
kNonIncreasingVersion,
kInvalidTarget,
};
enum DeviceEnumerationResult {
kSuccess,
kUnknownError,
kErrorCaptureServiceCrash,
kErrorCaptureServiceDroppedRequest
};