github.com/livekit/protocol@v1.39.3/protobufs/livekit_rtc.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 "livekit_models.proto";
    23  
    24  message SignalRequest {
    25    oneof message {
    26      // initial join exchange, for publisher
    27      SessionDescription offer = 1;
    28      // participant answering publisher offer
    29      SessionDescription answer = 2;
    30      TrickleRequest trickle = 3;
    31      AddTrackRequest add_track = 4;
    32      // mute the participant's published tracks
    33      MuteTrackRequest mute = 5;
    34      // Subscribe or unsubscribe from tracks
    35      UpdateSubscription subscription = 6;
    36      // Update settings of subscribed tracks
    37      UpdateTrackSettings track_setting = 7;
    38      // Immediately terminate session
    39      LeaveRequest leave = 8;
    40      // Update published video layers
    41      UpdateVideoLayers update_layers = 10 [deprecated = true];
    42      // Update subscriber permissions
    43      SubscriptionPermission subscription_permission = 11;
    44      // sync client's subscribe state to server during reconnect
    45      SyncState sync_state = 12;
    46      // Simulate conditions, for client validations
    47      SimulateScenario simulate = 13;
    48      // client triggered ping to server
    49      int64 ping = 14; // deprecated by ping_req (message Ping)
    50      // update a participant's own metadata, name, or attributes
    51      // requires canUpdateOwnParticipantMetadata permission
    52      UpdateParticipantMetadata update_metadata = 15;
    53      Ping ping_req = 16;
    54      // Update local audio track settings
    55      UpdateLocalAudioTrack update_audio_track = 17;
    56      // Update local video track settings
    57      UpdateLocalVideoTrack update_video_track = 18;
    58    }
    59  }
    60  
    61  message SignalResponse {
    62    oneof message {
    63      // sent when join is accepted
    64      JoinResponse join = 1;
    65      // sent when server answers publisher
    66      SessionDescription answer = 2;
    67      // sent when server is sending subscriber an offer
    68      SessionDescription offer = 3;
    69      // sent when an ICE candidate is available
    70      TrickleRequest trickle = 4;
    71      // sent when participants in the room has changed
    72      ParticipantUpdate update = 5;
    73      // sent to the participant when their track has been published
    74      TrackPublishedResponse track_published = 6;
    75      // Immediately terminate session
    76      LeaveRequest leave = 8;
    77      // server initiated mute
    78      MuteTrackRequest mute = 9;
    79      // indicates changes to speaker status, including when they've gone to not speaking
    80      SpeakersChanged speakers_changed = 10;
    81      // sent when metadata of the room has changed
    82      RoomUpdate room_update = 11;
    83      // when connection quality changed
    84      ConnectionQualityUpdate connection_quality = 12;
    85      // when streamed tracks state changed, used to notify when any of the streams were paused due to
    86      // congestion
    87      StreamStateUpdate stream_state_update = 13;
    88      // when max subscribe quality changed, used by dynamic broadcasting to disable unused layers
    89      SubscribedQualityUpdate subscribed_quality_update = 14;
    90      // when subscription permission changed
    91      SubscriptionPermissionUpdate subscription_permission_update = 15;
    92      // update the token the client was using, to prevent an active client from using an expired token
    93      string refresh_token = 16;
    94      // server initiated track unpublish
    95      TrackUnpublishedResponse track_unpublished = 17;
    96      // respond to ping
    97      int64 pong = 18; // deprecated by pong_resp (message Pong)
    98      // sent when client reconnects
    99      ReconnectResponse reconnect = 19;
   100      // respond to Ping
   101      Pong pong_resp = 20;
   102      // Subscription response, client should not expect any media from this subscription if it fails
   103      SubscriptionResponse subscription_response = 21;
   104      // Response relating to user inititated requests that carry a `request_id`
   105      RequestResponse request_response = 22;
   106      // notify to the publisher when a published track has been subscribed for the first time
   107      TrackSubscribed track_subscribed = 23;
   108      // notify to the participant when they have been moved to a new room
   109      RoomMovedResponse room_moved = 24;
   110    }
   111  }
   112  
   113  enum SignalTarget {
   114    PUBLISHER = 0;
   115    SUBSCRIBER = 1;
   116  }
   117  
   118  message SimulcastCodec {
   119    string codec = 1;
   120    string cid = 2;
   121  
   122    // NEXT-ID: 4
   123  }
   124  
   125  message AddTrackRequest {
   126    // client ID of track, to match it when RTC track is received
   127    string cid = 1;
   128    string name = 2;
   129    TrackType type = 3;
   130    // to be deprecated in favor of layers
   131    uint32 width = 4;
   132    uint32 height = 5;
   133    // true to add track and initialize to muted
   134    bool muted = 6;
   135    // true if DTX (Discontinuous Transmission) is disabled for audio
   136    bool disable_dtx = 7 [deprecated = true]; // deprecated in favor of audio_features
   137    TrackSource source = 8;
   138    repeated VideoLayer layers = 9;
   139  
   140    repeated SimulcastCodec simulcast_codecs = 10;
   141  
   142    // server ID of track, publish new codec to exist track
   143    string sid = 11;
   144  
   145    bool stereo = 12 [deprecated = true]; // deprecated in favor of audio_features
   146    // true if RED (Redundant Encoding) is disabled for audio
   147    bool disable_red = 13;
   148  
   149    Encryption.Type encryption = 14;
   150    // which stream the track belongs to, used to group tracks together.
   151    // if not specified, server will infer it from track source to bundle camera/microphone, screenshare/audio together
   152    string stream = 15;
   153    BackupCodecPolicy backup_codec_policy = 16;
   154  
   155    repeated AudioTrackFeature audio_features = 17;
   156  }
   157  
   158  message TrickleRequest {
   159    string candidateInit = 1;
   160    SignalTarget target = 2;
   161    bool final = 3;
   162  }
   163  
   164  message MuteTrackRequest {
   165    string sid = 1;
   166    bool muted = 2;
   167  }
   168  
   169  message JoinResponse {
   170    Room room = 1;
   171    ParticipantInfo participant = 2;
   172    repeated ParticipantInfo other_participants = 3;
   173    // deprecated. use server_info.version instead.
   174    string server_version = 4;
   175    repeated ICEServer ice_servers = 5;
   176    // use subscriber as the primary PeerConnection
   177    bool subscriber_primary = 6;
   178    // when the current server isn't available, return alternate url to retry connection
   179    // when this is set, the other fields will be largely empty
   180    string alternative_url = 7;
   181    ClientConfiguration client_configuration = 8;
   182    // deprecated. use server_info.region instead.
   183    string server_region = 9;
   184    int32 ping_timeout = 10;
   185    int32 ping_interval = 11;
   186    ServerInfo server_info = 12;
   187    // Server-Injected-Frame byte trailer, used to identify unencrypted frames when e2ee is enabled
   188    bytes sif_trailer = 13;
   189    repeated Codec enabled_publish_codecs = 14;
   190    // when set, client should attempt to establish publish peer connection when joining room to speed up publishing
   191    bool fast_publish = 15;
   192  }
   193  
   194  message ReconnectResponse {
   195    repeated ICEServer ice_servers = 1;
   196    ClientConfiguration client_configuration = 2;
   197    ServerInfo server_info = 3;
   198  
   199    // last sequence number of reliable message received before resuming
   200    uint32 last_message_seq = 4;
   201  }
   202  
   203  message TrackPublishedResponse {
   204    string cid = 1;
   205    TrackInfo track = 2;
   206  }
   207  
   208  message TrackUnpublishedResponse {
   209    string track_sid = 1;
   210  }
   211  
   212  message SessionDescription {
   213    string type = 1; // "answer" | "offer" | "pranswer" | "rollback"
   214    string sdp = 2;
   215    uint32 id = 3;
   216  }
   217  
   218  message ParticipantUpdate {
   219    repeated ParticipantInfo participants = 1;
   220  }
   221  
   222  message UpdateSubscription {
   223    repeated string track_sids = 1;
   224    bool subscribe = 2;
   225    repeated ParticipantTracks participant_tracks = 3;
   226  }
   227  
   228  message UpdateTrackSettings {
   229    repeated string track_sids = 1;
   230    // when true, the track is placed in a paused state, with no new data returned
   231    bool disabled = 3;
   232    // deprecated in favor of width & height
   233    VideoQuality quality = 4;
   234    // for video, width to receive
   235    uint32 width = 5;
   236    // for video, height to receive
   237    uint32 height = 6;
   238    uint32 fps = 7;
   239    // subscription priority. 1 being the highest (0 is unset)
   240    // when unset, server sill assign priority based on the order of subscription
   241    // server will use priority in the following ways:
   242    // 1. when subscribed tracks exceed per-participant subscription limit, server will
   243    //    pause the lowest priority tracks
   244    // 2. when the network is congested, server will assign available bandwidth to
   245    //    higher priority tracks first. lowest priority tracks can be paused
   246    uint32 priority = 8;
   247  }
   248  
   249  
   250  
   251  message UpdateLocalAudioTrack {
   252    string track_sid = 1;
   253    repeated AudioTrackFeature features = 2;
   254  }
   255  
   256  message UpdateLocalVideoTrack {
   257    string track_sid = 1;
   258    uint32 width = 2;
   259    uint32 height = 3;
   260  }
   261  
   262  message LeaveRequest {
   263    // indicates action clients should take on receiving this message
   264    enum Action {
   265      DISCONNECT = 0;  // should disconnect
   266      RESUME = 1;      // should attempt a resume with `reconnect=1` in join URL
   267      RECONNECT = 2;   // should attempt a reconnect, i. e. no `reconnect=1`
   268    }
   269  
   270    // sent when server initiates the disconnect due to server-restart
   271    // indicates clients should attempt full-reconnect sequence
   272    // NOTE: `can_reconnect` obsoleted by `action` starting in protocol version 13
   273    bool can_reconnect = 1;
   274    DisconnectReason reason = 2;
   275    Action action = 3;
   276    RegionSettings regions = 4;
   277  }
   278  
   279  // message to indicate published video track dimensions are changing
   280  message UpdateVideoLayers {
   281    option deprecated = true;
   282    string track_sid = 1;
   283    repeated VideoLayer layers = 2;
   284  }
   285  
   286  message UpdateParticipantMetadata {
   287    string metadata = 1;
   288    string name = 2;
   289    // attributes to update. it only updates attributes that have been set
   290    // to delete attributes, set the value to an empty string
   291    map<string, string> attributes = 3;
   292    uint32 request_id = 4;
   293  }
   294  
   295  message ICEServer {
   296    repeated string urls = 1;
   297    string username = 2;
   298    string credential = 3;
   299  }
   300  
   301  message SpeakersChanged {
   302    repeated SpeakerInfo speakers = 1;
   303  }
   304  
   305  message RoomUpdate {
   306    Room room = 1;
   307  }
   308  
   309  message ConnectionQualityInfo {
   310    string participant_sid = 1;
   311    ConnectionQuality quality = 2;
   312    float score = 3;
   313  }
   314  
   315  message ConnectionQualityUpdate {
   316    repeated ConnectionQualityInfo updates = 1;
   317  }
   318  
   319  enum StreamState {
   320    ACTIVE = 0;
   321    PAUSED = 1;
   322  }
   323  
   324  message StreamStateInfo {
   325    string participant_sid = 1;
   326    string track_sid = 2;
   327    StreamState state = 3;
   328  }
   329  
   330  message StreamStateUpdate {
   331    repeated StreamStateInfo stream_states = 1;
   332  }
   333  
   334  message SubscribedQuality {
   335    VideoQuality quality = 1;
   336    bool enabled = 2;
   337  }
   338  
   339  message SubscribedCodec {
   340    string codec = 1;
   341    repeated SubscribedQuality qualities = 2;
   342  }
   343  
   344  message SubscribedQualityUpdate {
   345    string track_sid = 1;
   346    repeated SubscribedQuality subscribed_qualities = 2 [deprecated = true];
   347    repeated SubscribedCodec subscribed_codecs = 3;
   348  }
   349  
   350  message TrackPermission {
   351    // permission could be granted either by participant sid or identity
   352    string participant_sid = 1;
   353    bool all_tracks = 2;
   354    repeated string track_sids = 3;
   355    string participant_identity = 4;
   356  }
   357  
   358  message SubscriptionPermission {
   359    bool all_participants = 1;
   360    repeated TrackPermission track_permissions = 2;
   361  }
   362  
   363  message SubscriptionPermissionUpdate {
   364    string participant_sid = 1;
   365    string track_sid = 2;
   366    bool allowed = 3;
   367  }
   368  
   369  message RoomMovedResponse {
   370    // information about the new room
   371    Room room = 1;
   372    // new reconnect token that can be used to reconnect to the new room
   373    string token = 2;
   374    ParticipantInfo participant = 3;
   375    repeated ParticipantInfo other_participants = 4;
   376  }
   377  
   378  message SyncState {
   379    // last subscribe answer before reconnecting
   380    SessionDescription answer = 1;
   381    UpdateSubscription subscription = 2;
   382    repeated TrackPublishedResponse publish_tracks = 3;
   383    repeated DataChannelInfo data_channels = 4;
   384    // last received server side offer before reconnecting
   385    SessionDescription offer = 5;
   386    repeated string track_sids_disabled = 6;
   387    repeated DataChannelReceiveState datachannel_receive_states = 7;
   388  }
   389  
   390  message DataChannelReceiveState {
   391    string publisher_sid = 1;
   392    uint32 last_seq = 2;
   393  }
   394  
   395  message DataChannelInfo {
   396    string label = 1;
   397    uint32 id = 2;
   398    SignalTarget target = 3;
   399  }
   400  
   401  enum CandidateProtocol {
   402    UDP = 0;
   403    TCP = 1;
   404    TLS = 2;
   405  }
   406  
   407  message SimulateScenario {
   408    oneof scenario {
   409      // simulate N seconds of speaker activity
   410      int32 speaker_update = 1;
   411      // simulate local node failure
   412      bool node_failure = 2;
   413      // simulate migration
   414      bool migration = 3;
   415      // server to send leave
   416      bool server_leave = 4;
   417      // switch candidate protocol to tcp
   418      CandidateProtocol switch_candidate_protocol = 5;
   419      // maximum bandwidth for subscribers, in bps
   420      // when zero, clears artificial bandwidth limit
   421      int64 subscriber_bandwidth = 6;
   422      // disconnect signal on resume
   423      bool disconnect_signal_on_resume = 7;
   424      // disconnect signal on resume before sending any messages from server
   425      bool disconnect_signal_on_resume_no_messages = 8;
   426      // full reconnect leave request
   427      bool leave_request_full_reconnect = 9;
   428    }
   429  }
   430  
   431  message Ping {
   432    int64 timestamp = 1;
   433    // rtt in milliseconds calculated by client
   434    int64 rtt = 2;
   435  }
   436  
   437  message Pong {
   438    // timestamp field of last received ping request
   439    int64 last_ping_timestamp = 1;
   440    int64 timestamp = 2;
   441  }
   442  
   443  message RegionSettings {
   444    repeated RegionInfo regions = 1;
   445  }
   446  
   447  message RegionInfo {
   448    string region = 1;
   449    string url = 2;
   450    int64 distance = 3;
   451  }
   452  
   453  message SubscriptionResponse {
   454    string track_sid = 1;
   455    SubscriptionError err = 2;
   456  }
   457  
   458  message RequestResponse {
   459    enum Reason {
   460      OK = 0;
   461      NOT_FOUND = 1;
   462      NOT_ALLOWED = 2;
   463      LIMIT_EXCEEDED = 3;
   464    }
   465  
   466    uint32 request_id = 1;
   467    Reason reason = 2;
   468    string message = 3;
   469  }
   470  
   471  message TrackSubscribed {
   472    string track_sid = 1;
   473  }