-
Notifications
You must be signed in to change notification settings - Fork 2
Fix crash on addIceCandidate, setRemote/LocalDescription #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix crash on addIceCandidate, setRemote/LocalDescription #11
Conversation
There are two problems with setLocalDescription / setRemoteDescription in ObjC SDK. First, RTCSessionDescription.nativeDescription returns a raw nullableSessionDescriptionInterface pointer, where sLD/sRD are calling Clone() method unconditionally, so it might crash. Second, unnecessary sLD/sRD calls Clone() of the raw pointer and does not delete it, so this pointer will leak. To solve these problems, I changed the return type of nativeDescription to std::unique_ptr and removed the call to Clone() method. Bug: webrtc:13022, webrtc:13035 Change-Id: Icbb87dda62d3a11af47ec74621cf64b8a6c05228 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227380 Reviewed-by: Kári Helgason <kthelgason@webrtc.org> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Byoungchan Lee <daniel.l@hpcnt.com> Cr-Commit-Position: refs/heads/master@{#34647}
RTCIceCandidate.nativeCandidate returns a unique_ptr that can be null. As with the previous CL, this is used without checking whether it is null or not, so it should be fixed. Bug: None Change-Id: I70a84f7a2a9a9d47b8cefa198204f9b6d63a7c7f Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227620 Commit-Queue: Byoungchan Lee <daniel.l@hpcnt.com> Reviewed-by: Kári Helgason <kthelgason@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34649} (cherry picked from commit 8c48757)
|
저 타입이 c++타입이라서 그렇습니당 |
| dispatch_semaphore_signal(negotiatedSem); | ||
| } | ||
| }]; | ||
|
|
||
| NSTimeInterval timeout = 5; | ||
| ASSERT_EQ( | ||
| 0, | ||
| dispatch_semaphore_wait(negotiatedSem, | ||
| dispatch_time(DISPATCH_TIME_NOW, (int64_t)(timeout * NSEC_PER_SEC)))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
167 번째줄의 ASSERT_EQ은 162번째줄의 disaptch_semaphor_signal 메소드 호출까지 기다리는게 맞나요?
| [[RTC_OBJC_TYPE(RTCSessionDescription) alloc] initWithType:RTCSdpTypeAnswer sdp:[self sdp]]; | ||
|
|
||
| webrtc::SessionDescriptionInterface *nativeDescription = | ||
| std::unique_ptr<webrtc::SessionDescriptionInterface> nativeDescription = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
둘의 차이가 뭔가요?
| _peerConnection->SetLocalDescription(sdp.nativeDescription->Clone(), observer); | ||
| _peerConnection->SetLocalDescription(sdp.nativeDescription, observer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clone()은 뭔가요? Copying인가요?
제거하신 이유가 뭔가요?
No description provided.