Check for connection state if not sending report packet.
This avoids a situation when an RTCP sender never terminates.
This commit is contained in:
@@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user