From ed0163a5ea4739fb6907fc2102ebd8bc2568cb63 Mon Sep 17 00:00:00 2001 From: thesyncim Date: Mon, 31 Jul 2023 08:44:23 +0100 Subject: [PATCH] tidy-up pins proto --- protobuf/video/sfu/models/models.pb.go | 25 +++++--- protobuf/video/sfu/models/models.proto | 5 +- .../video/sfu/models/models_vtproto.pb.go | 57 ++++++++++++++++--- 3 files changed, 72 insertions(+), 15 deletions(-) diff --git a/protobuf/video/sfu/models/models.pb.go b/protobuf/video/sfu/models/models.pb.go index 1db3ee43..930b763c 100644 --- a/protobuf/video/sfu/models/models.pb.go +++ b/protobuf/video/sfu/models/models.pb.go @@ -642,7 +642,10 @@ type Pin struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserSessionId string `protobuf:"bytes,1,opt,name=user_session_id,json=userSessionId,proto3" json:"user_session_id,omitempty"` + // the user to pin + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + // the user sesion_id to pin, if not provided, applies to all sessions + SessionId string `protobuf:"bytes,2,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` } func (x *Pin) Reset() { @@ -677,9 +680,16 @@ func (*Pin) Descriptor() ([]byte, []int) { return file_video_sfu_models_models_proto_rawDescGZIP(), []int{2} } -func (x *Pin) GetUserSessionId() string { +func (x *Pin) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *Pin) GetSessionId() string { if x != nil { - return x.UserSessionId + return x.SessionId } return "" } @@ -1841,10 +1851,11 @@ var file_video_sfu_models_models_proto_rawDesc = []byte{ 0x61, 0x6e, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x6e, 0x6f, 0x6e, 0x79, 0x6d, 0x6f, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x09, 0x61, 0x6e, 0x6f, 0x6e, 0x79, 0x6d, 0x6f, 0x75, 0x73, 0x22, 0x2d, 0x0a, 0x03, - 0x50, 0x69, 0x6e, 0x12, 0x26, 0x0a, 0x0f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x73, 0x73, - 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x75, 0x73, - 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0xbb, 0x04, 0x0a, 0x0b, + 0x0d, 0x52, 0x09, 0x61, 0x6e, 0x6f, 0x6e, 0x79, 0x6d, 0x6f, 0x75, 0x73, 0x22, 0x3d, 0x0a, 0x03, + 0x50, 0x69, 0x6e, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, + 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x09, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0xbb, 0x04, 0x0a, 0x0b, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, diff --git a/protobuf/video/sfu/models/models.proto b/protobuf/video/sfu/models/models.proto index d310ef6e..1fd08d93 100644 --- a/protobuf/video/sfu/models/models.proto +++ b/protobuf/video/sfu/models/models.proto @@ -64,7 +64,10 @@ message ParticipantCount { } message Pin { - string user_session_id = 1; + // the user to pin + string user_id = 1; + // the user sesion_id to pin, if not provided, applies to all sessions + string session_id = 2; } // those who are online in the call diff --git a/protobuf/video/sfu/models/models_vtproto.pb.go b/protobuf/video/sfu/models/models_vtproto.pb.go index 71bc6953..c3279004 100644 --- a/protobuf/video/sfu/models/models_vtproto.pb.go +++ b/protobuf/video/sfu/models/models_vtproto.pb.go @@ -185,10 +185,17 @@ func (m *Pin) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } - if len(m.UserSessionId) > 0 { - i -= len(m.UserSessionId) - copy(dAtA[i:], m.UserSessionId) - i = encodeVarint(dAtA, i, uint64(len(m.UserSessionId))) + if len(m.SessionId) > 0 { + i -= len(m.SessionId) + copy(dAtA[i:], m.SessionId) + i = encodeVarint(dAtA, i, uint64(len(m.SessionId))) + i-- + dAtA[i] = 0x12 + } + if len(m.UserId) > 0 { + i -= len(m.UserId) + copy(dAtA[i:], m.UserId) + i = encodeVarint(dAtA, i, uint64(len(m.UserId))) i-- dAtA[i] = 0xa } @@ -1338,7 +1345,11 @@ func (m *Pin) SizeVT() (n int) { } var l int _ = l - l = len(m.UserSessionId) + l = len(m.UserId) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + l = len(m.SessionId) if l > 0 { n += 1 + l + sov(uint64(l)) } @@ -2133,7 +2144,39 @@ func (m *Pin) UnmarshalVT(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UserSessionId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field UserId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UserId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SessionId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2161,7 +2204,7 @@ func (m *Pin) UnmarshalVT(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.UserSessionId = string(dAtA[iNdEx:postIndex]) + m.SessionId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex