first-commit

This commit is contained in:
harshabose
2025-02-19 23:47:15 +05:30
parent be46bbacb8
commit 1e29edf794
21 changed files with 261 additions and 309 deletions

View File

@@ -3,6 +3,7 @@ package internal
import (
"sync"
"github.com/harshabose/tools/buffer/pkg"
"github.com/pion/rtp"
)
@@ -10,6 +11,16 @@ type rtpPool struct {
pool sync.Pool
}
func CreateRTPPool() buffer.Pool[rtp.Packet] {
return &rtpPool{
pool: sync.Pool{
New: func() any {
return &rtp.Packet{}
},
},
}
}
func (pool *rtpPool) Get() *rtp.Packet {
packet, ok := pool.pool.Get().(*rtp.Packet)