github.com/whoyao/protocol@v0.0.0-20230519045905-2d8ace718ca5/livekit_models.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 "google/protobuf/timestamp.proto";
     9  
    10  message Room {
    11    string sid = 1;
    12    string name = 2;
    13    uint32 empty_timeout = 3;
    14    uint32 max_participants = 4;
    15    int64 creation_time = 5;
    16    string turn_password = 6;
    17    repeated Codec enabled_codecs = 7;
    18    string metadata = 8;
    19    uint32 num_participants = 9;
    20    uint32 num_publishers = 11;
    21    bool active_recording = 10;
    22  
    23    // NEXT-ID: 12
    24  }
    25  
    26  message Codec {
    27    string mime = 1;
    28    string fmtp_line = 2;
    29  }
    30  
    31  enum AudioCodec {
    32    DEFAULT_AC = 0;
    33    OPUS = 1;
    34    AAC = 2;
    35  }
    36  
    37  enum VideoCodec {
    38    DEFAULT_VC = 0;
    39    H264_BASELINE = 1;
    40    H264_MAIN = 2;
    41    H264_HIGH = 3;
    42    VP8 = 4;
    43  }
    44  
    45  message ParticipantPermission {
    46    // allow participant to subscribe to other tracks in the room
    47    bool can_subscribe = 1;
    48    // allow participant to publish new tracks to room
    49    bool can_publish = 2;
    50    // allow participant to publish data
    51    bool can_publish_data = 3;
    52    // sources that are allowed to be published
    53    repeated TrackSource can_publish_sources = 9;
    54    // indicates that it's hidden to others
    55    bool hidden = 7;
    56    // indicates it's a recorder instance
    57    bool recorder = 8;
    58    // indicates that participant can update own metadata
    59    bool can_update_metadata = 10;
    60  
    61    // NEXT_ID: 11
    62  }
    63  
    64  message ParticipantInfo {
    65    enum State {
    66      // websocket' connected, but not offered yet
    67      JOINING = 0;
    68      // server received client offer
    69      JOINED = 1;
    70      // ICE connectivity established
    71      ACTIVE = 2;
    72      // WS disconnected
    73      DISCONNECTED = 3;
    74    }
    75    string sid = 1;
    76    string identity = 2;
    77    State state = 3;
    78    repeated TrackInfo tracks = 4;
    79    string metadata = 5;
    80    // timestamp when participant joined room, in seconds
    81    int64 joined_at = 6;
    82    string name = 9;
    83    uint32 version = 10;
    84    ParticipantPermission permission = 11;
    85    string region = 12;
    86    // indicates the participant has an active publisher connection
    87    // and can publish to the server
    88    bool is_publisher = 13;
    89  }
    90  
    91  enum TrackType {
    92    AUDIO = 0;
    93    VIDEO = 1;
    94    DATA = 2;
    95  }
    96  
    97  enum TrackSource {
    98    UNKNOWN = 0;
    99    CAMERA = 1;
   100    MICROPHONE = 2;
   101    SCREEN_SHARE = 3;
   102    SCREEN_SHARE_AUDIO = 4;
   103  }
   104  
   105  message Encryption {
   106    enum Type {
   107        NONE=0;
   108        GCM=1;
   109        CUSTOM=2;
   110    }
   111  }
   112  
   113  message SimulcastCodecInfo {
   114    string mime_type = 1;
   115    string mid = 2;
   116    string cid = 3;
   117    repeated VideoLayer layers = 4;
   118  }
   119  
   120  message TrackInfo {
   121    string sid = 1;
   122    TrackType type = 2;
   123    string name = 3;
   124    bool muted = 4;
   125    // original width of video (unset for audio)
   126    // clients may receive a lower resolution version with simulcast
   127    uint32 width = 5;
   128    // original height of video (unset for audio)
   129    uint32 height = 6;
   130    // true if track is simulcasted
   131    bool simulcast = 7;
   132    // true if DTX (Discontinuous Transmission) is disabled for audio
   133    bool disable_dtx = 8;
   134    // source of media
   135    TrackSource source = 9;
   136    repeated VideoLayer layers = 10;
   137    // mime type of codec
   138    string mime_type = 11;
   139    string mid = 12;
   140    repeated SimulcastCodecInfo codecs = 13;
   141    bool stereo = 14;
   142    // true if RED (Redundant Encoding) is disabled for audio
   143    bool disable_red = 15;
   144    Encryption.Type encryption = 16;
   145  }
   146  
   147  enum VideoQuality {
   148    LOW = 0;
   149    MEDIUM = 1;
   150    HIGH = 2;
   151    OFF = 3;
   152  }
   153  
   154  // provide information about available spatial layers
   155  message VideoLayer {
   156    // for tracks with a single layer, this should be HIGH
   157    VideoQuality quality = 1;
   158    uint32 width = 2;
   159    uint32 height = 3;
   160    // target bitrate in bit per second (bps), server will measure actual
   161    uint32 bitrate = 4;
   162    uint32 ssrc = 5;
   163  }
   164  
   165  // new DataPacket API
   166  message DataPacket {
   167    enum Kind {
   168      RELIABLE = 0;
   169      LOSSY = 1;
   170    }
   171    Kind kind = 1;
   172    oneof value {
   173      UserPacket user = 2;
   174      ActiveSpeakerUpdate speaker = 3;
   175    }
   176  }
   177  
   178  message ActiveSpeakerUpdate {
   179    repeated SpeakerInfo speakers = 1;
   180  }
   181  
   182  message SpeakerInfo {
   183    string sid = 1;
   184    // audio level, 0-1.0, 1 is loudest
   185    float level = 2;
   186    // true if speaker is currently active
   187    bool active = 3;
   188  }
   189  
   190  message UserPacket {
   191    // participant ID of user that sent the message
   192    string participant_sid = 1;
   193    // user defined payload
   194    bytes payload = 2;
   195    // the ID of the participants who will receive the message (the message will be sent to all the people in the room if this variable is empty)
   196    repeated string destination_sids = 3;
   197    // topic under which the message was published
   198    optional string topic = 4;
   199  }
   200  
   201  enum ConnectionQuality {
   202    POOR = 0;
   203    GOOD = 1;
   204    EXCELLENT = 2;
   205  }
   206  
   207  message ParticipantTracks {
   208    // participant ID of participant to whom the tracks belong
   209    string participant_sid = 1;
   210    repeated string track_sids = 2;
   211  }
   212  
   213  // details about the server
   214  message ServerInfo {
   215    enum Edition {
   216      Standard = 0;
   217      Cloud = 1;
   218    }
   219    Edition edition = 1;
   220    string version = 2;
   221    int32 protocol = 3;
   222    string region = 4;
   223    string node_id = 5;
   224    // additional debugging information. sent only if server is in development mode
   225    string debug_info = 6;
   226  }
   227  
   228  // details about the client
   229  message ClientInfo {
   230    enum SDK {
   231       UNKNOWN = 0;
   232       JS = 1;
   233       SWIFT = 2;
   234       ANDROID = 3;
   235       FLUTTER = 4;
   236       GO = 5;
   237       UNITY = 6;
   238       REACT_NATIVE = 7;
   239       RUST = 8;
   240    }
   241  
   242    SDK sdk = 1;
   243    string version = 2;
   244    int32 protocol = 3;
   245    string os = 4;
   246    string os_version = 5;
   247    string device_model = 6;
   248    string browser = 7;
   249    string browser_version = 8;
   250    string address = 9;
   251    // wifi, wired, cellular, vpn, empty if not known
   252    string network = 10;
   253  }
   254  
   255  // server provided client configuration
   256  message ClientConfiguration {
   257    VideoConfiguration video = 1;
   258    VideoConfiguration screen = 2;
   259  
   260    ClientConfigSetting resume_connection = 3;
   261    DisabledCodecs disabled_codecs = 4;
   262    ClientConfigSetting force_relay = 5;
   263  }
   264  
   265  enum ClientConfigSetting {
   266    UNSET = 0;
   267    DISABLED = 1;
   268    ENABLED = 2;
   269  }
   270  
   271  message VideoConfiguration {
   272    ClientConfigSetting hardware_encoder = 1;
   273  }
   274  
   275  message DisabledCodecs {
   276    repeated Codec codecs = 1;
   277  }
   278  
   279  enum DisconnectReason {
   280    UNKNOWN_REASON = 0;
   281    CLIENT_INITIATED = 1;
   282    DUPLICATE_IDENTITY = 2;
   283    SERVER_SHUTDOWN = 3;
   284    PARTICIPANT_REMOVED = 4;
   285    ROOM_DELETED = 5;
   286    STATE_MISMATCH = 6;
   287    JOIN_FAILURE = 7;
   288  }
   289  
   290  message RTPStats {
   291    google.protobuf.Timestamp start_time = 1;
   292    google.protobuf.Timestamp end_time = 2;
   293    double duration = 3;
   294  
   295    uint32 packets = 4;
   296    double packet_rate = 5;
   297  
   298    uint64 bytes = 6;
   299    uint64 header_bytes = 39;
   300    double bitrate = 7;
   301  
   302    uint32 packets_lost = 8;
   303    double packet_loss_rate = 9;
   304    float packet_loss_percentage = 10;
   305  
   306    uint32 packets_duplicate = 11;
   307    double packet_duplicate_rate = 12;
   308  
   309    uint64 bytes_duplicate = 13;
   310    uint64 header_bytes_duplicate = 40;
   311    double bitrate_duplicate = 14;
   312  
   313    uint32 packets_padding = 15;
   314    double packet_padding_rate = 16;
   315  
   316    uint64 bytes_padding = 17;
   317    uint64 header_bytes_padding = 41;
   318    double bitrate_padding = 18;
   319  
   320    uint32 packets_out_of_order = 19;
   321  
   322    uint32 frames = 20;
   323    double frame_rate = 21;
   324  
   325    double jitter_current = 22;
   326    double jitter_max = 23;
   327  
   328    map<int32, uint32> gap_histogram = 24;
   329  
   330    uint32 nacks = 25;
   331    uint32 nack_acks = 37;
   332    uint32 nack_misses = 26;
   333    uint32 nack_repeated = 38;
   334  
   335    uint32 plis = 27;
   336    google.protobuf.Timestamp last_pli = 28;
   337  
   338    uint32 firs = 29;
   339    google.protobuf.Timestamp last_fir = 30;
   340  
   341    uint32 rtt_current = 31;
   342    uint32 rtt_max = 32;
   343  
   344    uint32 key_frames = 33;
   345    google.protobuf.Timestamp last_key_frame = 34;
   346  
   347    uint32 layer_lock_plis = 35;
   348    google.protobuf.Timestamp last_layer_lock_pli = 36;
   349  
   350    double sample_rate = 42;
   351    double drift_ms = 43;
   352    // NEXT_ID: 44
   353  }
   354  
   355  message TimedVersion {
   356    int64 unix_micro = 1;
   357    int32 ticks = 2;
   358  }
   359  
   360  enum ReconnectReason {
   361    RR_UNKOWN = 0;
   362    RR_SIGNAL_DISCONNECTED = 1;
   363    RR_PUBLISHER_FAILED = 2;
   364    RR_SUBSCRIBER_FAILED = 3;
   365    RR_SWITCH_CANDIDATE = 4;
   366  }