server: sync states with client ones

This commit is contained in:
aler9
2022-02-18 10:02:20 +01:00
parent d44f1eb03a
commit fe99404495
2 changed files with 41 additions and 41 deletions

View File

@@ -225,7 +225,7 @@ func (sc *ServerConn) readFuncTCP(readRequest chan readReq) error {
var tcpReadBuffer *multibuffer.MultiBuffer
var processFunc func(int, bool, []byte)
if sc.tcpSession.state == ServerSessionStateRead {
if sc.tcpSession.state == ServerSessionStatePlay {
// when playing, tcpReadBuffer is only used to receive RTCP receiver reports,
// that are much smaller than RTP packets and are sent at a fixed interval.
// decrease RAM consumption by allocating less buffers.
@@ -291,7 +291,7 @@ func (sc *ServerConn) readFuncTCP(readRequest chan readReq) error {
var frame base.InterleavedFrame
for {
if sc.tcpSession.state == ServerSessionStatePublish {
if sc.tcpSession.state == ServerSessionStateRecord {
sc.conn.SetReadDeadline(time.Now().Add(sc.s.ReadTimeout))
}