Commit f277b42e authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Check for connection state if not sending report packet.

This avoids a situation when an RTCP sender never terminates.
parent f70ff242
...@@ -799,6 +799,10 @@ func sendRR(conn *rtpUpConnection) error { ...@@ -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 { ...@@ -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
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment