diff --git a/pkg/sfu/downtrack.go b/pkg/sfu/downtrack.go index 759616e00..afed2e203 100644 --- a/pkg/sfu/downtrack.go +++ b/pkg/sfu/downtrack.go @@ -297,6 +297,9 @@ var userTimestampMagic = [4]byte{'L', 'K', 'T', 'S'} const userTimestampTrailerSize = 12 +// stripUserTimestampTrailer returns the number of bytes to strip from the end of +// an RTP payload if it contains a user-timestamp trailer (magic suffix "LKTS"). +// Trailers only appear on marker packets; returns 0 if absent or ineligible. func stripUserTimestampTrailer(payload []byte, marker bool) int { if !marker || len(payload) < userTimestampTrailerSize { return 0 diff --git a/pkg/sfu/downtrack_strip_test.go b/pkg/sfu/downtrack_strip_test.go index 86f2fa0b7..174098613 100644 --- a/pkg/sfu/downtrack_strip_test.go +++ b/pkg/sfu/downtrack_strip_test.go @@ -1,4 +1,4 @@ -// Copyright 2023 LiveKit, Inc. +// Copyright 2026 LiveKit, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -31,9 +31,9 @@ func makePayloadWithTrailer(videoLen int, timestampUs int64) []byte { func TestStripUserTimestampTrailer(t *testing.T) { tests := []struct { - name string - payload []byte - marker bool + name string + payload []byte + marker bool wantStrip int }{ {