|  | // Copyright 2020 The Chromium Authors | 
|  | // Use of this source code is governed by a BSD-style license that can be | 
|  | // found in the LICENSE file. | 
|  |  | 
|  | syntax = "proto2"; | 
|  |  | 
|  | package wc_fuzzer; | 
|  |  | 
|  | message AllowSharedBufferSource { | 
|  | // Note: length is capped in the fuzzer to avoid OOM. | 
|  | optional uint32 length = 1; | 
|  | optional bool shared = 2; | 
|  |  | 
|  | enum ViewType { | 
|  | NONE = 0; | 
|  | INT8 = 1; | 
|  | UINT32 = 2; | 
|  | DATA = 3; | 
|  | } | 
|  | optional ViewType view_type = 3; | 
|  | optional uint32 view_offset = 4; | 
|  | optional uint32 view_length = 5; | 
|  |  | 
|  | // Transfer ArrayBuffer into ctor | 
|  | optional bool transfer = 6; | 
|  | } | 
|  |  | 
|  | message DOMRectInit { | 
|  | optional double x = 1; | 
|  | optional double y = 2; | 
|  | optional double width = 3; | 
|  | optional double height = 4; | 
|  | } | 
|  |  | 
|  | message PlaneLayout { | 
|  | optional uint32 offset = 1; | 
|  | optional uint32 stride = 2; | 
|  | } | 
|  |  | 
|  | message VideoFrameCopyToOptions { | 
|  | optional DOMRectInit rect = 1; | 
|  | repeated PlaneLayout layout = 2; | 
|  | } | 
|  |  | 
|  | message VideoColorSpaceInit { | 
|  | enum VideoColorPrimaries { | 
|  | VCP_BT709 = 0; | 
|  | VCP_BT470BG = 1; | 
|  | VCP_SMPTE170M = 2; | 
|  | VCP_BT2020 = 3; | 
|  | VCP_SMPTE432 = 4; | 
|  | } | 
|  | optional VideoColorPrimaries primaries = 1; | 
|  | enum VideoTransferCharacteristics { | 
|  | VTC_BT709 = 0; | 
|  | VTC_SMPTE170M = 1; | 
|  | VTC_IEC61966_2_1 = 2; | 
|  | VTC_LINEAR = 3; | 
|  | VTC_PQ = 4; | 
|  | VTC_HLG = 5; | 
|  | } | 
|  | optional VideoTransferCharacteristics transfer = 2; | 
|  | enum VideoMatrixCoefficients { | 
|  | VMC_RGB = 0; | 
|  | VMC_BT709 = 1; | 
|  | VMC_BT470BG = 2; | 
|  | VMC_SMPTE170M = 3; | 
|  | VMC_BT2020_NCL = 4; | 
|  | } | 
|  | optional VideoMatrixCoefficients matrix = 3; | 
|  | optional bool full_range = 4; | 
|  | } | 
|  |  | 
|  | message VideoFrameBufferInit { | 
|  | enum VideoPixelFormat { | 
|  | I420 = 0; | 
|  | I420A = 1; | 
|  | I444 = 2; | 
|  | NV12 = 3; | 
|  | RGBA = 4; | 
|  | RGBX = 5; | 
|  | BGRA = 6; | 
|  | BGRX = 7; | 
|  | } | 
|  | optional VideoPixelFormat format = 1; | 
|  | repeated PlaneLayout layout = 2; | 
|  |  | 
|  | optional int64 timestamp = 3; | 
|  | optional uint64 duration = 4; | 
|  |  | 
|  | optional uint32 coded_width = 5; | 
|  | optional uint32 coded_height = 6; | 
|  |  | 
|  | optional DOMRectInit visible_rect = 7; | 
|  |  | 
|  | optional uint32 display_width = 8; | 
|  | optional uint32 display_height = 9; | 
|  |  | 
|  | optional VideoColorSpaceInit color_space = 10; | 
|  | } | 
|  |  | 
|  | message VideoFrameBufferInitInvocation { | 
|  | required AllowSharedBufferSource data = 1; | 
|  | required VideoFrameBufferInit init = 2; | 
|  | } | 
|  |  | 
|  | message ConfigureVideoDecoder { | 
|  | // String describing codec (e.g. "vp09.00.10.08") | 
|  | optional string codec = 1; | 
|  |  | 
|  | optional bytes description = 2; | 
|  | } | 
|  |  | 
|  | message ConfigureVideoEncoder { | 
|  | // String describing codec (e.g. "vp09.00.10.08") | 
|  | optional string codec = 1; | 
|  |  | 
|  | enum EncoderAccelerationPreference { | 
|  | ALLOW = 0; | 
|  | DENY = 1; | 
|  | REQUIRE = 2; | 
|  | } | 
|  |  | 
|  | enum ScalabilityMode { | 
|  | L1T1 = 0; | 
|  | L1T2 = 1; | 
|  | L1T3 = 2; | 
|  | } | 
|  |  | 
|  | enum LatencyMode { | 
|  | QUALITY = 0; | 
|  | REALTIME = 1; | 
|  | } | 
|  |  | 
|  | enum ContentHint { | 
|  | NONE = 0; | 
|  | MOTION = 1; | 
|  | DETAIL = 2; | 
|  | TEXT = 3; | 
|  | } | 
|  |  | 
|  | enum VideoEncoderBitrateMode { | 
|  | CONSTANT = 0; | 
|  | VARIABLE = 1; | 
|  | QUANTIZER = 2; | 
|  | } | 
|  |  | 
|  | enum AlphaOption { | 
|  | KEEP = 0; | 
|  | DISCARD = 1; | 
|  | } | 
|  |  | 
|  | optional EncoderAccelerationPreference acceleration = 2; | 
|  |  | 
|  | optional uint64 bitrate = 3; | 
|  |  | 
|  | optional double framerate = 4; | 
|  |  | 
|  | optional uint32 width = 5; | 
|  |  | 
|  | optional uint32 height = 6; | 
|  |  | 
|  | optional uint32 display_width = 7; | 
|  |  | 
|  | optional uint32 display_height = 8; | 
|  |  | 
|  | optional ScalabilityMode scalability_mode = 9; | 
|  |  | 
|  | optional VideoEncoderBitrateMode bitrate_mode = 10; | 
|  |  | 
|  | optional LatencyMode latency_mode = 11; | 
|  |  | 
|  | optional AlphaOption alpha = 12; | 
|  |  | 
|  | optional ContentHint content_hint = 13; | 
|  | } | 
|  |  | 
|  | message ConfigureAudioDecoder { | 
|  | // String describing codec (e.g. "opus") | 
|  | optional string codec = 1; | 
|  |  | 
|  | optional uint32 sample_rate = 2; | 
|  |  | 
|  | optional uint32 number_of_channels = 3; | 
|  |  | 
|  | optional bytes description = 4; | 
|  | } | 
|  |  | 
|  | enum AacFormat { | 
|  | AAC = 0; | 
|  | ADTS = 1; | 
|  | } | 
|  |  | 
|  | enum BitrateMode { | 
|  | VARIABLE = 0; | 
|  | CONSTANT = 1; | 
|  | } | 
|  |  | 
|  | message AacEncoderConfig { | 
|  | optional AacFormat format = 1; | 
|  | } | 
|  |  | 
|  | enum OpusSignal { | 
|  | AUTO = 0; | 
|  | MUSIC = 1; | 
|  | VOICE = 2; | 
|  | } | 
|  |  | 
|  | enum OpusApplication { | 
|  | VOIP = 0; | 
|  | AUDIO = 1; | 
|  | LOWDELAY = 2; | 
|  | } | 
|  |  | 
|  | message OpusEncoderConfig { | 
|  | optional uint64 frame_duration = 1; | 
|  |  | 
|  | optional uint32 complexity = 2; | 
|  |  | 
|  | optional uint32 packetlossperc = 3; | 
|  |  | 
|  | optional bool useinbandfec = 4; | 
|  |  | 
|  | optional bool usedtx = 5; | 
|  |  | 
|  | optional OpusSignal signal = 6; | 
|  |  | 
|  | optional OpusApplication application = 7; | 
|  | } | 
|  |  | 
|  | message ConfigureAudioEncoder { | 
|  | // String describing codec (e.g. "opus") | 
|  | optional string codec = 1; | 
|  |  | 
|  | optional uint32 sample_rate = 2; | 
|  |  | 
|  | optional uint32 number_of_channels = 3; | 
|  |  | 
|  | optional uint64 bitrate = 4; | 
|  |  | 
|  | optional AacEncoderConfig aac = 5; | 
|  |  | 
|  | optional OpusEncoderConfig opus = 6; | 
|  |  | 
|  | optional BitrateMode bitrate_mode = 7; | 
|  | } | 
|  |  | 
|  | enum EncodedChunkType { | 
|  | KEY = 0; | 
|  | DELTA = 1; | 
|  | } | 
|  |  | 
|  | message EncodedVideoChunk { | 
|  | optional EncodedChunkType type = 1; | 
|  |  | 
|  | optional uint64 timestamp = 2; | 
|  |  | 
|  | optional uint64 duration = 3; | 
|  |  | 
|  | optional bytes data = 4; | 
|  | } | 
|  |  | 
|  | message EncodedAudioChunk { | 
|  | optional EncodedChunkType type = 1; | 
|  |  | 
|  | optional uint64 timestamp = 2; | 
|  |  | 
|  | optional uint64 duration = 3; | 
|  |  | 
|  | optional bytes data = 4; | 
|  | } | 
|  |  | 
|  | // Mix of args to VideoFrame constructor. | 
|  | message VideoFrameBitmapInit { | 
|  | optional uint64 timestamp = 1; | 
|  |  | 
|  | optional uint64 duration = 2; | 
|  |  | 
|  | optional uint32 bitmap_width = 3; | 
|  |  | 
|  | optional bytes rgb_bitmap = 4; | 
|  | } | 
|  |  | 
|  | enum AudioSampleFormat { | 
|  | U8 = 0; | 
|  | S16 = 1; | 
|  | S32 = 2; | 
|  | F32 = 3; | 
|  | U8_PLANAR = 4; | 
|  | S16_PLANAR = 5; | 
|  | S32_PLANAR = 6; | 
|  | F32_PLANAR = 7; | 
|  | } | 
|  |  | 
|  | message AudioDataInit { | 
|  | optional uint64 timestamp = 1; | 
|  |  | 
|  | optional uint32 length = 2; | 
|  |  | 
|  | optional uint32 sample_rate = 3; | 
|  |  | 
|  | repeated bytes channels = 4; | 
|  |  | 
|  | required AudioSampleFormat format = 5; | 
|  |  | 
|  | // Transfer ArrayBuffer into ctor | 
|  | optional bool transfer = 6; | 
|  | } | 
|  |  | 
|  | message EncodeVideo { | 
|  | oneof Frames { | 
|  | VideoFrameBitmapInit frame = 1; | 
|  | VideoFrameBufferInitInvocation frame_from_buffer = 3; | 
|  | } | 
|  | message EncodeOptionsForAv1 { | 
|  | optional uint32 quantizer = 1; | 
|  | }; | 
|  | message EncodeOptionsForVp9 { | 
|  | optional uint32 quantizer = 1; | 
|  | }; | 
|  | message EncodeOptions { | 
|  | optional bool key_frame = 1; | 
|  | optional EncodeOptionsForAv1 av1 = 2; | 
|  | optional EncodeOptionsForVp9 vp9 = 3; | 
|  | } | 
|  | optional EncodeOptions options = 2; | 
|  | } | 
|  |  | 
|  | message EncodeAudio { | 
|  | optional AudioDataInit data = 1; | 
|  | } | 
|  |  | 
|  | message DecodeVideo { | 
|  | optional EncodedVideoChunk chunk = 1; | 
|  | } | 
|  |  | 
|  | message DecodeAudio { | 
|  | optional EncodedAudioChunk chunk = 1; | 
|  | } | 
|  |  | 
|  | message Flush { | 
|  | optional bool wait_for_promise = 1; | 
|  | } | 
|  |  | 
|  | message Reset {} | 
|  |  | 
|  | message Close {} | 
|  |  | 
|  | message VideoDecoderApiInvocation { | 
|  | oneof Api { | 
|  | ConfigureVideoDecoder configure = 1; | 
|  | DecodeVideo decode = 2; | 
|  | Flush flush = 3; | 
|  | Reset reset = 4; | 
|  | Close close = 5; | 
|  | } | 
|  | } | 
|  |  | 
|  | message VideoDecoderApiInvocationSequence { | 
|  | repeated VideoDecoderApiInvocation invocations = 1; | 
|  | } | 
|  |  | 
|  | message AudioDecoderApiInvocation { | 
|  | oneof Api { | 
|  | ConfigureAudioDecoder configure = 1; | 
|  | DecodeAudio decode = 2; | 
|  | Flush flush = 3; | 
|  | Reset reset = 4; | 
|  | Close close = 5; | 
|  | } | 
|  | } | 
|  |  | 
|  | message AudioDecoderApiInvocationSequence { | 
|  | repeated AudioDecoderApiInvocation invocations = 1; | 
|  | } | 
|  |  | 
|  | message VideoEncoderApiInvocation { | 
|  | oneof Api { | 
|  | ConfigureVideoEncoder configure = 1; | 
|  | EncodeVideo encode = 2; | 
|  | Flush flush = 3; | 
|  | Reset reset = 4; | 
|  | Close close = 5; | 
|  | } | 
|  | } | 
|  |  | 
|  | message VideoEncoderApiInvocationSequence { | 
|  | repeated VideoEncoderApiInvocation invocations = 1; | 
|  | } | 
|  |  | 
|  | message AudioEncoderApiInvocation { | 
|  | oneof Api { | 
|  | ConfigureAudioEncoder configure = 1; | 
|  | EncodeAudio encode = 2; | 
|  | Flush flush = 3; | 
|  | Reset reset = 4; | 
|  | Close close = 5; | 
|  | } | 
|  | } | 
|  |  | 
|  | message AudioEncoderApiInvocationSequence { | 
|  | repeated AudioEncoderApiInvocation invocations = 1; | 
|  | } | 
|  |  | 
|  | message DecodeImage { | 
|  | optional uint32 frame_index = 1; | 
|  | optional bool complete_frames_only = 2; | 
|  | } | 
|  |  | 
|  | message DecodeMetadata {} | 
|  |  | 
|  | message SelectTrack { | 
|  | required uint32 track_id = 1; | 
|  | optional bool selected = 2 [default = true]; | 
|  | } | 
|  |  | 
|  | message ImageDecoderApiInvocation { | 
|  | oneof Api { | 
|  | DecodeImage decode_image = 1; | 
|  | DecodeMetadata decode_metadata = 2 [deprecated = true]; | 
|  | SelectTrack select_track = 3; | 
|  | } | 
|  | } | 
|  |  | 
|  | message ImageBitmapOptions { | 
|  | enum ImageOrientation { | 
|  | ORIENTATION_FROM_IMAGE = 0; | 
|  | FLIPY = 1; | 
|  | } | 
|  | enum PremultiplyAlpha { | 
|  | PREMULTIPLY_NONE = 0; | 
|  | PREMULTIPLY = 1; | 
|  | PREMULTIPLY_DEFAULT = 2; | 
|  | } | 
|  | enum ColorSpaceConversion { | 
|  | CS_NONE = 0; | 
|  | CS_DEFAULT = 1; | 
|  | } | 
|  | enum ResizeQuality { | 
|  | PIXELATED = 0; | 
|  | LOW = 1; | 
|  | MEDIUM = 2; | 
|  | HIGH = 3; | 
|  | } | 
|  |  | 
|  | optional ImageOrientation image_orientation = 1; | 
|  | optional PremultiplyAlpha premultiply_alpha = 2 [deprecated = true]; | 
|  | optional ColorSpaceConversion color_space_conversion = 3; | 
|  | optional uint32 resize_width = 4; | 
|  | optional uint32 resize_height = 5; | 
|  | optional ResizeQuality resize_quality = 6; | 
|  | } | 
|  |  | 
|  | message ConfigureImageDecoder { | 
|  | required bytes data = 1; | 
|  | required string type = 2; | 
|  | optional ImageBitmapOptions options = 3; | 
|  | optional bool prefer_animation = 4; | 
|  | } | 
|  |  | 
|  | message ImageDecoderApiInvocationSequence { | 
|  | required ConfigureImageDecoder config = 1; | 
|  | repeated ImageDecoderApiInvocation invocations = 2; | 
|  | } | 
|  |  | 
|  | message VideoFrameCopyToInvocation { | 
|  | required AllowSharedBufferSource destination = 1; | 
|  | optional VideoFrameCopyToOptions options = 2; | 
|  | } | 
|  |  | 
|  | message VideoFrameCopyToCase { | 
|  | // TODO(sandersd): Support other kinds of frames. | 
|  | required VideoFrameBufferInitInvocation video_frame = 1; | 
|  | // TODO(sandersd): Support multiple concurrent operations, optional waiting, | 
|  | // close(), etc. | 
|  | required VideoFrameCopyToInvocation copy_to = 2; | 
|  | } | 
|  |  | 
|  | message AudioDataCopyToOptions { | 
|  | required uint32 plane_index = 1; | 
|  | optional uint32 frame_offset = 2; | 
|  | optional uint32 frame_count = 3; | 
|  | optional AudioSampleFormat format = 4; | 
|  | } | 
|  |  | 
|  | message AudioDataCopyToInvocation { | 
|  | required AllowSharedBufferSource destination = 1; | 
|  | required AudioDataCopyToOptions options = 2; | 
|  | } | 
|  |  | 
|  | message AudioDataCopyToCase { | 
|  | required AudioDataInit audio_data = 1; | 
|  | // TODO(chcunningham): Support multiple concurrent operations, optional | 
|  | // waiting, close(), etc. | 
|  | required AudioDataCopyToInvocation copy_to = 2; | 
|  | } |