mirror of
https://github.com/lkmio/lkm.git
synced 2025-10-05 15:16:49 +08:00
30 lines
507 B
Go
30 lines
507 B
Go
package stream
|
||
|
||
// MemoryPool
|
||
// 从解复用阶段,拼凑成完整的AVPacket开始(写),到GOP缓存结束(释放),整个过程都使用池中内存
|
||
type MemoryPool interface {
|
||
Allocate(size int) []byte
|
||
|
||
Free(size int)
|
||
}
|
||
|
||
func NewMemoryPool(capacity int) MemoryPool {
|
||
pool := &memoryPool{
|
||
data: make([]byte, capacity),
|
||
}
|
||
|
||
return pool
|
||
}
|
||
|
||
type memoryPool struct {
|
||
data []byte
|
||
size int
|
||
}
|
||
|
||
func (m *memoryPool) Allocate(size int) []byte {
|
||
return nil
|
||
}
|
||
|
||
func (m *memoryPool) Free(size int) {
|
||
}
|