github.com/livekit/protocol@v1.39.3/protobufs/livekit_models.proto (about)

     1  // Copyright 2023 LiveKit, Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  syntax = "proto3";
    16  
    17  package livekit;
    18  option go_package = "github.com/livekit/protocol/livekit";
    19  option csharp_namespace = "LiveKit.Proto";
    20  option ruby_package = "LiveKit::Proto";
    21  
    22  import "google/protobuf/timestamp.proto";
    23  
    24  import "livekit_metrics.proto";
    25  
    26  message Pagination {
    27    string after_id = 1; // list entities which IDs are greater
    28    int32  limit = 2;
    29  }
    30  
    31  // ListUpdate is used for updated APIs where 'repeated string' field is modified.
    32  message ListUpdate {
    33    repeated string set = 1; // set the field to a new list
    34  }
    35  
    36  message Room {
    37    string sid = 1;
    38    string name = 2;
    39    uint32 empty_timeout = 3;
    40    uint32 departure_timeout = 14;
    41    uint32 max_participants = 4;
    42    int64 creation_time = 5;
    43    int64 creation_time_ms = 15;
    44    string turn_password = 6;
    45    repeated Codec enabled_codecs = 7;
    46    string metadata = 8;
    47    uint32 num_participants = 9;
    48    uint32 num_publishers = 11;
    49    bool active_recording = 10;
    50    TimedVersion version = 13;
    51  
    52    // NEXT-ID: 16
    53  }
    54  
    55  message Codec {
    56    string mime = 1;
    57    string fmtp_line = 2;
    58  }
    59  
    60  enum AudioCodec {
    61    DEFAULT_AC = 0;
    62    OPUS = 1;
    63    AAC = 2;
    64  }
    65  
    66  enum VideoCodec {
    67    DEFAULT_VC = 0;
    68    H264_BASELINE = 1;
    69    H264_MAIN = 2;
    70    H264_HIGH = 3;
    71    VP8 = 4;
    72  }
    73  
    74  enum ImageCodec {
    75    IC_DEFAULT = 0;
    76    IC_JPEG = 1;
    77  }
    78  
    79  // Policy for publisher to handle subscribers that are unable to support the primary codec of a track
    80  enum BackupCodecPolicy {
    81    // default behavior, the track prefer to regress to backup codec and all subscribers will receive the backup codec,
    82    // the sfu will try to regress codec if possible but not assured.
    83    PREFER_REGRESSION = 0;
    84    // encoding/send the primary and backup codec simultaneously
    85    SIMULCAST = 1;
    86    // force the track to regress to backup codec, this option can be used in video conference or the publisher has limited bandwidth/encoding power
    87    REGRESSION = 2;
    88  }
    89  
    90  message PlayoutDelay {
    91    bool enabled = 1;
    92    uint32 min = 2;
    93    uint32 max = 3;
    94  }
    95  
    96  message ParticipantPermission {
    97    // allow participant to subscribe to other tracks in the room
    98    bool can_subscribe = 1;
    99    // allow participant to publish new tracks to room
   100    bool can_publish = 2;
   101    // allow participant to publish data
   102    bool can_publish_data = 3;
   103    // sources that are allowed to be published
   104    repeated TrackSource can_publish_sources = 9;
   105    // indicates that it's hidden to others
   106    bool hidden = 7;
   107    // indicates it's a recorder instance
   108    // deprecated: use ParticipantInfo.kind instead
   109    bool recorder = 8 [deprecated=true];
   110    // indicates that participant can update own metadata and attributes
   111    bool can_update_metadata = 10;
   112    // indicates that participant is an agent
   113    // deprecated: use ParticipantInfo.kind instead
   114    bool agent = 11 [deprecated=true];
   115    // if a participant can subscribe to metrics
   116    bool can_subscribe_metrics = 12;
   117  
   118    // NEXT_ID: 13
   119  }
   120  
   121  message ParticipantInfo {
   122    enum State {
   123      // websocket' connected, but not offered yet
   124      JOINING = 0;
   125      // server received client offer
   126      JOINED = 1;
   127      // ICE connectivity established
   128      ACTIVE = 2;
   129      // WS disconnected
   130      DISCONNECTED = 3;
   131    }
   132    enum Kind {
   133      // standard participants, e.g. web clients
   134      STANDARD = 0;
   135      // only ingests streams
   136      INGRESS = 1;
   137      // only consumes streams
   138      EGRESS = 2;
   139      // SIP participants
   140      SIP = 3;
   141      // LiveKit agents
   142      AGENT = 4;
   143  
   144      // NEXT_ID: 7
   145    }
   146    enum KindDetail {
   147      CLOUD_AGENT = 0;
   148      FORWARDED = 1;
   149    }
   150    string sid = 1;
   151    string identity = 2;
   152    State state = 3;
   153    repeated TrackInfo tracks = 4;
   154    string metadata = 5;
   155    // timestamp when participant joined room, in seconds
   156    int64 joined_at = 6;
   157    // timestamp when participant joined room, in milliseconds
   158    int64 joined_at_ms = 17;
   159    string name = 9;
   160    uint32 version = 10;
   161    ParticipantPermission permission = 11;
   162    string region = 12;
   163    // indicates the participant has an active publisher connection
   164    // and can publish to the server
   165    bool is_publisher = 13;
   166    Kind kind = 14;
   167    map<string, string> attributes = 15;
   168    DisconnectReason disconnect_reason = 16;
   169    repeated KindDetail kind_details = 18;
   170  
   171    // NEXT_ID: 19
   172  }
   173  
   174  enum TrackType {
   175    AUDIO = 0;
   176    VIDEO = 1;
   177    DATA = 2;
   178  }
   179  
   180  enum TrackSource {
   181    UNKNOWN = 0;
   182    CAMERA = 1;
   183    MICROPHONE = 2;
   184    SCREEN_SHARE = 3;
   185    SCREEN_SHARE_AUDIO = 4;
   186  }
   187  
   188  message Encryption {
   189    enum Type {
   190        NONE=0;
   191        GCM=1;
   192        CUSTOM=2;
   193    }
   194  }
   195  
   196  message SimulcastCodecInfo {
   197    string mime_type = 1;
   198    string mid = 2;
   199    string cid = 3;
   200    repeated VideoLayer layers = 4;
   201  }
   202  
   203  message TrackInfo {
   204    string sid = 1;
   205    TrackType type = 2;
   206    string name = 3;
   207    bool muted = 4;
   208    // original width of video (unset for audio)
   209    // clients may receive a lower resolution version with simulcast
   210    uint32 width = 5;
   211    // original height of video (unset for audio)
   212    uint32 height = 6;
   213    // true if track is simulcasted
   214    bool simulcast = 7;
   215    // true if DTX (Discontinuous Transmission) is disabled for audio
   216    bool disable_dtx = 8;
   217    // source of media
   218    TrackSource source = 9;
   219    repeated VideoLayer layers = 10;
   220    // mime type of codec
   221    string mime_type = 11;
   222    string mid = 12;
   223    repeated SimulcastCodecInfo codecs = 13;
   224    bool stereo = 14;
   225    // true if RED (Redundant Encoding) is disabled for audio
   226    bool disable_red = 15;
   227    Encryption.Type encryption = 16;
   228    string stream = 17;
   229    TimedVersion version = 18;
   230    repeated AudioTrackFeature audio_features = 19;
   231    BackupCodecPolicy backup_codec_policy = 20;
   232  }
   233  
   234  enum VideoQuality {
   235    LOW = 0;
   236    MEDIUM = 1;
   237    HIGH = 2;
   238    OFF = 3;
   239  }
   240  
   241  // provide information about available spatial layers
   242  message VideoLayer {
   243    // for tracks with a single layer, this should be HIGH
   244    VideoQuality quality = 1;
   245    uint32 width = 2;
   246    uint32 height = 3;
   247    // target bitrate in bit per second (bps), server will measure actual
   248    uint32 bitrate = 4;
   249    uint32 ssrc = 5;
   250    int32 spatial_layer = 6;
   251    string rid = 7;
   252  }
   253  
   254  // new DataPacket API
   255  message DataPacket {
   256    enum Kind {
   257      RELIABLE = 0;
   258      LOSSY = 1;
   259    }
   260    Kind kind = 1 [deprecated=true];
   261    // participant identity of user that sent the message
   262    string participant_identity = 4;
   263    // identities of participants who will receive the message (sent to all by default)
   264    repeated string destination_identities = 5;
   265    oneof value {
   266      UserPacket user = 2;
   267      ActiveSpeakerUpdate speaker = 3 [deprecated=true];
   268      SipDTMF sip_dtmf = 6;
   269      Transcription transcription = 7;
   270      MetricsBatch metrics = 8;
   271      ChatMessage chat_message = 9;
   272      RpcRequest rpc_request = 10;
   273      RpcAck rpc_ack = 11;
   274      RpcResponse rpc_response = 12;
   275      DataStream.Header stream_header = 13;
   276      DataStream.Chunk stream_chunk = 14;
   277      DataStream.Trailer stream_trailer = 15;
   278    }
   279    // sequence number of reliable packet
   280    uint32 sequence = 16;
   281    // sid of the user that sent the message
   282    string participant_sid = 17;
   283  
   284    // NEXT_ID: 18
   285  }
   286  
   287  message ActiveSpeakerUpdate {
   288    repeated SpeakerInfo speakers = 1;
   289  }
   290  
   291  message SpeakerInfo {
   292    string sid = 1;
   293    // audio level, 0-1.0, 1 is loudest
   294    float level = 2;
   295    // true if speaker is currently active
   296    bool active = 3;
   297  }
   298  
   299  message UserPacket {
   300    // participant ID of user that sent the message
   301    string participant_sid = 1 [deprecated=true];
   302    string participant_identity = 5 [deprecated=true];
   303    // user defined payload
   304    bytes payload = 2;
   305    // the ID of the participants who will receive the message (sent to all by default)
   306    repeated string destination_sids = 3 [deprecated=true];
   307    // identities of participants who will receive the message (sent to all by default)
   308    repeated string destination_identities = 6 [deprecated=true];
   309    // topic under which the message was published
   310    optional string topic = 4;
   311    // Unique ID to indentify the message
   312    optional string id = 8;
   313    // start and end time allow relating the message to specific media time
   314    optional uint64 start_time = 9;
   315    optional uint64 end_time = 10;
   316    // added by SDK to enable de-duping of messages, for INTERNAL USE ONLY
   317    bytes nonce = 11;
   318  
   319    // NEXT_ID: 12
   320  }
   321  
   322  message SipDTMF {
   323    uint32 code = 3;
   324    string digit = 4;
   325  }
   326  
   327  message Transcription {
   328    // Participant that got its speech transcribed
   329    string transcribed_participant_identity = 2;
   330    string track_id = 3;
   331    repeated TranscriptionSegment segments = 4;
   332  
   333    // NEXT_ID: 6
   334  }
   335  
   336  message TranscriptionSegment {
   337    string id = 1;
   338    string text = 2;
   339    uint64 start_time = 3;
   340    uint64 end_time = 4;
   341    bool final = 5;
   342    string language = 6;
   343  }
   344  
   345  message ChatMessage {
   346    string id = 1; // uuid
   347    int64 timestamp = 2;
   348    optional int64 edit_timestamp = 3; // populated only if the intent is to edit/update an existing message
   349    string message = 4;
   350    bool deleted = 5; // true to remove message
   351    bool generated = 6; // true if the chat message has been generated by an agent from a participant's audio transcription
   352  }
   353  
   354  message RpcRequest {
   355    string id = 1;
   356    string method = 2;
   357    string payload = 3;
   358    uint32 response_timeout_ms = 4;
   359    uint32 version = 5;
   360  }
   361  
   362  message RpcAck {
   363    string request_id = 1;
   364  }
   365  
   366  message RpcResponse {
   367    string request_id = 1;
   368    oneof value {
   369      string payload = 2;
   370      RpcError error = 3;
   371    }
   372  }
   373  
   374  message RpcError {
   375    uint32 code = 1;
   376    string message = 2;
   377    string data = 3;
   378  }
   379  
   380  enum ConnectionQuality {
   381    POOR = 0;
   382    GOOD = 1;
   383    EXCELLENT = 2;
   384    LOST = 3;
   385  }
   386  
   387  message ParticipantTracks {
   388    // participant ID of participant to whom the tracks belong
   389    string participant_sid = 1;
   390    repeated string track_sids = 2;
   391  }
   392  
   393  // details about the server
   394  message ServerInfo {
   395    enum Edition {
   396      Standard = 0;
   397      Cloud = 1;
   398    }
   399    Edition edition = 1;
   400    string version = 2;
   401    int32 protocol = 3;
   402    string region = 4;
   403    string node_id = 5;
   404    // additional debugging information. sent only if server is in development mode
   405    string debug_info = 6;
   406    int32 agent_protocol = 7;
   407  }
   408  
   409  // details about the client
   410  message ClientInfo {
   411    enum SDK {
   412       UNKNOWN = 0;
   413       JS = 1;
   414       SWIFT = 2;
   415       ANDROID = 3;
   416       FLUTTER = 4;
   417       GO = 5;
   418       UNITY = 6;
   419       REACT_NATIVE = 7;
   420       RUST = 8;
   421       PYTHON = 9;
   422       CPP = 10;
   423       UNITY_WEB = 11;
   424       NODE = 12;
   425       UNREAL = 13;
   426       ESP32 = 14;
   427    }
   428  
   429    SDK sdk = 1;
   430    string version = 2;
   431    int32 protocol = 3;
   432    string os = 4;
   433    string os_version = 5;
   434    string device_model = 6;
   435    string browser = 7;
   436    string browser_version = 8;
   437    string address = 9;
   438    // wifi, wired, cellular, vpn, empty if not known
   439    string network = 10;
   440    // comma separated list of additional LiveKit SDKs in use of this client, with versions
   441    // e.g. "components-js:1.2.3,track-processors-js:1.2.3"
   442    string other_sdks = 11;
   443  }
   444  
   445  // server provided client configuration
   446  message ClientConfiguration {
   447    VideoConfiguration video = 1;
   448    VideoConfiguration screen = 2;
   449  
   450    ClientConfigSetting resume_connection = 3;
   451    DisabledCodecs disabled_codecs = 4;
   452    ClientConfigSetting force_relay = 5;
   453  }
   454  
   455  enum ClientConfigSetting {
   456    UNSET = 0;
   457    DISABLED = 1;
   458    ENABLED = 2;
   459  }
   460  
   461  message VideoConfiguration {
   462    ClientConfigSetting hardware_encoder = 1;
   463  }
   464  
   465  message DisabledCodecs {
   466    // disabled for both publish and subscribe
   467    repeated Codec codecs = 1;
   468    // only disable for publish
   469    repeated Codec publish = 2;
   470  }
   471  
   472  enum DisconnectReason {
   473    UNKNOWN_REASON = 0;
   474    // the client initiated the disconnect
   475    CLIENT_INITIATED = 1;
   476    // another participant with the same identity has joined the room
   477    DUPLICATE_IDENTITY = 2;
   478    // the server instance is shutting down
   479    SERVER_SHUTDOWN = 3;
   480    // RoomService.RemoveParticipant was called
   481    PARTICIPANT_REMOVED = 4;
   482    // RoomService.DeleteRoom was called
   483    ROOM_DELETED = 5;
   484    // the client is attempting to resume a session, but server is not aware of it
   485    STATE_MISMATCH = 6;
   486    // client was unable to connect fully
   487    JOIN_FAILURE = 7;
   488    // Cloud-only, the server requested Participant to migrate the connection elsewhere
   489    MIGRATION = 8;
   490    // the signal websocket was closed unexpectedly
   491    SIGNAL_CLOSE = 9;
   492    // the room was closed, due to all Standard and Ingress participants having left
   493    ROOM_CLOSED = 10;
   494    // SIP callee did not respond in time
   495    USER_UNAVAILABLE = 11;
   496    // SIP callee rejected the call (busy)
   497    USER_REJECTED = 12;
   498    // SIP protocol failure or unexpected response
   499    SIP_TRUNK_FAILURE = 13;
   500    // server timed out a participant session
   501    CONNECTION_TIMEOUT = 14;
   502    // media stream failure or media timeout
   503    MEDIA_FAILURE = 15;
   504  }
   505  
   506  message RTPDrift {
   507    google.protobuf.Timestamp start_time = 1;
   508    google.protobuf.Timestamp end_time = 2;
   509    double duration = 3;
   510  
   511    uint64 start_timestamp = 4;
   512    uint64 end_timestamp = 5;
   513    uint64 rtp_clock_ticks = 6;
   514    int64 drift_samples = 7;
   515    double drift_ms = 8;
   516    double clock_rate = 9;
   517  }
   518  
   519  message RTPStats {
   520    google.protobuf.Timestamp start_time = 1;
   521    google.protobuf.Timestamp end_time = 2;
   522    double duration = 3;
   523  
   524    uint32 packets = 4;
   525    double packet_rate = 5;
   526  
   527    uint64 bytes = 6;
   528    uint64 header_bytes = 39;
   529    double bitrate = 7;
   530  
   531    uint32 packets_lost = 8;
   532    double packet_loss_rate = 9;
   533    float packet_loss_percentage = 10;
   534  
   535    uint32 packets_duplicate = 11;
   536    double packet_duplicate_rate = 12;
   537  
   538    uint64 bytes_duplicate = 13;
   539    uint64 header_bytes_duplicate = 40;
   540    double bitrate_duplicate = 14;
   541  
   542    uint32 packets_padding = 15;
   543    double packet_padding_rate = 16;
   544  
   545    uint64 bytes_padding = 17;
   546    uint64 header_bytes_padding = 41;
   547    double bitrate_padding = 18;
   548  
   549    uint32 packets_out_of_order = 19;
   550  
   551    uint32 frames = 20;
   552    double frame_rate = 21;
   553  
   554    double jitter_current = 22;
   555    double jitter_max = 23;
   556  
   557    map<int32, uint32> gap_histogram = 24;
   558  
   559    uint32 nacks = 25;
   560    uint32 nack_acks = 37;
   561    uint32 nack_misses = 26;
   562    uint32 nack_repeated = 38;
   563  
   564    uint32 plis = 27;
   565    google.protobuf.Timestamp last_pli = 28;
   566  
   567    uint32 firs = 29;
   568    google.protobuf.Timestamp last_fir = 30;
   569  
   570    uint32 rtt_current = 31;
   571    uint32 rtt_max = 32;
   572  
   573    uint32 key_frames = 33;
   574    google.protobuf.Timestamp last_key_frame = 34;
   575  
   576    uint32 layer_lock_plis = 35;
   577    google.protobuf.Timestamp last_layer_lock_pli = 36;
   578  
   579    RTPDrift packet_drift = 44;
   580    RTPDrift ntp_report_drift = 45;
   581    RTPDrift rebased_report_drift = 46;
   582    RTPDrift received_report_drift = 47;
   583    // NEXT_ID: 48
   584  }
   585  
   586  message RTCPSenderReportState {
   587    uint32 rtp_timestamp = 1;
   588    uint64 rtp_timestamp_ext = 2;
   589    uint64 ntp_timestamp = 3;
   590    int64 at = 4; // time at which this happened
   591    int64 at_adjusted = 5;
   592    uint32 packets = 6;
   593    uint64 octets = 7;
   594  }
   595  
   596  message RTPForwarderState {
   597    bool started = 1;
   598    int32 reference_layer_spatial = 2;
   599    int64 pre_start_time = 3;
   600    uint64 ext_first_timestamp = 4;
   601    uint64 dummy_start_timestamp_offset = 5;
   602    RTPMungerState rtp_munger = 6;
   603    oneof codec_munger {
   604      VP8MungerState vp8_munger = 7;
   605    }
   606    repeated RTCPSenderReportState sender_report_state = 8;
   607  }
   608  
   609  message RTPMungerState {
   610    uint64 ext_last_sequence_number = 1;
   611    uint64 ext_second_last_sequence_number = 2;
   612    uint64 ext_last_timestamp = 3;
   613    uint64 ext_second_last_timestamp = 4;
   614    bool last_marker = 5;
   615    bool second_last_marker = 6;
   616  }
   617  
   618  message VP8MungerState {
   619    int32 ext_last_picture_id = 1;
   620    bool picture_id_used = 2;
   621    uint32 last_tl0_pic_idx = 3;
   622    bool tl0_pic_idx_used = 4;
   623    bool tid_used = 5;
   624    uint32 last_key_idx = 6;
   625    bool key_idx_used = 7;
   626  }
   627  
   628  message TimedVersion {
   629    int64 unix_micro = 1;
   630    int32 ticks = 2;
   631  }
   632  
   633  enum ReconnectReason {
   634    RR_UNKNOWN = 0;
   635    RR_SIGNAL_DISCONNECTED = 1;
   636    RR_PUBLISHER_FAILED = 2;
   637    RR_SUBSCRIBER_FAILED = 3;
   638    RR_SWITCH_CANDIDATE = 4;
   639  }
   640  
   641  enum SubscriptionError {
   642    SE_UNKNOWN = 0;
   643    SE_CODEC_UNSUPPORTED = 1;
   644    SE_TRACK_NOTFOUND = 2;
   645  }
   646  
   647  enum AudioTrackFeature {
   648    TF_STEREO = 0;
   649    TF_NO_DTX = 1;
   650    TF_AUTO_GAIN_CONTROL = 2;
   651    TF_ECHO_CANCELLATION = 3;
   652    TF_NOISE_SUPPRESSION = 4;
   653    TF_ENHANCED_NOISE_CANCELLATION = 5;
   654    TF_PRECONNECT_BUFFER = 6; // client will buffer audio once available and send it to the server via bytes stream once connected
   655  }
   656  
   657  message DataStream {
   658  
   659    // enum for operation types (specific to TextHeader)
   660    enum OperationType {
   661      CREATE = 0;
   662      UPDATE = 1;
   663      DELETE = 2;
   664      REACTION = 3;
   665    }
   666  
   667    // header properties specific to text streams
   668    message TextHeader {
   669      OperationType operation_type = 1;
   670      int32 version = 2;  // Optional: Version for updates/edits
   671      string reply_to_stream_id = 3;  // Optional: Reply to specific message
   672      repeated string attached_stream_ids = 4; // file attachments for text streams
   673      bool generated = 5; // true if the text has been generated by an agent from a participant's audio transcription
   674  
   675    }
   676  
   677    // header properties specific to byte or file streams
   678    message ByteHeader {
   679      string name = 1;
   680    }
   681  
   682    // main DataStream.Header that contains a oneof for specific headers
   683    message Header {
   684      string stream_id = 1; // unique identifier for this data stream
   685      int64 timestamp = 2;  // using int64 for Unix timestamp
   686      string topic = 3;
   687      string mime_type = 4;
   688      optional uint64 total_length = 5;  // only populated for finite streams, if it's a stream of unknown size this stays empty
   689      Encryption.Type encryption_type = 7;  // defaults to NONE
   690      map<string, string> attributes = 8;  // user defined attributes map that can carry additional info
   691  
   692      // oneof to choose between specific header types
   693      oneof content_header {
   694        TextHeader text_header = 9;
   695        ByteHeader byte_header = 10;
   696      }
   697    }
   698  
   699    message Chunk {
   700      string stream_id = 1;  // unique identifier for this data stream to map it to the correct header
   701      uint64 chunk_index = 2;
   702      bytes content = 3; // content as binary (bytes)
   703      int32 version = 4; // a version indicating that this chunk_index has been retroactively modified and the original one needs to be replaced
   704      optional bytes iv = 5; // optional, initialization vector for AES-GCM encryption
   705    }
   706  
   707    message Trailer {
   708      string stream_id = 1; // unique identifier for this data stream
   709      string reason = 2; // reason why the stream was closed (could contain "error" / "interrupted" / empty for expected end)
   710      map<string, string> attributes = 3; // finalizing updates for the stream, can also include additional insights for errors or endTime for transcription
   711    }
   712  }
   713  
   714  message WebhookConfig {
   715    string url = 1;
   716    string signing_key = 2;
   717  }