github.com/livekit/protocol@v1.5.7/livekit_rtc.proto (about)

     1  syntax = "proto3";
     2  
     3  package livekit;
     4  option go_package = "github.com/livekit/protocol/livekit";
     5  option csharp_namespace = "LiveKit.Proto";
     6  option ruby_package = "LiveKit::Proto";
     7  
     8  import "livekit_models.proto";
     9  
    10  message SignalRequest {
    11    oneof message {
    12      // initial join exchange, for publisher
    13      SessionDescription offer = 1;
    14      // participant answering publisher offer
    15      SessionDescription answer = 2;
    16      TrickleRequest trickle = 3;
    17      AddTrackRequest add_track = 4;
    18      // mute the participant's published tracks
    19      MuteTrackRequest mute = 5;
    20      // Subscribe or unsubscribe from tracks
    21      UpdateSubscription subscription = 6;
    22      // Update settings of subscribed tracks
    23      UpdateTrackSettings track_setting = 7;
    24      // Immediately terminate session
    25      LeaveRequest leave = 8;
    26      // Update published video layers
    27      UpdateVideoLayers update_layers = 10;
    28      // Update subscriber permissions
    29      SubscriptionPermission subscription_permission = 11;
    30      // sync client's subscribe state to server during reconnect
    31      SyncState sync_state = 12;
    32      // Simulate conditions, for client validations
    33      SimulateScenario simulate = 13;
    34      // client triggered ping to server
    35      int64 ping = 14; // deprecated by ping_req (message Ping)
    36      // update a participant's own metadata and/or name
    37      UpdateParticipantMetadata update_metadata = 15;
    38      Ping ping_req = 16;
    39    }
    40  }
    41  
    42  message SignalResponse {
    43    oneof message {
    44      // sent when join is accepted
    45      JoinResponse join = 1;
    46      // sent when server answers publisher
    47      SessionDescription answer = 2;
    48      // sent when server is sending subscriber an offer
    49      SessionDescription offer = 3;
    50      // sent when an ICE candidate is available
    51      TrickleRequest trickle = 4;
    52      // sent when participants in the room has changed
    53      ParticipantUpdate update = 5;
    54      // sent to the participant when their track has been published
    55      TrackPublishedResponse track_published = 6;
    56      // Immediately terminate session
    57      LeaveRequest leave = 8;
    58      // server initiated mute
    59      MuteTrackRequest mute = 9;
    60      // indicates changes to speaker status, including when they've gone to not speaking
    61      SpeakersChanged speakers_changed = 10;
    62      // sent when metadata of the room has changed
    63      RoomUpdate room_update = 11;
    64      // when connection quality changed
    65      ConnectionQualityUpdate connection_quality = 12;
    66      // when streamed tracks state changed, used to notify when any of the streams were paused due to
    67      // congestion
    68      StreamStateUpdate stream_state_update = 13;
    69      // when max subscribe quality changed, used by dynamic broadcasting to disable unused layers
    70      SubscribedQualityUpdate subscribed_quality_update = 14;
    71      // when subscription permission changed
    72      SubscriptionPermissionUpdate subscription_permission_update = 15;
    73      // update the token the client was using, to prevent an active client from using an expired token
    74      string refresh_token = 16;
    75      // server initiated track unpublish
    76      TrackUnpublishedResponse track_unpublished = 17;
    77      // respond to ping
    78      int64 pong = 18; // deprecated by pong_resp (message Pong)
    79      // sent when client reconnects
    80      ReconnectResponse reconnect = 19;
    81      // respond to Ping
    82      Pong pong_resp = 20;
    83    }
    84  }
    85  
    86  enum SignalTarget {
    87    PUBLISHER = 0;
    88    SUBSCRIBER = 1;
    89  }
    90  
    91  message SimulcastCodec {
    92    string codec = 1;
    93    string cid = 2;
    94    bool enable_simulcast_layers = 3;
    95  }
    96  
    97  message AddTrackRequest {
    98    // client ID of track, to match it when RTC track is received
    99    string cid = 1;
   100    string name = 2;
   101    TrackType type = 3;
   102    // to be deprecated in favor of layers
   103    uint32 width = 4;
   104    uint32 height = 5;
   105    // true to add track and initialize to muted
   106    bool muted = 6;
   107    // true if DTX (Discontinuous Transmission) is disabled for audio
   108    bool disable_dtx = 7;
   109    TrackSource source = 8;
   110    repeated VideoLayer layers = 9;
   111  
   112    repeated SimulcastCodec simulcast_codecs = 10;
   113  
   114    // server ID of track, publish new codec to exist track
   115    string sid = 11;
   116  
   117    bool stereo = 12;
   118    // true if RED (Redundant Encoding) is disabled for audio
   119    bool disable_red = 13;
   120  
   121    Encryption.Type encryption = 14;
   122  }
   123  
   124  message TrickleRequest {
   125    string candidateInit = 1;
   126    SignalTarget target = 2;
   127  }
   128  
   129  message MuteTrackRequest {
   130    string sid = 1;
   131    bool muted = 2;
   132  }
   133  
   134  message JoinResponse {
   135    Room room = 1;
   136    ParticipantInfo participant = 2;
   137    repeated ParticipantInfo other_participants = 3;
   138    // deprecated. use server_info.version instead.
   139    string server_version = 4;
   140    repeated ICEServer ice_servers = 5;
   141    // use subscriber as the primary PeerConnection
   142    bool subscriber_primary = 6;
   143    // when the current server isn't available, return alternate url to retry connection
   144    // when this is set, the other fields will be largely empty
   145    string alternative_url = 7;
   146    ClientConfiguration client_configuration = 8;
   147    // deprecated. use server_info.region instead.
   148    string server_region = 9;
   149    int32 ping_timeout = 10;
   150    int32 ping_interval = 11;
   151    ServerInfo server_info = 12;
   152    // Server-Injected-Frame byte trailer, used to identify unencrypted frames when e2ee is enabled
   153    bytes sif_trailer = 13;
   154  }
   155  
   156  message ReconnectResponse {
   157    repeated ICEServer ice_servers = 1;
   158    ClientConfiguration client_configuration = 2;
   159  }
   160  
   161  message TrackPublishedResponse {
   162    string cid = 1;
   163    TrackInfo track = 2;
   164  }
   165  
   166  message TrackUnpublishedResponse {
   167    string track_sid = 1;
   168  }
   169  
   170  message SessionDescription {
   171    string type = 1; // "answer" | "offer" | "pranswer" | "rollback"
   172    string sdp = 2;
   173  }
   174  
   175  message ParticipantUpdate {
   176    repeated ParticipantInfo participants = 1;
   177  }
   178  
   179  message UpdateSubscription {
   180    repeated string track_sids = 1;
   181    bool subscribe = 2;
   182    repeated ParticipantTracks participant_tracks = 3;
   183  }
   184  
   185  message UpdateTrackSettings {
   186    repeated string track_sids = 1;
   187    // when true, the track is placed in a paused state, with no new data returned
   188    bool disabled = 3;
   189    // deprecated in favor of width & height
   190    VideoQuality quality = 4;
   191    // for video, width to receive
   192    uint32 width = 5;
   193    // for video, height to receive
   194    uint32 height = 6;
   195    uint32 fps = 7;
   196    // subscription priority. 1 being the highest (0 is unset)
   197    // when unset, server sill assign priority based on the order of subscription
   198    // server will use priority in the following ways:
   199    // 1. when subscribed tracks exceed per-participant subscription limit, server will
   200    //    pause the lowest priority tracks
   201    // 2. when the network is congested, server will assign available bandwidth to
   202    //    higher priority tracks first. lowest priority tracks can be paused
   203    uint32 priority = 8;
   204  }
   205  
   206  message LeaveRequest {
   207    // sent when server initiates the disconnect due to server-restart
   208    // indicates clients should attempt full-reconnect sequence
   209    bool can_reconnect = 1;
   210    DisconnectReason reason = 2;
   211  }
   212  
   213  // message to indicate published video track dimensions are changing
   214  message UpdateVideoLayers {
   215    string track_sid = 1;
   216    repeated VideoLayer layers = 2;
   217  }
   218  
   219  message UpdateParticipantMetadata {
   220    string metadata = 1;
   221    string name = 2;
   222  }
   223  
   224  message ICEServer {
   225    repeated string urls = 1;
   226    string username = 2;
   227    string credential = 3;
   228  }
   229  
   230  message SpeakersChanged {
   231    repeated SpeakerInfo speakers = 1;
   232  }
   233  
   234  message RoomUpdate {
   235    Room room = 1;
   236  }
   237  
   238  message ConnectionQualityInfo {
   239    string participant_sid = 1;
   240    ConnectionQuality quality = 2;
   241    float score = 3;
   242  }
   243  
   244  message ConnectionQualityUpdate {
   245    repeated ConnectionQualityInfo updates = 1;
   246  }
   247  
   248  enum StreamState {
   249    ACTIVE = 0;
   250    PAUSED = 1;
   251  }
   252  
   253  message StreamStateInfo {
   254    string participant_sid = 1;
   255    string track_sid = 2;
   256    StreamState state = 3;
   257  }
   258  
   259  message StreamStateUpdate {
   260    repeated StreamStateInfo stream_states = 1;
   261  }
   262  
   263  message SubscribedQuality {
   264    VideoQuality quality = 1;
   265    bool enabled = 2;
   266  }
   267  
   268  message SubscribedCodec {
   269    string codec = 1;
   270    repeated SubscribedQuality qualities = 2;
   271  }
   272  
   273  message SubscribedQualityUpdate {
   274    string track_sid = 1;
   275    repeated SubscribedQuality subscribed_qualities = 2;
   276    repeated SubscribedCodec subscribed_codecs = 3;
   277  }
   278  
   279  message TrackPermission {
   280    // permission could be granted either by participant sid or identity
   281    string participant_sid = 1;
   282    bool all_tracks = 2;
   283    repeated string track_sids = 3;
   284    string participant_identity = 4;
   285  }
   286  
   287  message SubscriptionPermission {
   288    bool all_participants = 1;
   289    repeated TrackPermission track_permissions = 2;
   290  }
   291  
   292  message SubscriptionPermissionUpdate {
   293    string participant_sid = 1;
   294    string track_sid = 2;
   295    bool allowed = 3;
   296  }
   297  
   298  message SyncState {
   299    // last subscribe answer before reconnecting
   300    SessionDescription answer = 1;
   301    UpdateSubscription subscription = 2;
   302    repeated TrackPublishedResponse publish_tracks = 3;
   303    repeated DataChannelInfo data_channels = 4;
   304    // last received server side offer before reconnecting
   305    SessionDescription offer = 5;
   306  }
   307  
   308  message DataChannelInfo {
   309    string label = 1;
   310    uint32 id = 2;
   311    SignalTarget target = 3;
   312  }
   313  
   314  enum CandidateProtocol {
   315    UDP = 0;
   316    TCP = 1;
   317    TLS = 2;
   318  }
   319  
   320  message SimulateScenario {
   321    oneof scenario {
   322      // simulate N seconds of speaker activity
   323      int32 speaker_update = 1;
   324      // simulate local node failure
   325      bool node_failure = 2;
   326      // simulate migration
   327      bool migration = 3;
   328      // server to send leave
   329      bool server_leave = 4;
   330      // switch candidate protocol to tcp
   331      CandidateProtocol switch_candidate_protocol = 5;
   332      // maximum bandwidth for subscribers, in bps
   333      // when zero, clears artificial bandwidth limit
   334      int64 subscriber_bandwidth = 6;
   335    }
   336  }
   337  
   338  message Ping {
   339    int64 timestamp = 1;
   340    // rtt in milliseconds calculated by client
   341    int64 rtt = 2;
   342  }
   343  
   344  message Pong {
   345    // timestamp field of last received ping request
   346    int64 last_ping_timestamp = 1;
   347    int64 timestamp = 2;
   348  }
   349  
   350  message RegionSettings {
   351    repeated RegionInfo regions = 1;
   352  }
   353  
   354  message RegionInfo {
   355    string region = 1;
   356    string url = 2;
   357    int64 distance = 3;
   358  }