1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-10 02:35:58 +01:00

Check for connection state if not sending report packet.

This avoids a situation when an RTCP sender never terminates.
This commit is contained in:
Juliusz Chroboczek 2020-06-09 13:46:04 +02:00
parent f70ff2424e
commit f277b42e26

View file

@ -799,6 +799,10 @@ func sendRR(conn *rtpUpConnection) error {
defer conn.mu.Unlock() defer conn.mu.Unlock()
if len(conn.tracks) == 0 { if len(conn.tracks) == 0 {
state := conn.pc.ConnectionState()
if state == webrtc.PeerConnectionStateClosed {
return io.ErrClosedPipe
}
return nil return nil
} }
@ -899,6 +903,10 @@ func sendSR(conn *rtpDownConnection) error {
} }
if len(packets) == 0 { if len(packets) == 0 {
state := conn.pc.ConnectionState()
if state == webrtc.PeerConnectionStateClosed {
return io.ErrClosedPipe
}
return nil return nil
} }