github.com/livekit/protocol@v1.16.1-0.20240517185851-47e4c6bba773/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  message Room {
    25    string sid = 1;
    26    string name = 2;
    27    uint32 empty_timeout = 3;
    28    uint32 departure_timeout = 14;
    29    uint32 max_participants = 4;
    30    int64 creation_time = 5;
    31    string turn_password = 6;
    32    repeated Codec enabled_codecs = 7;
    33    string metadata = 8;
    34    uint32 num_participants = 9;
    35    uint32 num_publishers = 11;
    36    bool active_recording = 10;
    37    TimedVersion version = 13;
    38  
    39    // NEXT-ID: 15
    40  }
    41  
    42  message Codec {
    43    string mime = 1;
    44    string fmtp_line = 2;
    45  }
    46  
    47  enum AudioCodec {
    48    DEFAULT_AC = 0;
    49    OPUS = 1;
    50    AAC = 2;
    51  }
    52  
    53  enum VideoCodec {
    54    DEFAULT_VC = 0;
    55    H264_BASELINE = 1;
    56    H264_MAIN = 2;
    57    H264_HIGH = 3;
    58    VP8 = 4;
    59  }
    60  
    61  enum ImageCodec {
    62    IC_DEFAULT = 0;
    63    IC_JPEG = 1;
    64  }
    65  
    66  message PlayoutDelay {
    67    bool enabled = 1;
    68    uint32 min = 2;
    69    uint32 max = 3;
    70  }
    71  
    72  message ParticipantPermission {
    73    // allow participant to subscribe to other tracks in the room
    74    bool can_subscribe = 1;
    75    // allow participant to publish new tracks to room
    76    bool can_publish = 2;
    77    // allow participant to publish data
    78    bool can_publish_data = 3;
    79    // sources that are allowed to be published
    80    repeated TrackSource can_publish_sources = 9;
    81    // indicates that it's hidden to others
    82    bool hidden = 7;
    83    // indicates it's a recorder instance
    84    bool recorder = 8;
    85    // indicates that participant can update own metadata
    86    bool can_update_metadata = 10;
    87    // indicates that participant is an agent
    88    bool agent = 11;
    89  
    90    // NEXT_ID: 12
    91  }
    92  
    93  message ParticipantInfo {
    94    enum State {
    95      // websocket' connected, but not offered yet
    96      JOINING = 0;
    97      // server received client offer
    98      JOINED = 1;
    99      // ICE connectivity established
   100      ACTIVE = 2;
   101      // WS disconnected
   102      DISCONNECTED = 3;
   103    }
   104    enum Kind {
   105      // standard participants, e.g. web clients
   106      STANDARD = 0;
   107      // only ingests streams
   108      INGRESS = 1;
   109      // only consumes streams
   110      EGRESS = 2;
   111      // SIP participants
   112      SIP = 3;
   113      // LiveKit agents
   114      AGENT = 4;
   115    }
   116    string sid = 1;
   117    string identity = 2;
   118    State state = 3;
   119    repeated TrackInfo tracks = 4;
   120    string metadata = 5;
   121    // timestamp when participant joined room, in seconds
   122    int64 joined_at = 6;
   123    string name = 9;
   124    uint32 version = 10;
   125    ParticipantPermission permission = 11;
   126    string region = 12;
   127    // indicates the participant has an active publisher connection
   128    // and can publish to the server
   129    bool is_publisher = 13;
   130    Kind kind = 14;
   131  }
   132  
   133  enum TrackType {
   134    AUDIO = 0;
   135    VIDEO = 1;
   136    DATA = 2;
   137  }
   138  
   139  enum TrackSource {
   140    UNKNOWN = 0;
   141    CAMERA = 1;
   142    MICROPHONE = 2;
   143    SCREEN_SHARE = 3;
   144    SCREEN_SHARE_AUDIO = 4;
   145  }
   146  
   147  message Encryption {
   148    enum Type {
   149        NONE=0;
   150        GCM=1;
   151        CUSTOM=2;
   152    }
   153  }
   154  
   155  message SimulcastCodecInfo {
   156    string mime_type = 1;
   157    string mid = 2;
   158    string cid = 3;
   159    repeated VideoLayer layers = 4;
   160  }
   161  
   162  message TrackInfo {
   163    string sid = 1;
   164    TrackType type = 2;
   165    string name = 3;
   166    bool muted = 4;
   167    // original width of video (unset for audio)
   168    // clients may receive a lower resolution version with simulcast
   169    uint32 width = 5;
   170    // original height of video (unset for audio)
   171    uint32 height = 6;
   172    // true if track is simulcasted
   173    bool simulcast = 7;
   174    // true if DTX (Discontinuous Transmission) is disabled for audio
   175    bool disable_dtx = 8;
   176    // source of media
   177    TrackSource source = 9;
   178    repeated VideoLayer layers = 10;
   179    // mime type of codec
   180    string mime_type = 11;
   181    string mid = 12;
   182    repeated SimulcastCodecInfo codecs = 13;
   183    bool stereo = 14;
   184    // true if RED (Redundant Encoding) is disabled for audio
   185    bool disable_red = 15;
   186    Encryption.Type encryption = 16;
   187    string stream = 17;
   188    TimedVersion version = 18;
   189    repeated AudioTrackFeature audio_features = 19;
   190  }
   191  
   192  enum VideoQuality {
   193    LOW = 0;
   194    MEDIUM = 1;
   195    HIGH = 2;
   196    OFF = 3;
   197  }
   198  
   199  // provide information about available spatial layers
   200  message VideoLayer {
   201    // for tracks with a single layer, this should be HIGH
   202    VideoQuality quality = 1;
   203    uint32 width = 2;
   204    uint32 height = 3;
   205    // target bitrate in bit per second (bps), server will measure actual
   206    uint32 bitrate = 4;
   207    uint32 ssrc = 5;
   208  }
   209  
   210  // new DataPacket API
   211  message DataPacket {
   212    enum Kind {
   213      RELIABLE = 0;
   214      LOSSY = 1;
   215    }
   216    Kind kind = 1 [deprecated=true];
   217    // participant identity of user that sent the message
   218    string participant_identity = 4;
   219    // identities of participants who will receive the message (sent to all by default)
   220    repeated string destination_identities = 5;
   221    oneof value {
   222      UserPacket user = 2;
   223      ActiveSpeakerUpdate speaker = 3 [deprecated=true];
   224      SipDTMF sip_dtmf = 6;
   225      Transcription transcription = 7;
   226    }
   227    // NEXT_ID: 8
   228  }
   229  
   230  message ActiveSpeakerUpdate {
   231    repeated SpeakerInfo speakers = 1;
   232  }
   233  
   234  message SpeakerInfo {
   235    string sid = 1;
   236    // audio level, 0-1.0, 1 is loudest
   237    float level = 2;
   238    // true if speaker is currently active
   239    bool active = 3;
   240  }
   241  
   242  message UserPacket {
   243    // participant ID of user that sent the message
   244    string participant_sid = 1 [deprecated=true];
   245    string participant_identity = 5 [deprecated=true];
   246    // user defined payload
   247    bytes payload = 2;
   248    // the ID of the participants who will receive the message (sent to all by default)
   249    repeated string destination_sids = 3 [deprecated=true];
   250    // identities of participants who will receive the message (sent to all by default)
   251    repeated string destination_identities = 6 [deprecated=true];
   252    // topic under which the message was published
   253    optional string topic = 4;
   254    // Unique ID to indentify the message
   255    optional string id = 8;
   256    // start and end time allow relating the message to specific media time
   257    optional uint64 start_time = 9;
   258    optional uint64 end_time = 10;
   259  
   260    // NEXT_ID: 11
   261  }
   262  
   263  message SipDTMF {
   264    uint32 code = 3;
   265    string digit = 4;
   266  }
   267  
   268  message Transcription {
   269    // Participant that got its speech transcribed
   270    string transcribed_participant_identity = 2;
   271    string track_id = 3;
   272    repeated TranscriptionSegment segments = 4;
   273  
   274    // NEXT_ID: 6
   275  }
   276  
   277  message TranscriptionSegment {
   278    string id = 1;
   279    string text = 2;
   280    uint64 start_time = 3;
   281    uint64 end_time = 4;
   282    bool final = 5;
   283    string language = 6;
   284  }
   285  
   286  enum ConnectionQuality {
   287    POOR = 0;
   288    GOOD = 1;
   289    EXCELLENT = 2;
   290    LOST = 3;
   291  }
   292  
   293  message ParticipantTracks {
   294    // participant ID of participant to whom the tracks belong
   295    string participant_sid = 1;
   296    repeated string track_sids = 2;
   297  }
   298  
   299  // details about the server
   300  message ServerInfo {
   301    enum Edition {
   302      Standard = 0;
   303      Cloud = 1;
   304    }
   305    Edition edition = 1;
   306    string version = 2;
   307    int32 protocol = 3;
   308    string region = 4;
   309    string node_id = 5;
   310    // additional debugging information. sent only if server is in development mode
   311    string debug_info = 6;
   312    int32 agent_protocol = 7;
   313  }
   314  
   315  // details about the client
   316  message ClientInfo {
   317    enum SDK {
   318       UNKNOWN = 0;
   319       JS = 1;
   320       SWIFT = 2;
   321       ANDROID = 3;
   322       FLUTTER = 4;
   323       GO = 5;
   324       UNITY = 6;
   325       REACT_NATIVE = 7;
   326       RUST = 8;
   327       PYTHON = 9;
   328       CPP = 10;
   329    }
   330  
   331    SDK sdk = 1;
   332    string version = 2;
   333    int32 protocol = 3;
   334    string os = 4;
   335    string os_version = 5;
   336    string device_model = 6;
   337    string browser = 7;
   338    string browser_version = 8;
   339    string address = 9;
   340    // wifi, wired, cellular, vpn, empty if not known
   341    string network = 10;
   342  }
   343  
   344  // server provided client configuration
   345  message ClientConfiguration {
   346    VideoConfiguration video = 1;
   347    VideoConfiguration screen = 2;
   348  
   349    ClientConfigSetting resume_connection = 3;
   350    DisabledCodecs disabled_codecs = 4;
   351    ClientConfigSetting force_relay = 5;
   352  }
   353  
   354  enum ClientConfigSetting {
   355    UNSET = 0;
   356    DISABLED = 1;
   357    ENABLED = 2;
   358  }
   359  
   360  message VideoConfiguration {
   361    ClientConfigSetting hardware_encoder = 1;
   362  }
   363  
   364  message DisabledCodecs {
   365    // disabled for both publish and subscribe
   366    repeated Codec codecs = 1;
   367    // only disable for publish
   368    repeated Codec publish = 2;
   369  }
   370  
   371  enum DisconnectReason {
   372    UNKNOWN_REASON = 0;
   373    CLIENT_INITIATED = 1;
   374    DUPLICATE_IDENTITY = 2;
   375    SERVER_SHUTDOWN = 3;
   376    PARTICIPANT_REMOVED = 4;
   377    ROOM_DELETED = 5;
   378    STATE_MISMATCH = 6;
   379    JOIN_FAILURE = 7;
   380    MIGRATION = 8;
   381    SIGNAL_CLOSE = 9;
   382  }
   383  
   384  message RTPDrift {
   385    google.protobuf.Timestamp start_time = 1;
   386    google.protobuf.Timestamp end_time = 2;
   387    double duration = 3;
   388  
   389    uint64 start_timestamp = 4;
   390    uint64 end_timestamp = 5;
   391    uint64 rtp_clock_ticks = 6;
   392    int64 drift_samples = 7;
   393    double drift_ms = 8;
   394    double clock_rate = 9;
   395  }
   396  
   397  message RTPStats {
   398    google.protobuf.Timestamp start_time = 1;
   399    google.protobuf.Timestamp end_time = 2;
   400    double duration = 3;
   401  
   402    uint32 packets = 4;
   403    double packet_rate = 5;
   404  
   405    uint64 bytes = 6;
   406    uint64 header_bytes = 39;
   407    double bitrate = 7;
   408  
   409    uint32 packets_lost = 8;
   410    double packet_loss_rate = 9;
   411    float packet_loss_percentage = 10;
   412  
   413    uint32 packets_duplicate = 11;
   414    double packet_duplicate_rate = 12;
   415  
   416    uint64 bytes_duplicate = 13;
   417    uint64 header_bytes_duplicate = 40;
   418    double bitrate_duplicate = 14;
   419  
   420    uint32 packets_padding = 15;
   421    double packet_padding_rate = 16;
   422  
   423    uint64 bytes_padding = 17;
   424    uint64 header_bytes_padding = 41;
   425    double bitrate_padding = 18;
   426  
   427    uint32 packets_out_of_order = 19;
   428  
   429    uint32 frames = 20;
   430    double frame_rate = 21;
   431  
   432    double jitter_current = 22;
   433    double jitter_max = 23;
   434  
   435    map<int32, uint32> gap_histogram = 24;
   436  
   437    uint32 nacks = 25;
   438    uint32 nack_acks = 37;
   439    uint32 nack_misses = 26;
   440    uint32 nack_repeated = 38;
   441  
   442    uint32 plis = 27;
   443    google.protobuf.Timestamp last_pli = 28;
   444  
   445    uint32 firs = 29;
   446    google.protobuf.Timestamp last_fir = 30;
   447  
   448    uint32 rtt_current = 31;
   449    uint32 rtt_max = 32;
   450  
   451    uint32 key_frames = 33;
   452    google.protobuf.Timestamp last_key_frame = 34;
   453  
   454    uint32 layer_lock_plis = 35;
   455    google.protobuf.Timestamp last_layer_lock_pli = 36;
   456  
   457    RTPDrift packet_drift = 44;
   458    RTPDrift report_drift = 45;
   459    RTPDrift rebased_report_drift = 46;
   460    // NEXT_ID: 47
   461  }
   462  
   463  message TimedVersion {
   464    int64 unix_micro = 1;
   465    int32 ticks = 2;
   466  }
   467  
   468  enum ReconnectReason {
   469    RR_UNKNOWN = 0;
   470    RR_SIGNAL_DISCONNECTED = 1;
   471    RR_PUBLISHER_FAILED = 2;
   472    RR_SUBSCRIBER_FAILED = 3;
   473    RR_SWITCH_CANDIDATE = 4;
   474  }
   475  
   476  enum SubscriptionError {
   477    SE_UNKNOWN = 0;
   478    SE_CODEC_UNSUPPORTED = 1;
   479    SE_TRACK_NOTFOUND = 2;
   480  }
   481  
   482  enum AudioTrackFeature {
   483    TF_STEREO = 0;
   484    TF_NO_DTX = 1;
   485    TF_AUTO_GAIN_CONTROL = 2;
   486    TF_ECHO_CANCELLATION = 3;
   487    TF_NOISE_SUPPRESSION = 4;
   488    TF_ENHANCED_NOISE_CANCELLATION = 5;
   489  }
   490