sfu: return VP8 munged header by value to avoid per-packet allocation (#4871)
CodecMunger.UpdateAndGet returned a freshly allocated slice for every forwarded packet on every down track. Return the header in a fixed array with a length instead and marshal into it with MarshalTo. TranslationParams carries the array; WriteRTP slices it locally. UpdateAndGet now allocates zero times per call (was one). Escape analysis confirms TranslationParams stays on the stack. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
08c5433449
commit
0392ca90b4
@@ -45,8 +45,8 @@ func (n *Null) SetLast(_extPkt *buffer.ExtPacket) {
|
||||
func (n *Null) UpdateOffsets(_extPkt *buffer.ExtPacket) {
|
||||
}
|
||||
|
||||
func (n *Null) UpdateAndGet(_extPkt *buffer.ExtPacket, snOutOfOrder bool, snHasGap bool, maxTemporal int32) (int, []byte, error) {
|
||||
return 0, nil, nil
|
||||
func (n *Null) UpdateAndGet(_extPkt *buffer.ExtPacket, snOutOfOrder bool, snHasGap bool, maxTemporal int32) (int, [MaxHeaderSize]byte, int, error) {
|
||||
return 0, [MaxHeaderSize]byte{}, 0, nil
|
||||
}
|
||||
|
||||
func (n *Null) UpdateAndGetPadding(newPicture bool) ([]byte, error) {
|
||||
|
||||
Reference in New Issue
Block a user