完善内存池扩容

This commit is contained in:
yangjiechina
2024-05-21 20:47:35 +08:00
parent 3315e01866
commit d2644bc3df
7 changed files with 131 additions and 97 deletions

View File

@@ -225,15 +225,15 @@ func (s *SourceImpl) FindOrCreatePacketBuffer(index int, mediaType utils.AVMedia
if s.pktBuffers[index] == nil {
if utils.AVMediaTypeAudio == mediaType {
s.pktBuffers[index] = NewMemoryPool(48000 * 64)
s.pktBuffers[index] = NewRbMemoryPool(48000 * 64)
} else if AppConfig.GOPCache {
//开启GOP缓存
//以每秒钟4M码率大小创建视频内存池
s.pktBuffers[index] = NewMemoryPool(4096 * 1024)
s.pktBuffers[index] = NewRbMemoryPool(4096 * 1024)
} else {
//未开启GOP缓存
//以每秒钟4M的1/8码率大小创建视频内存池
s.pktBuffers[index] = NewMemoryPool(4096 * 1024 / 8)
s.pktBuffers[index] = NewRbMemoryPool(4096 * 1024 / 8)
}
}