Make Android/iOS local/remote description accessors thread safe.
Since the descriptions can be modified on the signaling thread, ToString can only be safely called on that thread. Bug: webrtc:11791 Change-Id: Icf6aada8aa66d00be94c6bda7b22e41b5d3bbc17 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/180541 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Sami Kalliomäki <sakal@webrtc.org> Reviewed-by: Anders Carlsson <andersc@webrtc.org> Commit-Queue: Taylor <deadbeef@webrtc.org> Cr-Commit-Position: refs/heads/master@{#31862}
This commit is contained in:

committed by
Commit Bot

parent
491fa44ed9
commit
c88fe70a8d
@ -358,19 +358,27 @@ void PeerConnectionDelegateAdapter::OnRemoveTrack(
|
||||
}
|
||||
|
||||
- (RTC_OBJC_TYPE(RTCSessionDescription) *)localDescription {
|
||||
const webrtc::SessionDescriptionInterface *description =
|
||||
_peerConnection->local_description();
|
||||
return description ?
|
||||
[[RTC_OBJC_TYPE(RTCSessionDescription) alloc] initWithNativeDescription:description] :
|
||||
nil;
|
||||
// It's only safe to operate on SessionDescriptionInterface on the signaling thread.
|
||||
return _peerConnection->signaling_thread()->Invoke<RTC_OBJC_TYPE(RTCSessionDescription) *>(
|
||||
RTC_FROM_HERE, [self] {
|
||||
const webrtc::SessionDescriptionInterface *description =
|
||||
_peerConnection->local_description();
|
||||
return description ?
|
||||
[[RTC_OBJC_TYPE(RTCSessionDescription) alloc] initWithNativeDescription:description] :
|
||||
nil;
|
||||
});
|
||||
}
|
||||
|
||||
- (RTC_OBJC_TYPE(RTCSessionDescription) *)remoteDescription {
|
||||
const webrtc::SessionDescriptionInterface *description =
|
||||
_peerConnection->remote_description();
|
||||
return description ?
|
||||
[[RTC_OBJC_TYPE(RTCSessionDescription) alloc] initWithNativeDescription:description] :
|
||||
nil;
|
||||
// It's only safe to operate on SessionDescriptionInterface on the signaling thread.
|
||||
return _peerConnection->signaling_thread()->Invoke<RTC_OBJC_TYPE(RTCSessionDescription) *>(
|
||||
RTC_FROM_HERE, [self] {
|
||||
const webrtc::SessionDescriptionInterface *description =
|
||||
_peerConnection->remote_description();
|
||||
return description ?
|
||||
[[RTC_OBJC_TYPE(RTCSessionDescription) alloc] initWithNativeDescription:description] :
|
||||
nil;
|
||||
});
|
||||
}
|
||||
|
||||
- (RTCSignalingState)signalingState {
|
||||
|
Reference in New Issue
Block a user