From 7d93eca32ff5874c5f330d1ff437b5867f8d56d6 Mon Sep 17 00:00:00 2001 From: CloudWebRTC Date: Fri, 22 Dec 2023 14:40:40 +0800 Subject: [PATCH] upgrade protocol. (#437) --- Makefile | 2 +- lib/src/proto/livekit_models.pb.dart | 96 +++++++++++++++++++----- lib/src/proto/livekit_models.pbenum.dart | 48 ++++++++++++ lib/src/proto/livekit_models.pbjson.dart | 75 +++++++++++++----- 4 files changed, 182 insertions(+), 39 deletions(-) diff --git a/Makefile b/Makefile index 6c183880..5a378d6b 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ proto: } format: - flutter format --set-exit-if-changed -l 100 . + dart format lib/src/proto e2ee: dart compile js .\web\e2ee.worker.dart -o .\example\web\e2ee.worker.dart.js diff --git a/lib/src/proto/livekit_models.pb.dart b/lib/src/proto/livekit_models.pb.dart index 9375fe75..3d2ecb06 100644 --- a/lib/src/proto/livekit_models.pb.dart +++ b/lib/src/proto/livekit_models.pb.dart @@ -32,7 +32,6 @@ class Room extends $pb.GeneratedMessage { $core.int? numParticipants, $core.bool? activeRecording, $core.int? numPublishers, - PlayoutDelay? playoutDelay, }) { final $result = create(); if (sid != null) { @@ -68,9 +67,6 @@ class Room extends $pb.GeneratedMessage { if (numPublishers != null) { $result.numPublishers = numPublishers; } - if (playoutDelay != null) { - $result.playoutDelay = playoutDelay; - } return $result; } Room._() : super(); @@ -101,8 +97,6 @@ class Room extends $pb.GeneratedMessage { ..aOB(10, _omitFieldNames ? '' : 'activeRecording') ..a<$core.int>( 11, _omitFieldNames ? '' : 'numPublishers', $pb.PbFieldType.OU3) - ..aOM(12, _omitFieldNames ? '' : 'playoutDelay', - subBuilder: PlayoutDelay.create) ..hasRequiredFields = false; @$core.Deprecated('Using this can add significant overhead to your binary. ' @@ -248,20 +242,6 @@ class Room extends $pb.GeneratedMessage { $core.bool hasNumPublishers() => $_has(10); @$pb.TagNumber(11) void clearNumPublishers() => clearField(11); - - @$pb.TagNumber(12) - PlayoutDelay get playoutDelay => $_getN(11); - @$pb.TagNumber(12) - set playoutDelay(PlayoutDelay v) { - setField(12, v); - } - - @$pb.TagNumber(12) - $core.bool hasPlayoutDelay() => $_has(11); - @$pb.TagNumber(12) - void clearPlayoutDelay() => clearField(12); - @$pb.TagNumber(12) - PlayoutDelay ensurePlayoutDelay() => $_ensure(11); } class Codec extends $pb.GeneratedMessage { @@ -344,6 +324,7 @@ class PlayoutDelay extends $pb.GeneratedMessage { factory PlayoutDelay({ $core.bool? enabled, $core.int? min, + $core.int? max, }) { final $result = create(); if (enabled != null) { @@ -352,6 +333,9 @@ class PlayoutDelay extends $pb.GeneratedMessage { if (min != null) { $result.min = min; } + if (max != null) { + $result.max = max; + } return $result; } PlayoutDelay._() : super(); @@ -368,6 +352,7 @@ class PlayoutDelay extends $pb.GeneratedMessage { createEmptyInstance: create) ..aOB(1, _omitFieldNames ? '' : 'enabled') ..a<$core.int>(2, _omitFieldNames ? '' : 'min', $pb.PbFieldType.OU3) + ..a<$core.int>(3, _omitFieldNames ? '' : 'max', $pb.PbFieldType.OU3) ..hasRequiredFields = false; @$core.Deprecated('Using this can add significant overhead to your binary. ' @@ -416,6 +401,18 @@ class PlayoutDelay extends $pb.GeneratedMessage { $core.bool hasMin() => $_has(1); @$pb.TagNumber(2) void clearMin() => clearField(2); + + @$pb.TagNumber(3) + $core.int get max => $_getIZ(2); + @$pb.TagNumber(3) + set max($core.int v) { + $_setUnsignedInt32(2, v); + } + + @$pb.TagNumber(3) + $core.bool hasMax() => $_has(2); + @$pb.TagNumber(3) + void clearMax() => clearField(3); } class ParticipantPermission extends $pb.GeneratedMessage { @@ -427,6 +424,7 @@ class ParticipantPermission extends $pb.GeneratedMessage { $core.bool? recorder, $core.Iterable? canPublishSources, $core.bool? canUpdateMetadata, + $core.bool? agent, }) { final $result = create(); if (canSubscribe != null) { @@ -450,6 +448,9 @@ class ParticipantPermission extends $pb.GeneratedMessage { if (canUpdateMetadata != null) { $result.canUpdateMetadata = canUpdateMetadata; } + if (agent != null) { + $result.agent = agent; + } return $result; } ParticipantPermission._() : super(); @@ -475,6 +476,7 @@ class ParticipantPermission extends $pb.GeneratedMessage { enumValues: TrackSource.values, defaultEnumValue: TrackSource.UNKNOWN) ..aOB(10, _omitFieldNames ? '' : 'canUpdateMetadata') + ..aOB(11, _omitFieldNames ? '' : 'agent') ..hasRequiredFields = false; @$core.Deprecated('Using this can add significant overhead to your binary. ' @@ -583,6 +585,19 @@ class ParticipantPermission extends $pb.GeneratedMessage { $core.bool hasCanUpdateMetadata() => $_has(6); @$pb.TagNumber(10) void clearCanUpdateMetadata() => clearField(10); + + /// indicates that participant is an agent + @$pb.TagNumber(11) + $core.bool get agent => $_getBF(7); + @$pb.TagNumber(11) + set agent($core.bool v) { + $_setBool(7, v); + } + + @$pb.TagNumber(11) + $core.bool hasAgent() => $_has(7); + @$pb.TagNumber(11) + void clearAgent() => clearField(11); } class ParticipantInfo extends $pb.GeneratedMessage { @@ -598,6 +613,7 @@ class ParticipantInfo extends $pb.GeneratedMessage { ParticipantPermission? permission, $core.String? region, $core.bool? isPublisher, + ParticipantInfo_Kind? kind, }) { final $result = create(); if (sid != null) { @@ -633,6 +649,9 @@ class ParticipantInfo extends $pb.GeneratedMessage { if (isPublisher != null) { $result.isPublisher = isPublisher; } + if (kind != null) { + $result.kind = kind; + } return $result; } ParticipantInfo._() : super(); @@ -664,6 +683,11 @@ class ParticipantInfo extends $pb.GeneratedMessage { subBuilder: ParticipantPermission.create) ..aOS(12, _omitFieldNames ? '' : 'region') ..aOB(13, _omitFieldNames ? '' : 'isPublisher') + ..e( + 14, _omitFieldNames ? '' : 'kind', $pb.PbFieldType.OE, + defaultOrMaker: ParticipantInfo_Kind.STANDARD, + valueOf: ParticipantInfo_Kind.valueOf, + enumValues: ParticipantInfo_Kind.values) ..hasRequiredFields = false; @$core.Deprecated('Using this can add significant overhead to your binary. ' @@ -816,6 +840,18 @@ class ParticipantInfo extends $pb.GeneratedMessage { $core.bool hasIsPublisher() => $_has(10); @$pb.TagNumber(13) void clearIsPublisher() => clearField(13); + + @$pb.TagNumber(14) + ParticipantInfo_Kind get kind => $_getN(11); + @$pb.TagNumber(14) + set kind(ParticipantInfo_Kind v) { + setField(14, v); + } + + @$pb.TagNumber(14) + $core.bool hasKind() => $_has(11); + @$pb.TagNumber(14) + void clearKind() => clearField(14); } class Encryption extends $pb.GeneratedMessage { @@ -979,6 +1015,7 @@ class TrackInfo extends $pb.GeneratedMessage { $core.bool? disableRed, Encryption_Type? encryption, $core.String? stream, + TimedVersion? version, }) { final $result = create(); if (sid != null) { @@ -1032,6 +1069,9 @@ class TrackInfo extends $pb.GeneratedMessage { if (stream != null) { $result.stream = stream; } + if (version != null) { + $result.version = version; + } return $result; } TrackInfo._() : super(); @@ -1076,6 +1116,8 @@ class TrackInfo extends $pb.GeneratedMessage { valueOf: Encryption_Type.valueOf, enumValues: Encryption_Type.values) ..aOS(17, _omitFieldNames ? '' : 'stream') + ..aOM(18, _omitFieldNames ? '' : 'version', + subBuilder: TimedVersion.create) ..hasRequiredFields = false; @$core.Deprecated('Using this can add significant overhead to your binary. ' @@ -1292,6 +1334,20 @@ class TrackInfo extends $pb.GeneratedMessage { $core.bool hasStream() => $_has(16); @$pb.TagNumber(17) void clearStream() => clearField(17); + + @$pb.TagNumber(18) + TimedVersion get version => $_getN(17); + @$pb.TagNumber(18) + set version(TimedVersion v) { + setField(18, v); + } + + @$pb.TagNumber(18) + $core.bool hasVersion() => $_has(17); + @$pb.TagNumber(18) + void clearVersion() => clearField(18); + @$pb.TagNumber(18) + TimedVersion ensureVersion() => $_ensure(17); } /// provide information about available spatial layers diff --git a/lib/src/proto/livekit_models.pbenum.dart b/lib/src/proto/livekit_models.pbenum.dart index e65c600c..38afa24c 100644 --- a/lib/src/proto/livekit_models.pbenum.dart +++ b/lib/src/proto/livekit_models.pbenum.dart @@ -58,6 +58,24 @@ class VideoCodec extends $pb.ProtobufEnum { const VideoCodec._($core.int v, $core.String n) : super(v, n); } +class ImageCodec extends $pb.ProtobufEnum { + static const ImageCodec IC_DEFAULT = + ImageCodec._(0, _omitEnumNames ? '' : 'IC_DEFAULT'); + static const ImageCodec IC_JPEG = + ImageCodec._(1, _omitEnumNames ? '' : 'IC_JPEG'); + + static const $core.List values = [ + IC_DEFAULT, + IC_JPEG, + ]; + + static final $core.Map<$core.int, ImageCodec> _byValue = + $pb.ProtobufEnum.initByValue(values); + static ImageCodec? valueOf($core.int value) => _byValue[value]; + + const ImageCodec._($core.int v, $core.String n) : super(v, n); +} + class TrackType extends $pb.ProtobufEnum { static const TrackType AUDIO = TrackType._(0, _omitEnumNames ? '' : 'AUDIO'); static const TrackType VIDEO = TrackType._(1, _omitEnumNames ? '' : 'VIDEO'); @@ -134,11 +152,14 @@ class ConnectionQuality extends $pb.ProtobufEnum { ConnectionQuality._(1, _omitEnumNames ? '' : 'GOOD'); static const ConnectionQuality EXCELLENT = ConnectionQuality._(2, _omitEnumNames ? '' : 'EXCELLENT'); + static const ConnectionQuality LOST = + ConnectionQuality._(3, _omitEnumNames ? '' : 'LOST'); static const $core.List values = [ POOR, GOOD, EXCELLENT, + LOST, ]; static final $core.Map<$core.int, ConnectionQuality> _byValue = @@ -278,6 +299,33 @@ class ParticipantInfo_State extends $pb.ProtobufEnum { const ParticipantInfo_State._($core.int v, $core.String n) : super(v, n); } +class ParticipantInfo_Kind extends $pb.ProtobufEnum { + static const ParticipantInfo_Kind STANDARD = + ParticipantInfo_Kind._(0, _omitEnumNames ? '' : 'STANDARD'); + static const ParticipantInfo_Kind INGRESS = + ParticipantInfo_Kind._(1, _omitEnumNames ? '' : 'INGRESS'); + static const ParticipantInfo_Kind EGRESS = + ParticipantInfo_Kind._(2, _omitEnumNames ? '' : 'EGRESS'); + static const ParticipantInfo_Kind SIP = + ParticipantInfo_Kind._(3, _omitEnumNames ? '' : 'SIP'); + static const ParticipantInfo_Kind AGENT = + ParticipantInfo_Kind._(4, _omitEnumNames ? '' : 'AGENT'); + + static const $core.List values = [ + STANDARD, + INGRESS, + EGRESS, + SIP, + AGENT, + ]; + + static final $core.Map<$core.int, ParticipantInfo_Kind> _byValue = + $pb.ProtobufEnum.initByValue(values); + static ParticipantInfo_Kind? valueOf($core.int value) => _byValue[value]; + + const ParticipantInfo_Kind._($core.int v, $core.String n) : super(v, n); +} + class Encryption_Type extends $pb.ProtobufEnum { static const Encryption_Type NONE = Encryption_Type._(0, _omitEnumNames ? '' : 'NONE'); diff --git a/lib/src/proto/livekit_models.pbjson.dart b/lib/src/proto/livekit_models.pbjson.dart index 1dff91e3..5a6ad70f 100644 --- a/lib/src/proto/livekit_models.pbjson.dart +++ b/lib/src/proto/livekit_models.pbjson.dart @@ -44,6 +44,19 @@ final $typed_data.Uint8List videoCodecDescriptor = $convert.base64Decode( 'CgpWaWRlb0NvZGVjEg4KCkRFRkFVTFRfVkMQABIRCg1IMjY0X0JBU0VMSU5FEAESDQoJSDI2NF' '9NQUlOEAISDQoJSDI2NF9ISUdIEAMSBwoDVlA4EAQ='); +@$core.Deprecated('Use imageCodecDescriptor instead') +const ImageCodec$json = { + '1': 'ImageCodec', + '2': [ + {'1': 'IC_DEFAULT', '2': 0}, + {'1': 'IC_JPEG', '2': 1}, + ], +}; + +/// Descriptor for `ImageCodec`. Decode as a `google.protobuf.EnumDescriptorProto`. +final $typed_data.Uint8List imageCodecDescriptor = $convert + .base64Decode('CgpJbWFnZUNvZGVjEg4KCklDX0RFRkFVTFQQABILCgdJQ19KUEVHEAE='); + @$core.Deprecated('Use trackTypeDescriptor instead') const TrackType$json = { '1': 'TrackType', @@ -97,12 +110,14 @@ const ConnectionQuality$json = { {'1': 'POOR', '2': 0}, {'1': 'GOOD', '2': 1}, {'1': 'EXCELLENT', '2': 2}, + {'1': 'LOST', '2': 3}, ], }; /// Descriptor for `ConnectionQuality`. Decode as a `google.protobuf.EnumDescriptorProto`. final $typed_data.Uint8List connectionQualityDescriptor = $convert.base64Decode( - 'ChFDb25uZWN0aW9uUXVhbGl0eRIICgRQT09SEAASCAoER09PRBABEg0KCUVYQ0VMTEVOVBAC'); + 'ChFDb25uZWN0aW9uUXVhbGl0eRIICgRQT09SEAASCAoER09PRBABEg0KCUVYQ0VMTEVOVBACEg' + 'gKBExPU1QQAw=='); @$core.Deprecated('Use clientConfigSettingDescriptor instead') const ClientConfigSetting$json = { @@ -196,14 +211,6 @@ const Room$json = { {'1': 'num_participants', '3': 9, '4': 1, '5': 13, '10': 'numParticipants'}, {'1': 'num_publishers', '3': 11, '4': 1, '5': 13, '10': 'numPublishers'}, {'1': 'active_recording', '3': 10, '4': 1, '5': 8, '10': 'activeRecording'}, - { - '1': 'playout_delay', - '3': 12, - '4': 1, - '5': 11, - '6': '.livekit.PlayoutDelay', - '10': 'playoutDelay' - }, ], }; @@ -216,8 +223,7 @@ final $typed_data.Uint8List roomDescriptor = $convert.base64Decode( 'Mg4ubGl2ZWtpdC5Db2RlY1INZW5hYmxlZENvZGVjcxIaCghtZXRhZGF0YRgIIAEoCVIIbWV0YW' 'RhdGESKQoQbnVtX3BhcnRpY2lwYW50cxgJIAEoDVIPbnVtUGFydGljaXBhbnRzEiUKDm51bV9w' 'dWJsaXNoZXJzGAsgASgNUg1udW1QdWJsaXNoZXJzEikKEGFjdGl2ZV9yZWNvcmRpbmcYCiABKA' - 'hSD2FjdGl2ZVJlY29yZGluZxI6Cg1wbGF5b3V0X2RlbGF5GAwgASgLMhUubGl2ZWtpdC5QbGF5' - 'b3V0RGVsYXlSDHBsYXlvdXREZWxheQ=='); + 'hSD2FjdGl2ZVJlY29yZGluZw=='); @$core.Deprecated('Use codecDescriptor instead') const Codec$json = { @@ -239,13 +245,14 @@ const PlayoutDelay$json = { '2': [ {'1': 'enabled', '3': 1, '4': 1, '5': 8, '10': 'enabled'}, {'1': 'min', '3': 2, '4': 1, '5': 13, '10': 'min'}, + {'1': 'max', '3': 3, '4': 1, '5': 13, '10': 'max'}, ], }; /// Descriptor for `PlayoutDelay`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List playoutDelayDescriptor = $convert.base64Decode( 'CgxQbGF5b3V0RGVsYXkSGAoHZW5hYmxlZBgBIAEoCFIHZW5hYmxlZBIQCgNtaW4YAiABKA1SA2' - '1pbg=='); + '1pbhIQCgNtYXgYAyABKA1SA21heA=='); @$core.Deprecated('Use participantPermissionDescriptor instead') const ParticipantPermission$json = { @@ -271,6 +278,7 @@ const ParticipantPermission$json = { '5': 8, '10': 'canUpdateMetadata' }, + {'1': 'agent', '3': 11, '4': 1, '5': 8, '10': 'agent'}, ], }; @@ -281,7 +289,7 @@ final $typed_data.Uint8List participantPermissionDescriptor = $convert.base64Dec 'dGEYAyABKAhSDmNhblB1Ymxpc2hEYXRhEkQKE2Nhbl9wdWJsaXNoX3NvdXJjZXMYCSADKA4yFC' '5saXZla2l0LlRyYWNrU291cmNlUhFjYW5QdWJsaXNoU291cmNlcxIWCgZoaWRkZW4YByABKAhS' 'BmhpZGRlbhIaCghyZWNvcmRlchgIIAEoCFIIcmVjb3JkZXISLgoTY2FuX3VwZGF0ZV9tZXRhZG' - 'F0YRgKIAEoCFIRY2FuVXBkYXRlTWV0YWRhdGE='); + 'F0YRgKIAEoCFIRY2FuVXBkYXRlTWV0YWRhdGESFAoFYWdlbnQYCyABKAhSBWFnZW50'); @$core.Deprecated('Use participantInfoDescriptor instead') const ParticipantInfo$json = { @@ -319,8 +327,16 @@ const ParticipantInfo$json = { }, {'1': 'region', '3': 12, '4': 1, '5': 9, '10': 'region'}, {'1': 'is_publisher', '3': 13, '4': 1, '5': 8, '10': 'isPublisher'}, + { + '1': 'kind', + '3': 14, + '4': 1, + '5': 14, + '6': '.livekit.ParticipantInfo.Kind', + '10': 'kind' + }, ], - '4': [ParticipantInfo_State$json], + '4': [ParticipantInfo_State$json, ParticipantInfo_Kind$json], }; @$core.Deprecated('Use participantInfoDescriptor instead') @@ -334,6 +350,18 @@ const ParticipantInfo_State$json = { ], }; +@$core.Deprecated('Use participantInfoDescriptor instead') +const ParticipantInfo_Kind$json = { + '1': 'Kind', + '2': [ + {'1': 'STANDARD', '2': 0}, + {'1': 'INGRESS', '2': 1}, + {'1': 'EGRESS', '2': 2}, + {'1': 'SIP', '2': 3}, + {'1': 'AGENT', '2': 4}, + ], +}; + /// Descriptor for `ParticipantInfo`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List participantInfoDescriptor = $convert.base64Decode( 'Cg9QYXJ0aWNpcGFudEluZm8SEAoDc2lkGAEgASgJUgNzaWQSGgoIaWRlbnRpdHkYAiABKAlSCG' @@ -342,9 +370,11 @@ final $typed_data.Uint8List participantInfoDescriptor = $convert.base64Decode( 'V0YWRhdGEYBSABKAlSCG1ldGFkYXRhEhsKCWpvaW5lZF9hdBgGIAEoA1IIam9pbmVkQXQSEgoE' 'bmFtZRgJIAEoCVIEbmFtZRIYCgd2ZXJzaW9uGAogASgNUgd2ZXJzaW9uEj4KCnBlcm1pc3Npb2' '4YCyABKAsyHi5saXZla2l0LlBhcnRpY2lwYW50UGVybWlzc2lvblIKcGVybWlzc2lvbhIWCgZy' - 'ZWdpb24YDCABKAlSBnJlZ2lvbhIhCgxpc19wdWJsaXNoZXIYDSABKAhSC2lzUHVibGlzaGVyIj' - '4KBVN0YXRlEgsKB0pPSU5JTkcQABIKCgZKT0lORUQQARIKCgZBQ1RJVkUQAhIQCgxESVNDT05O' - 'RUNURUQQAw=='); + 'ZWdpb24YDCABKAlSBnJlZ2lvbhIhCgxpc19wdWJsaXNoZXIYDSABKAhSC2lzUHVibGlzaGVyEj' + 'EKBGtpbmQYDiABKA4yHS5saXZla2l0LlBhcnRpY2lwYW50SW5mby5LaW5kUgRraW5kIj4KBVN0' + 'YXRlEgsKB0pPSU5JTkcQABIKCgZKT0lORUQQARIKCgZBQ1RJVkUQAhIQCgxESVNDT05ORUNURU' + 'QQAyJBCgRLaW5kEgwKCFNUQU5EQVJEEAASCwoHSU5HUkVTUxABEgoKBkVHUkVTUxACEgcKA1NJ' + 'UBADEgkKBUFHRU5UEAQ='); @$core.Deprecated('Use encryptionDescriptor instead') const Encryption$json = { @@ -446,6 +476,14 @@ const TrackInfo$json = { '10': 'encryption' }, {'1': 'stream', '3': 17, '4': 1, '5': 9, '10': 'stream'}, + { + '1': 'version', + '3': 18, + '4': 1, + '5': 11, + '6': '.livekit.TimedVersion', + '10': 'version' + }, ], }; @@ -460,7 +498,8 @@ final $typed_data.Uint8List trackInfoDescriptor = $convert.base64Decode( 'aW1lVHlwZRIQCgNtaWQYDCABKAlSA21pZBIzCgZjb2RlY3MYDSADKAsyGy5saXZla2l0LlNpbX' 'VsY2FzdENvZGVjSW5mb1IGY29kZWNzEhYKBnN0ZXJlbxgOIAEoCFIGc3RlcmVvEh8KC2Rpc2Fi' 'bGVfcmVkGA8gASgIUgpkaXNhYmxlUmVkEjgKCmVuY3J5cHRpb24YECABKA4yGC5saXZla2l0Lk' - 'VuY3J5cHRpb24uVHlwZVIKZW5jcnlwdGlvbhIWCgZzdHJlYW0YESABKAlSBnN0cmVhbQ=='); + 'VuY3J5cHRpb24uVHlwZVIKZW5jcnlwdGlvbhIWCgZzdHJlYW0YESABKAlSBnN0cmVhbRIvCgd2' + 'ZXJzaW9uGBIgASgLMhUubGl2ZWtpdC5UaW1lZFZlcnNpb25SB3ZlcnNpb24='); @$core.Deprecated('Use videoLayerDescriptor instead') const VideoLayer$json = {