Strip packet trailers from every VP9 layer frame (#4773)

VP9 SVC sends each spatial layer as its own encoded frame,
so a picture carries one trailer per layer, but only the
top layer's last packet has the RTP marker bit set.

Fix https://github.com/livekit/egress/issues/1347
This commit is contained in:
cnderrauber
2026-08-26 14:05:34 +08:00
committed by GitHub
parent b79f1c425f
commit 763ea15293
8 changed files with 159 additions and 20 deletions
+5 -3
View File
@@ -25,9 +25,11 @@ const (
// StripTrailer returns the number of bytes to strip from the end of an RTP
// payload if it contains an LKTS trailer. The trailer is located by checking
// for the "LKTS" magic suffix and then reading the XORed trailer_len byte
// immediately before it. Returns 0 if absent or ineligible.
func StripTrailer(payload []byte, marker bool) int {
if !marker || len(payload) < envelopeSize {
// immediately before it. isEndOfFrame must be set only for packets ending an
// encoded frame, i. e. where a trailer could have been appended. Returns 0 if
// absent or ineligible.
func StripTrailer(payload []byte, isEndOfFrame bool) int {
if !isEndOfFrame || len(payload) < envelopeSize {
return 0
}