mirror of
https://github.com/pion/webrtc.git
synced 2025-10-28 01:31:33 +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
|
// into the stable state plus any remote candidates that have been supplied
|
||||||
// via AddICECandidate() since the offer or answer was created.
|
// via AddICECandidate() since the offer or answer was created.
|
||||||
func (pc *PeerConnection) CurrentRemoteDescription() *SessionDescription {
|
func (pc *PeerConnection) CurrentRemoteDescription() *SessionDescription {
|
||||||
|
pc.mu.RLock()
|
||||||
|
defer pc.mu.RUnlock()
|
||||||
|
|
||||||
return pc.currentRemoteDescription
|
return pc.currentRemoteDescription
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1957,6 +1960,9 @@ func (pc *PeerConnection) CurrentRemoteDescription() *SessionDescription {
|
|||||||
// created. If the PeerConnection is in the stable state, the value is
|
// created. If the PeerConnection is in the stable state, the value is
|
||||||
// null.
|
// null.
|
||||||
func (pc *PeerConnection) PendingRemoteDescription() *SessionDescription {
|
func (pc *PeerConnection) PendingRemoteDescription() *SessionDescription {
|
||||||
|
pc.mu.RLock()
|
||||||
|
defer pc.mu.RUnlock()
|
||||||
|
|
||||||
return pc.pendingRemoteDescription
|
return pc.pendingRemoteDescription
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user