From 828c4557907c8fc661049b08e2c6ea775de72329 Mon Sep 17 00:00:00 2001 From: thesyncim Date: Wed, 10 Jul 2024 12:26:40 +0100 Subject: [PATCH] add prev_session_id to reconnect details --- protobuf/video/sfu/event/events.pb.go | 14 +++++- protobuf/video/sfu/event/events.proto | 2 + protobuf/video/sfu/event/events_vtproto.pb.go | 43 +++++++++++++++++++ protobuf/video/sfu/models/models.pb.go | 16 +++---- 4 files changed, 66 insertions(+), 9 deletions(-) diff --git a/protobuf/video/sfu/event/events.pb.go b/protobuf/video/sfu/event/events.pb.go index a5cd9b33..d032bf07 100644 --- a/protobuf/video/sfu/event/events.pb.go +++ b/protobuf/video/sfu/event/events.pb.go @@ -1175,6 +1175,8 @@ type ReconnectDetails struct { Subscriptions []*signal_rpc.TrackSubscriptionDetails `protobuf:"bytes,4,rep,name=subscriptions,proto3" json:"subscriptions,omitempty"` ReconnectAttempt uint32 `protobuf:"varint,5,opt,name=reconnect_attempt,json=reconnectAttempt,proto3" json:"reconnect_attempt,omitempty"` FromSfuId string `protobuf:"bytes,6,opt,name=from_sfu_id,json=fromSfuId,proto3" json:"from_sfu_id,omitempty"` + // only set in case of rejoin + PreviousSessionId string `protobuf:"bytes,7,opt,name=previous_session_id,json=previousSessionId,proto3" json:"previous_session_id,omitempty"` } func (x *ReconnectDetails) Reset() { @@ -1244,6 +1246,13 @@ func (x *ReconnectDetails) GetFromSfuId() string { return "" } +func (x *ReconnectDetails) GetPreviousSessionId() string { + if x != nil { + return x.PreviousSessionId + } + return "" +} + type Migration struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -2710,7 +2719,7 @@ var file_video_sfu_event_events_proto_rawDesc = []byte{ 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x76, 0x69, 0x64, 0x65, 0x6f, 0x2e, 0x73, 0x66, 0x75, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x52, 0x10, 0x72, 0x65, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, - 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x22, 0xd8, 0x02, 0x0a, 0x10, 0x52, 0x65, 0x63, 0x6f, + 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x22, 0x88, 0x03, 0x0a, 0x10, 0x52, 0x65, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x12, 0x4f, 0x0a, 0x08, 0x73, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x33, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x76, 0x69, 0x64, 0x65, 0x6f, 0x2e, 0x73, 0x66, @@ -2732,6 +2741,9 @@ var file_video_sfu_event_events_proto_rawDesc = []byte{ 0x52, 0x10, 0x72, 0x65, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x41, 0x74, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x12, 0x1e, 0x0a, 0x0b, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x73, 0x66, 0x75, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66, 0x72, 0x6f, 0x6d, 0x53, 0x66, 0x75, + 0x49, 0x64, 0x12, 0x2e, 0x0a, 0x13, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x5f, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x11, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0xd3, 0x01, 0x0a, 0x09, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x0a, 0x0b, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x73, 0x66, 0x75, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66, 0x72, 0x6f, 0x6d, 0x53, 0x66, 0x75, 0x49, 0x64, diff --git a/protobuf/video/sfu/event/events.proto b/protobuf/video/sfu/event/events.proto index 6e334dac..35fb7d76 100644 --- a/protobuf/video/sfu/event/events.proto +++ b/protobuf/video/sfu/event/events.proto @@ -175,6 +175,8 @@ message ReconnectDetails { repeated signal.TrackSubscriptionDetails subscriptions = 4; uint32 reconnect_attempt = 5; string from_sfu_id = 6; + // only set in case of rejoin + string previous_session_id = 7; } message Migration { diff --git a/protobuf/video/sfu/event/events_vtproto.pb.go b/protobuf/video/sfu/event/events_vtproto.pb.go index 1cdc6826..e9e6cfea 100644 --- a/protobuf/video/sfu/event/events_vtproto.pb.go +++ b/protobuf/video/sfu/event/events_vtproto.pb.go @@ -1204,6 +1204,13 @@ func (m *ReconnectDetails) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } + if len(m.PreviousSessionId) > 0 { + i -= len(m.PreviousSessionId) + copy(dAtA[i:], m.PreviousSessionId) + i = encodeVarint(dAtA, i, uint64(len(m.PreviousSessionId))) + i-- + dAtA[i] = 0x3a + } if len(m.FromSfuId) > 0 { i -= len(m.FromSfuId) copy(dAtA[i:], m.FromSfuId) @@ -3088,6 +3095,10 @@ func (m *ReconnectDetails) SizeVT() (n int) { if l > 0 { n += 1 + l + sov(uint64(l)) } + l = len(m.PreviousSessionId) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } if m.unknownFields != nil { n += len(m.unknownFields) } @@ -6143,6 +6154,38 @@ func (m *ReconnectDetails) UnmarshalVT(dAtA []byte) error { } m.FromSfuId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PreviousSessionId", 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.PreviousSessionId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skip(dAtA[iNdEx:]) diff --git a/protobuf/video/sfu/models/models.pb.go b/protobuf/video/sfu/models/models.pb.go index 183a8425..daef20b3 100644 --- a/protobuf/video/sfu/models/models.pb.go +++ b/protobuf/video/sfu/models/models.pb.go @@ -582,9 +582,9 @@ const ( WebsocketReconnectStrategy_WEBSOCKET_RECONNECT_STRATEGY_CLEAN WebsocketReconnectStrategy = 3 // SDK should obtain new credentials from the coordinator, drops existing pc instances, set a new session_id and initializes // a completely new WebSocket connection, ensuring a comprehensive reset. - WebsocketReconnectStrategy_WEBSOCKET_RECONNECT_STRATEGY_REJOIN WebsocketReconnectStrategy = 5 + WebsocketReconnectStrategy_WEBSOCKET_RECONNECT_STRATEGY_REJOIN WebsocketReconnectStrategy = 4 // SDK should migrate to a new SFU instance - WebsocketReconnectStrategy_WEBSOCKET_RECONNECT_STRATEGY_MIGRATE WebsocketReconnectStrategy = 6 + WebsocketReconnectStrategy_WEBSOCKET_RECONNECT_STRATEGY_MIGRATE WebsocketReconnectStrategy = 5 ) // Enum value maps for WebsocketReconnectStrategy. @@ -594,16 +594,16 @@ var ( 1: "WEBSOCKET_RECONNECT_STRATEGY_DISCONNECT", 2: "WEBSOCKET_RECONNECT_STRATEGY_FAST", 3: "WEBSOCKET_RECONNECT_STRATEGY_CLEAN", - 5: "WEBSOCKET_RECONNECT_STRATEGY_REJOIN", - 6: "WEBSOCKET_RECONNECT_STRATEGY_MIGRATE", + 4: "WEBSOCKET_RECONNECT_STRATEGY_REJOIN", + 5: "WEBSOCKET_RECONNECT_STRATEGY_MIGRATE", } WebsocketReconnectStrategy_value = map[string]int32{ "WEBSOCKET_RECONNECT_STRATEGY_UNSPECIFIED": 0, "WEBSOCKET_RECONNECT_STRATEGY_DISCONNECT": 1, "WEBSOCKET_RECONNECT_STRATEGY_FAST": 2, "WEBSOCKET_RECONNECT_STRATEGY_CLEAN": 3, - "WEBSOCKET_RECONNECT_STRATEGY_REJOIN": 5, - "WEBSOCKET_RECONNECT_STRATEGY_MIGRATE": 6, + "WEBSOCKET_RECONNECT_STRATEGY_REJOIN": 4, + "WEBSOCKET_RECONNECT_STRATEGY_MIGRATE": 5, } ) @@ -2300,10 +2300,10 @@ var file_video_sfu_models_models_proto_rawDesc = []byte{ 0x43, 0x54, 0x5f, 0x53, 0x54, 0x52, 0x41, 0x54, 0x45, 0x47, 0x59, 0x5f, 0x43, 0x4c, 0x45, 0x41, 0x4e, 0x10, 0x03, 0x12, 0x27, 0x0a, 0x23, 0x57, 0x45, 0x42, 0x53, 0x4f, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x52, 0x45, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, 0x5f, 0x53, 0x54, 0x52, 0x41, 0x54, - 0x45, 0x47, 0x59, 0x5f, 0x52, 0x45, 0x4a, 0x4f, 0x49, 0x4e, 0x10, 0x05, 0x12, 0x28, 0x0a, 0x24, + 0x45, 0x47, 0x59, 0x5f, 0x52, 0x45, 0x4a, 0x4f, 0x49, 0x4e, 0x10, 0x04, 0x12, 0x28, 0x0a, 0x24, 0x57, 0x45, 0x42, 0x53, 0x4f, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x52, 0x45, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, 0x5f, 0x53, 0x54, 0x52, 0x41, 0x54, 0x45, 0x47, 0x59, 0x5f, 0x4d, 0x49, 0x47, - 0x52, 0x41, 0x54, 0x45, 0x10, 0x06, 0x42, 0x65, 0x42, 0x0b, 0x53, 0x66, 0x75, 0x4d, 0x6f, 0x64, + 0x52, 0x41, 0x54, 0x45, 0x10, 0x05, 0x42, 0x65, 0x42, 0x0b, 0x53, 0x66, 0x75, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x56, 0x31, 0x50, 0x01, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x47, 0x65, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f,