mirror of
https://github.com/zhangpeihao/gortmp
synced 2025-09-26 20:01:11 +08:00
Update conn.go
add some question point statements and modify
This commit is contained in:
6
conn.go
6
conn.go
@@ -484,6 +484,8 @@ func (conn *conn) CreateMediaChunkStream() (*OutboundChunkStream, error) {
|
|||||||
newChunkStreamID = uint32((index+1)*6 + 2)
|
newChunkStreamID = uint32((index+1)*6 + 2)
|
||||||
logger.ModulePrintf(logHandler, log.LOG_LEVEL_DEBUG,
|
logger.ModulePrintf(logHandler, log.LOG_LEVEL_DEBUG,
|
||||||
"index: %d, newChunkStreamID: %d\n", index, newChunkStreamID)
|
"index: %d, newChunkStreamID: %d\n", index, newChunkStreamID)
|
||||||
|
// since allocate a newChunkStreamID, why not set the cocupited to true
|
||||||
|
conn.mediaChunkStreamIDAllocator[index] = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -510,8 +512,10 @@ func (conn *conn) InboundChunkStream(id uint32) (chunkStream *InboundChunkStream
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (conn *conn) CloseMediaChunkStream(id uint32) {
|
func (conn *conn) CloseMediaChunkStream(id uint32) {
|
||||||
|
// and the id is not the index of Allocator slice
|
||||||
|
index := (id - 2) / 6 - 1
|
||||||
conn.mediaChunkStreamIDAllocatorLocker.Lock()
|
conn.mediaChunkStreamIDAllocatorLocker.Lock()
|
||||||
conn.mediaChunkStreamIDAllocator[id] = false
|
conn.mediaChunkStreamIDAllocator[index] = false
|
||||||
conn.mediaChunkStreamIDAllocatorLocker.Unlock()
|
conn.mediaChunkStreamIDAllocatorLocker.Unlock()
|
||||||
conn.CloseChunkStream(id)
|
conn.CloseChunkStream(id)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user