perform frame readings and writings in separate routines, in order to increase UDP throughput and avoid freezes caused by a single laggy reader (https://github.com/aler9/rtsp-simple-server/issues/125) (https://github.com/aler9/rtsp-simple-server/issues/162)

This commit is contained in:
aler9
2021-01-09 22:59:41 +01:00
parent 87bd5bde32
commit 7d91c13972
8 changed files with 263 additions and 126 deletions

View File

@@ -20,7 +20,7 @@ func newServer(conf ServerConf, address string) (*Server, error) {
conf.WriteTimeout = 10 * time.Second
}
if conf.ReadBufferCount == 0 {
conf.ReadBufferCount = 1
conf.ReadBufferCount = 1024
}
if conf.Listen == nil {
conf.Listen = net.Listen
@@ -36,11 +36,8 @@ func newServer(conf ServerConf, address string) (*Server, error) {
}
if conf.UDPRTPListener != nil {
conf.UDPRTPListener.streamType = StreamTypeRTP
conf.UDPRTPListener.writeTimeout = conf.WriteTimeout
conf.UDPRTCPListener.streamType = StreamTypeRTCP
conf.UDPRTCPListener.writeTimeout = conf.WriteTimeout
conf.UDPRTPListener.initialize(conf, StreamTypeRTP)
conf.UDPRTCPListener.initialize(conf, StreamTypeRTCP)
}
listener, err := conf.Listen("tcp", address)