fix: memory

This commit is contained in:
langhuihui
2024-05-29 14:29:52 +08:00
parent 55446e3f57
commit 6902ac8b3d
26 changed files with 921 additions and 772 deletions

View File

@@ -18,23 +18,22 @@ const (
type RTMPData struct {
Timestamp uint32
util.RecyclableBuffers
util.RecyclableMemory
}
func (avcc *RTMPData) GetSize() int {
return avcc.Length
return avcc.Size
}
func (avcc *RTMPData) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`{"Timestamp":%d,"Size":%d,"Data":"%s"}`, avcc.Timestamp, avcc.Length, avcc.String())), nil
return []byte(fmt.Sprintf(`{"Timestamp":%d,"Size":%d,"Data":"%s"}`, avcc.Timestamp, avcc.Size, avcc.String())), nil
}
func (avcc *RTMPData) String() string {
reader := avcc.Buffers
first10 := avcc.Malloc(10)
reader.ReadBytesTo(first10)
defer avcc.Free(first10)
return fmt.Sprintf("%d % 02X", avcc.Timestamp, first10)
reader := avcc.NewReader()
var bytes10 [10]byte
reader.ReadBytesTo(bytes10[:])
return fmt.Sprintf("%d % 02X", avcc.Timestamp, bytes10[:])
}
func (avcc *RTMPData) GetTimestamp() time.Duration {