mirror of
https://github.com/pion/webrtc.git
synced 2025-10-26 16:50:34 +08:00
Hold lock when accessing remote description
CurrentRemoteDescription and PendingRemoteDescription both access members of the PeerConnection that should be protected by a lock. Co-authored-by: Markus Tzoe <chou.marcus@gmail.com>
This commit is contained in:
@@ -1948,6 +1948,9 @@ func (pc *PeerConnection) PendingLocalDescription() *SessionDescription {
|
||||
// into the stable state plus any remote candidates that have been supplied
|
||||
// via AddICECandidate() since the offer or answer was created.
|
||||
func (pc *PeerConnection) CurrentRemoteDescription() *SessionDescription {
|
||||
pc.mu.RLock()
|
||||
defer pc.mu.RUnlock()
|
||||
|
||||
return pc.currentRemoteDescription
|
||||
}
|
||||
|
||||
@@ -1957,6 +1960,9 @@ func (pc *PeerConnection) CurrentRemoteDescription() *SessionDescription {
|
||||
// created. If the PeerConnection is in the stable state, the value is
|
||||
// null.
|
||||
func (pc *PeerConnection) PendingRemoteDescription() *SessionDescription {
|
||||
pc.mu.RLock()
|
||||
defer pc.mu.RUnlock()
|
||||
|
||||
return pc.pendingRemoteDescription
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user