add comments

This commit is contained in:
David Chen
2026-02-26 14:51:49 -08:00
parent 5edf2ce93f
commit 898b5aab91
2 changed files with 7 additions and 4 deletions
+3
View File
@@ -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
+4 -4
View File
@@ -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
}{
{