1
Fork 0

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
1 changed files with 8 additions and 0 deletions

View File

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