Skip to content

Commit

Permalink
[Fix]Close transceiver before closing the PeerConnection (#538)
Browse files Browse the repository at this point in the history
  • Loading branch information
ipavlidakis committed Sep 26, 2024
1 parent b4bc676 commit 999e11b
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@ final class StreamRTCPeerConnection: StreamRTCPeerConnectionProtocol, @unchecked

/// Closes the peer connection.
func close() {
/// It's very important to close any transceivers **before** we close the connection, to make
/// sure that access to `RTCVideoTrack` properties, will be handled correctly. Otherwise
/// if we try to access any property/method on a `RTCVideoTrack` instance whose
/// peerConnection has closed, we will get blocked on the Main Thread.
source.transceivers.forEach { $0.stopInternal() }
source.close()
}
}

0 comments on commit 999e11b

Please sign in to comment.