Fixed crash when PCF is destroyed before RTCRtpTranceiver in ObjC

Bug: webrtc:9231
Change-Id: Icecc319eaf6edd2c4b7b05fda984660412cb0d40
Reviewed-on: https://webrtc-review.googlesource.com/87439
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Commit-Queue: Kári Helgason <kthelgason@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23884}
This commit is contained in:
Yura Yaroshevich
2018-07-09 11:56:06 +03:00
committed by Commit Bot
parent 42a2fc9cba
commit 08f14dd388
4 changed files with 49 additions and 12 deletions

View File

@ -45,6 +45,7 @@
@end
@implementation RTCRtpTransceiver {
RTCPeerConnectionFactory *_factory;
rtc::scoped_refptr<webrtc::RtpTransceiverInterface> _nativeRtpTransceiver;
}
@ -120,10 +121,13 @@
return _nativeRtpTransceiver;
}
- (instancetype)initWithNativeRtpTransceiver:
(rtc::scoped_refptr<webrtc::RtpTransceiverInterface>)nativeRtpTransceiver {
- (instancetype)initWithFactory:(RTCPeerConnectionFactory *)factory
nativeRtpTransceiver:
(rtc::scoped_refptr<webrtc::RtpTransceiverInterface>)nativeRtpTransceiver {
NSParameterAssert(factory);
NSParameterAssert(nativeRtpTransceiver);
if (self = [super init]) {
_factory = factory;
_nativeRtpTransceiver = nativeRtpTransceiver;
_sender = [[RTCRtpSender alloc] initWithNativeRtpSender:nativeRtpTransceiver->sender()];
_receiver = [[RTCRtpReceiver alloc] initWithNativeRtpReceiver:nativeRtpTransceiver->receiver()];