Skip to content

Conversation

@mininny
Copy link
Contributor

@mininny mininny commented Sep 7, 2021

No description provided.

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)
@intoxicated
Copy link

  • -> std::unique_ptr 로 바꾼 이유가 있나요? objectivec++ 에서는 * 하면 아직도 alloc / release 해줘야하나요?

@mininny
Copy link
Contributor Author

mininny commented Sep 8, 2021

  • -> std::unique_ptr 로 바꾼 이유가 있나요? objectivec++ 에서는 * 하면 아직도 alloc / release 해줘야하나요?

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.

저 타입이 c++타입이라서 그렇습니당

@mininny mininny merged commit 3155be2 into feature/update-to-m93 Sep 8, 2021
@mininny mininny deleted the feature/mininny/modifications-to-m93 branch September 8, 2021 23:18
Comment on lines +162 to +170
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))));
Copy link

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 =
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

둘의 차이가 뭔가요?

Comment on lines -584 to +582
_peerConnection->SetLocalDescription(sdp.nativeDescription->Clone(), observer);
_peerConnection->SetLocalDescription(sdp.nativeDescription, observer);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clone()은 뭔가요? Copying인가요?
제거하신 이유가 뭔가요?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants