调整了Gop一下代码

pull/241/head
joe_zhang2006@163.com 2 years ago
parent ca6cc34a1f
commit 6c2c18fe50

@ -155,8 +155,9 @@ func (gc *GopCache) Clear() {
// 注意如果GopCache为空则不缓存msg
func (gc *GopCache) feedLastGop(msg base.RtmpMsg, b []byte) {
if !gc.isGopRingEmpty() {
if gc.gopRing[(gc.gopRingLast-1+gc.gopSize)%gc.gopSize].len()<=gc.singleGopMaxNum ||gc.singleGopMaxNum==0{
gc.gopRing[(gc.gopRingLast-1+gc.gopSize)%gc.gopSize].Feed(msg, b)
gopPos:=(gc.gopRingLast-1+gc.gopSize)%gc.gopSize
if gc.gopRing[gopPos].len()<=gc.singleGopMaxNum ||gc.singleGopMaxNum==0{
gc.gopRing[gopPos].Feed(msg, b)
}
}
}

@ -74,8 +74,9 @@ func (gc *GopCacheMpegts) Clear() {
// 注意如果GopCache为空则不缓存msg
func (gc *GopCacheMpegts) feedLastGop(b []byte) {
if !gc.isGopRingEmpty() {
if gc.gopRing[(gc.gopRingLast-1+gc.gopSize)%gc.gopSize].len()<=gc.singleGopMaxNum ||gc.singleGopMaxNum==0{
gc.gopRing[(gc.gopRingLast-1+gc.gopSize)%gc.gopSize].Feed(b)
gopPos:=(gc.gopRingLast-1+gc.gopSize)%gc.gopSize
if gc.gopRing[gopPos].len()<=gc.singleGopMaxNum ||gc.singleGopMaxNum==0{
gc.gopRing[gopPos].Feed(b)
}
}

Loading…
Cancel
Save