fix: reduce ringbuffer gently

This commit is contained in:
langhuihui
2024-06-27 13:49:11 +08:00
parent 9ef8b7ad02
commit 2dbb40dc78
28 changed files with 888 additions and 192 deletions

View File

@@ -1,7 +1,9 @@
package rtmp
import (
"encoding/binary"
"fmt"
"io"
"time"
"m7s.live/m7s/v5/pkg/util"
@@ -21,6 +23,15 @@ type RTMPData struct {
util.RecyclableMemory
}
func (avcc *RTMPData) Dump(t byte, w io.Writer) {
m := avcc.Borrow(9 + avcc.Size)
m[0] = t
binary.BigEndian.PutUint32(m[1:], uint32(4+avcc.Size))
binary.BigEndian.PutUint32(m[5:], avcc.Timestamp)
avcc.CopyTo(m[9:])
w.Write(m)
}
func (avcc *RTMPData) GetSize() int {
return avcc.Size
}