using shared proto types for participant state
This commit is contained in:
+109
-33
@@ -25,6 +25,62 @@ const (
|
||||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
type ParticipantInfo_State int32
|
||||
|
||||
const (
|
||||
// websocket connected, but not offered yet
|
||||
ParticipantInfo_JOINING ParticipantInfo_State = 0
|
||||
// server received client offer
|
||||
ParticipantInfo_JOINED ParticipantInfo_State = 1
|
||||
// ICE connectivity established
|
||||
ParticipantInfo_ACTIVE ParticipantInfo_State = 2
|
||||
// WS disconnected
|
||||
ParticipantInfo_DISCONNECTED ParticipantInfo_State = 3
|
||||
)
|
||||
|
||||
// Enum value maps for ParticipantInfo_State.
|
||||
var (
|
||||
ParticipantInfo_State_name = map[int32]string{
|
||||
0: "JOINING",
|
||||
1: "JOINED",
|
||||
2: "ACTIVE",
|
||||
3: "DISCONNECTED",
|
||||
}
|
||||
ParticipantInfo_State_value = map[string]int32{
|
||||
"JOINING": 0,
|
||||
"JOINED": 1,
|
||||
"ACTIVE": 2,
|
||||
"DISCONNECTED": 3,
|
||||
}
|
||||
)
|
||||
|
||||
func (x ParticipantInfo_State) Enum() *ParticipantInfo_State {
|
||||
p := new(ParticipantInfo_State)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x ParticipantInfo_State) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (ParticipantInfo_State) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_model_proto_enumTypes[0].Descriptor()
|
||||
}
|
||||
|
||||
func (ParticipantInfo_State) Type() protoreflect.EnumType {
|
||||
return &file_model_proto_enumTypes[0]
|
||||
}
|
||||
|
||||
func (x ParticipantInfo_State) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ParticipantInfo_State.Descriptor instead.
|
||||
func (ParticipantInfo_State) EnumDescriptor() ([]byte, []int) {
|
||||
return file_model_proto_rawDescGZIP(), []int{4, 0}
|
||||
}
|
||||
|
||||
type Node struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@@ -151,6 +207,7 @@ func (x *NodeStats) GetNumClients() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
// internal type, for serialization with proto
|
||||
type Room struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@@ -306,10 +363,11 @@ type ParticipantInfo struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||
HasAudio bool `protobuf:"varint,3,opt,name=has_audio,json=hasAudio,proto3" json:"has_audio,omitempty"`
|
||||
HasVideo bool `protobuf:"varint,4,opt,name=has_video,json=hasVideo,proto3" json:"has_video,omitempty"`
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||
State ParticipantInfo_State `protobuf:"varint,3,opt,name=state,proto3,enum=livekit.ParticipantInfo_State" json:"state,omitempty"`
|
||||
HasAudio bool `protobuf:"varint,4,opt,name=has_audio,json=hasAudio,proto3" json:"has_audio,omitempty"`
|
||||
HasVideo bool `protobuf:"varint,5,opt,name=has_video,json=hasVideo,proto3" json:"has_video,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ParticipantInfo) Reset() {
|
||||
@@ -358,6 +416,13 @@ func (x *ParticipantInfo) GetName() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ParticipantInfo) GetState() ParticipantInfo_State {
|
||||
if x != nil {
|
||||
return x.State
|
||||
}
|
||||
return ParticipantInfo_JOINING
|
||||
}
|
||||
|
||||
func (x *ParticipantInfo) GetHasAudio() bool {
|
||||
if x != nil {
|
||||
return x.HasAudio
|
||||
@@ -460,22 +525,29 @@ var file_model_proto_rawDesc = []byte{
|
||||
0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c,
|
||||
0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05,
|
||||
0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b,
|
||||
0x65, 0x6e, 0x22, 0x6f, 0x0a, 0x0f, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e,
|
||||
0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x68, 0x61, 0x73,
|
||||
0x5f, 0x61, 0x75, 0x64, 0x69, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x68, 0x61,
|
||||
0x73, 0x41, 0x75, 0x64, 0x69, 0x6f, 0x12, 0x1b, 0x0a, 0x09, 0x68, 0x61, 0x73, 0x5f, 0x76, 0x69,
|
||||
0x64, 0x65, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x68, 0x61, 0x73, 0x56, 0x69,
|
||||
0x64, 0x65, 0x6f, 0x22, 0x46, 0x0a, 0x0b, 0x44, 0x61, 0x74, 0x61, 0x43, 0x68, 0x61, 0x6e, 0x6e,
|
||||
0x65, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49,
|
||||
0x64, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x42, 0x31, 0x5a, 0x2f, 0x67,
|
||||
0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69,
|
||||
0x74, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
|
||||
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x65, 0x6e, 0x22, 0xe5, 0x01, 0x0a, 0x0f, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61,
|
||||
0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x34, 0x0a, 0x05, 0x73, 0x74,
|
||||
0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1e, 0x2e, 0x6c, 0x69, 0x76, 0x65,
|
||||
0x6b, 0x69, 0x74, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49,
|
||||
0x6e, 0x66, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65,
|
||||
0x12, 0x1b, 0x0a, 0x09, 0x68, 0x61, 0x73, 0x5f, 0x61, 0x75, 0x64, 0x69, 0x6f, 0x18, 0x04, 0x20,
|
||||
0x01, 0x28, 0x08, 0x52, 0x08, 0x68, 0x61, 0x73, 0x41, 0x75, 0x64, 0x69, 0x6f, 0x12, 0x1b, 0x0a,
|
||||
0x09, 0x68, 0x61, 0x73, 0x5f, 0x76, 0x69, 0x64, 0x65, 0x6f, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08,
|
||||
0x52, 0x08, 0x68, 0x61, 0x73, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x22, 0x3e, 0x0a, 0x05, 0x53, 0x74,
|
||||
0x61, 0x74, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x4a, 0x4f, 0x49, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x00,
|
||||
0x12, 0x0a, 0x0a, 0x06, 0x4a, 0x4f, 0x49, 0x4e, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06,
|
||||
0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x10, 0x02, 0x12, 0x10, 0x0a, 0x0c, 0x44, 0x49, 0x53, 0x43,
|
||||
0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, 0x45, 0x44, 0x10, 0x03, 0x22, 0x46, 0x0a, 0x0b, 0x44, 0x61,
|
||||
0x74, 0x61, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x73,
|
||||
0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73,
|
||||
0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c,
|
||||
0x6f, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f,
|
||||
0x61, 0x64, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d,
|
||||
0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74,
|
||||
0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6c, 0x69,
|
||||
0x76, 0x65, 0x6b, 0x69, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -490,22 +562,25 @@ func file_model_proto_rawDescGZIP() []byte {
|
||||
return file_model_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_model_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_model_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
|
||||
var file_model_proto_goTypes = []interface{}{
|
||||
(*Node)(nil), // 0: livekit.Node
|
||||
(*NodeStats)(nil), // 1: livekit.NodeStats
|
||||
(*Room)(nil), // 2: livekit.Room
|
||||
(*RoomInfo)(nil), // 3: livekit.RoomInfo
|
||||
(*ParticipantInfo)(nil), // 4: livekit.ParticipantInfo
|
||||
(*DataChannel)(nil), // 5: livekit.DataChannel
|
||||
(ParticipantInfo_State)(0), // 0: livekit.ParticipantInfo.State
|
||||
(*Node)(nil), // 1: livekit.Node
|
||||
(*NodeStats)(nil), // 2: livekit.NodeStats
|
||||
(*Room)(nil), // 3: livekit.Room
|
||||
(*RoomInfo)(nil), // 4: livekit.RoomInfo
|
||||
(*ParticipantInfo)(nil), // 5: livekit.ParticipantInfo
|
||||
(*DataChannel)(nil), // 6: livekit.DataChannel
|
||||
}
|
||||
var file_model_proto_depIdxs = []int32{
|
||||
1, // 0: livekit.Node.stats:type_name -> livekit.NodeStats
|
||||
1, // [1:1] is the sub-list for method output_type
|
||||
1, // [1:1] is the sub-list for method input_type
|
||||
1, // [1:1] is the sub-list for extension type_name
|
||||
1, // [1:1] is the sub-list for extension extendee
|
||||
0, // [0:1] is the sub-list for field type_name
|
||||
2, // 0: livekit.Node.stats:type_name -> livekit.NodeStats
|
||||
0, // 1: livekit.ParticipantInfo.state:type_name -> livekit.ParticipantInfo.State
|
||||
2, // [2:2] is the sub-list for method output_type
|
||||
2, // [2:2] is the sub-list for method input_type
|
||||
2, // [2:2] is the sub-list for extension type_name
|
||||
2, // [2:2] is the sub-list for extension extendee
|
||||
0, // [0:2] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_model_proto_init() }
|
||||
@@ -592,13 +667,14 @@ func file_model_proto_init() {
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_model_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumEnums: 1,
|
||||
NumMessages: 6,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_model_proto_goTypes,
|
||||
DependencyIndexes: file_model_proto_depIdxs,
|
||||
EnumInfos: file_model_proto_enumTypes,
|
||||
MessageInfos: file_model_proto_msgTypes,
|
||||
}.Build()
|
||||
File_model_proto = out.File
|
||||
|
||||
+14
-4
@@ -3,8 +3,6 @@ syntax = "proto3";
|
||||
package livekit;
|
||||
option go_package = "github.com/livekit/livekit-server/proto/livekit";
|
||||
|
||||
// internal types, declaring in proto to get serialization for free
|
||||
|
||||
message Node {
|
||||
string id = 1;
|
||||
string ip = 2;
|
||||
@@ -17,6 +15,7 @@ message NodeStats {
|
||||
int32 num_clients = 2;
|
||||
}
|
||||
|
||||
// internal type, for serialization with proto
|
||||
message Room {
|
||||
string id = 1;
|
||||
uint32 empty_timeout = 2;
|
||||
@@ -33,10 +32,21 @@ message RoomInfo {
|
||||
}
|
||||
|
||||
message ParticipantInfo {
|
||||
enum State {
|
||||
// websocket connected, but not offered yet
|
||||
JOINING = 0;
|
||||
// server received client offer
|
||||
JOINED = 1;
|
||||
// ICE connectivity established
|
||||
ACTIVE = 2;
|
||||
// WS disconnected
|
||||
DISCONNECTED = 3;
|
||||
}
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
bool has_audio = 3;
|
||||
bool has_video = 4;
|
||||
State state = 3;
|
||||
bool has_audio = 4;
|
||||
bool has_video = 5;
|
||||
}
|
||||
|
||||
message DataChannel {
|
||||
|
||||
Reference in New Issue
Block a user