From 4467620dcd1c42f55e7b0c488b9ea9a064c03fb3 Mon Sep 17 00:00:00 2001 From: Raja Subramanian Date: Tue, 29 Sep 2026 16:08:32 +0530 Subject: [PATCH] Data track extension ID collision: intermediate step. (#1825) * Data track extension ID collision: intermediate step. Unfortunately, the extension ID allocated for participant SID across relay got used by data packet definition too. To address that, the plan - Allocate internally needed participant SID at 255 (highest extension ID) - Accept both on read side, try HIGH first and then the original - Clean up code after a full deploy - Rename LOW to E2EE extension ID. * generated protobuf * Update changeset with data track extension note Added a note about data track extension ID collision as an intermediate step. --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- .changeset/purple-dancers-relax.md | 6 ++++++ datatrack/packet_test.go | 8 ++++---- livekit/livekit_internal.pb.go | 18 ++++++++++-------- livekit/livekit_models.pb.go | 22 +++++++++++++--------- protobufs/livekit_internal.proto | 2 +- protobufs/livekit_models.proto | 3 ++- 6 files changed, 36 insertions(+), 23 deletions(-) create mode 100644 .changeset/purple-dancers-relax.md diff --git a/.changeset/purple-dancers-relax.md b/.changeset/purple-dancers-relax.md new file mode 100644 index 000000000..b5fd0f3c1 --- /dev/null +++ b/.changeset/purple-dancers-relax.md @@ -0,0 +1,6 @@ +--- +"github.com/livekit/protocol": patch +"@livekit/protocol": patch +--- + +Data track extension ID collision: intermediate step. diff --git a/datatrack/packet_test.go b/datatrack/packet_test.go index 0eba4cfe8..2f6faded0 100644 --- a/datatrack/packet_test.go +++ b/datatrack/packet_test.go @@ -82,7 +82,7 @@ func TestPacket(t *testing.T) { expectedRawPacket := []byte{ 0x14, 0x00, 0x0d, 0x05, 0x1a, 0x0a, 0x27, 0x0f, - 0xde, 0xad, 0xbe, 0xef, 0x00, 0x04, 0x01, 0x10, + 0xde, 0xad, 0xbe, 0xef, 0x00, 0x04, 0xff, 0x10, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0xff, 0xfe, 0xfd, 0xfc, @@ -129,7 +129,7 @@ func TestPacket(t *testing.T) { expectedRawPacket := []byte{ 0x14, 0x00, 0x0d, 0x05, 0x1a, 0x0a, 0x27, 0x0f, - 0xde, 0xad, 0xbe, 0xef, 0x00, 0x03, 0x01, 0x0b, + 0xde, 0xad, 0xbe, 0xef, 0x00, 0x03, 0xff, 0x0b, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x00, 0xff, 0xfe, 0xfd, 0xfc, } @@ -175,7 +175,7 @@ func TestPacket(t *testing.T) { expectedRawPacket := []byte{ 0x14, 0x00, 0x0d, 0x05, 0x1a, 0x0a, 0x27, 0x0f, - 0xde, 0xad, 0xbe, 0xef, 0x00, 0x03, 0x01, 0x0b, + 0xde, 0xad, 0xbe, 0xef, 0x00, 0x03, 0xff, 0x0b, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x00, 0xff, 0xfe, 0xfd, 0xfc, } @@ -192,7 +192,7 @@ func TestPacket(t *testing.T) { expectedRawPacket = []byte{ 0x14, 0x00, 0x0d, 0x05, 0x1a, 0x0a, 0x27, 0x0f, - 0xde, 0xad, 0xbe, 0xef, 0x00, 0x04, 0x01, 0x10, + 0xde, 0xad, 0xbe, 0xef, 0x00, 0x04, 0xff, 0x10, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0xff, 0xfe, 0xfd, 0xfc, diff --git a/livekit/livekit_internal.pb.go b/livekit/livekit_internal.pb.go index ef6e48a30..ce2509afa 100644 --- a/livekit/livekit_internal.pb.go +++ b/livekit/livekit_internal.pb.go @@ -375,11 +375,12 @@ type NodeStats struct { ParticipantRtcCanceled uint64 `protobuf:"varint,53,opt,name=participant_rtc_canceled,json=participantRtcCanceled,proto3" json:"participant_rtc_canceled,omitempty"` ParticipantRtcActive uint64 `protobuf:"varint,54,opt,name=participant_rtc_active,json=participantRtcActive,proto3" json:"participant_rtc_active,omitempty"` // forward metrics - ForwardLatency uint32 `protobuf:"varint,48,opt,name=forward_latency,json=forwardLatency,proto3" json:"forward_latency,omitempty"` - ForwardJitter uint32 `protobuf:"varint,49,opt,name=forward_jitter,json=forwardJitter,proto3" json:"forward_jitter,omitempty"` - Rates []*NodeStatsRate `protobuf:"bytes,50,rep,name=rates,proto3" json:"rates,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + ForwardLatency uint32 `protobuf:"varint,48,opt,name=forward_latency,json=forwardLatency,proto3" json:"forward_latency,omitempty"` + // Deprecated: Marked as deprecated in livekit_internal.proto. + ForwardJitter uint32 `protobuf:"varint,49,opt,name=forward_jitter,json=forwardJitter,proto3" json:"forward_jitter,omitempty"` + Rates []*NodeStatsRate `protobuf:"bytes,50,rep,name=rates,proto3" json:"rates,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *NodeStats) Reset() { @@ -809,6 +810,7 @@ func (x *NodeStats) GetForwardLatency() uint32 { return 0 } +// Deprecated: Marked as deprecated in livekit_internal.proto. func (x *NodeStats) GetForwardJitter() uint32 { if x != nil { return x.ForwardJitter @@ -1477,7 +1479,7 @@ const file_livekit_internal_proto_rawDesc = "" + "\x05stats\x18\x04 \x01(\v2\x12.livekit.NodeStatsR\x05stats\x12%\n" + "\x04type\x18\x05 \x01(\x0e2\x11.livekit.NodeTypeR\x04type\x12(\n" + "\x05state\x18\x06 \x01(\x0e2\x12.livekit.NodeStateR\x05state\x12\x16\n" + - "\x06region\x18\a \x01(\tR\x06region\"\xaf\x16\n" + + "\x06region\x18\a \x01(\tR\x06region\"\xb3\x16\n" + "\tNodeStats\x12\x1d\n" + "\n" + "started_at\x18\x01 \x01(\x03R\tstartedAt\x12\x1d\n" + @@ -1542,8 +1544,8 @@ const file_livekit_internal_proto_rawDesc = "" + "\x1cparticipant_rtc_init_per_sec\x18/ \x01(\x02B\x02\x18\x01R\x18participantRtcInitPerSec\x128\n" + "\x18participant_rtc_canceled\x185 \x01(\x04R\x16participantRtcCanceled\x124\n" + "\x16participant_rtc_active\x186 \x01(\x04R\x14participantRtcActive\x12'\n" + - "\x0fforward_latency\x180 \x01(\rR\x0eforwardLatency\x12%\n" + - "\x0eforward_jitter\x181 \x01(\rR\rforwardJitter\x12,\n" + + "\x0fforward_latency\x180 \x01(\rR\x0eforwardLatency\x12)\n" + + "\x0eforward_jitter\x181 \x01(\rB\x02\x18\x01R\rforwardJitter\x12,\n" + "\x05rates\x182 \x03(\v2\x16.livekit.NodeStatsRateR\x05rates\"\xb1\n" + "\n" + "\rNodeStatsRate\x12\x1d\n" + diff --git a/livekit/livekit_models.pb.go b/livekit/livekit_models.pb.go index 1edb1986d..b9f1e03b9 100644 --- a/livekit/livekit_models.pb.go +++ b/livekit/livekit_models.pb.go @@ -351,19 +351,22 @@ func (TrackSource) EnumDescriptor() ([]byte, []int) { type DataTrackExtensionID int32 const ( - DataTrackExtensionID_DTEI_INVALID DataTrackExtensionID = 0 - DataTrackExtensionID_DTEI_PARTICIPANT_SID DataTrackExtensionID = 1 + DataTrackExtensionID_DTEI_INVALID DataTrackExtensionID = 0 + DataTrackExtensionID_DTEI_PARTICIPANT_SID_LOW DataTrackExtensionID = 1 + DataTrackExtensionID_DTEI_PARTICIPANT_SID DataTrackExtensionID = 255 ) // Enum value maps for DataTrackExtensionID. var ( DataTrackExtensionID_name = map[int32]string{ - 0: "DTEI_INVALID", - 1: "DTEI_PARTICIPANT_SID", + 0: "DTEI_INVALID", + 1: "DTEI_PARTICIPANT_SID_LOW", + 255: "DTEI_PARTICIPANT_SID", } DataTrackExtensionID_value = map[string]int32{ - "DTEI_INVALID": 0, - "DTEI_PARTICIPANT_SID": 1, + "DTEI_INVALID": 0, + "DTEI_PARTICIPANT_SID_LOW": 1, + "DTEI_PARTICIPANT_SID": 255, } ) @@ -7536,10 +7539,11 @@ const file_livekit_models_proto_rawDesc = "" + "\n" + "MICROPHONE\x10\x02\x12\x10\n" + "\fSCREEN_SHARE\x10\x03\x12\x16\n" + - "\x12SCREEN_SHARE_AUDIO\x10\x04*B\n" + + "\x12SCREEN_SHARE_AUDIO\x10\x04*a\n" + "\x14DataTrackExtensionID\x12\x10\n" + - "\fDTEI_INVALID\x10\x00\x12\x18\n" + - "\x14DTEI_PARTICIPANT_SID\x10\x01*6\n" + + "\fDTEI_INVALID\x10\x00\x12\x1c\n" + + "\x18DTEI_PARTICIPANT_SID_LOW\x10\x01\x12\x19\n" + + "\x14DTEI_PARTICIPANT_SID\x10\xff\x01*6\n" + "\fVideoQuality\x12\a\n" + "\x03LOW\x10\x00\x12\n" + "\n" + diff --git a/protobufs/livekit_internal.proto b/protobufs/livekit_internal.proto index bdfe70076..032681b50 100644 --- a/protobufs/livekit_internal.proto +++ b/protobufs/livekit_internal.proto @@ -125,7 +125,7 @@ message NodeStats { // forward metrics uint32 forward_latency = 48; - uint32 forward_jitter = 49; + uint32 forward_jitter = 49 [deprecated = true]; repeated NodeStatsRate rates = 50; diff --git a/protobufs/livekit_models.proto b/protobufs/livekit_models.proto index bff3bbd00..7e83f0780 100644 --- a/protobufs/livekit_models.proto +++ b/protobufs/livekit_models.proto @@ -374,7 +374,8 @@ message DataTrackSchemaId { enum DataTrackExtensionID { DTEI_INVALID = 0; - DTEI_PARTICIPANT_SID = 1; + DTEI_PARTICIPANT_SID_LOW = 1; + DTEI_PARTICIPANT_SID = 255; } message DataTrackExtensionParticipantSid {