RTSPtoWeb icon indicating copy to clipboard operation
RTSPtoWeb copied to clipboard

RTSP Connection is not released under high traffic conditions

Open GyeongHoKim opened this issue 1 year ago • 0 comments

Related to #496

Problem

My product is React WebAPP for GIS system, I use RTSPtoWeb as Media Server. My product's users sometimes create & close webrtc players in very short time. When there are many traffics, I found some of cameras does not release its RTSP Connection with RTSPtoWeb server. I fixed it and worked well in my product.

gin.Context Is Not Concurrency-Safe

gin.Context is not created each requests. Gin uses sync.Pool. so if there are many traffics, sometimes race condition happens. you should use Copy method or just store params on new variables.

cCopy := c.Copy()
go func() {
    do something
}()

or

uuid := c.Param("uuid")
channel := c.Param("uuid")
go func() {
    do something
}()

GyeongHoKim avatar Dec 06 '24 00:12 GyeongHoKim