Fixed crash when PCF is destroyed before RTCRtpReceiver in ObjC

Bug: webrtc:9231
Change-Id: Ic532b7661bb8765f0fc2309d2ad530f664ccfd14
Reviewed-on: https://webrtc-review.googlesource.com/87840
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Commit-Queue: Kári Helgason <kthelgason@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23931}
This commit is contained in:
Yura Yaroshevich
2018-07-11 12:55:04 +03:00
committed by Commit Bot
parent cd8f382557
commit 7a16c54571
5 changed files with 121 additions and 17 deletions

View File

@ -36,6 +36,7 @@ void RtpReceiverDelegateAdapter::OnFirstPacketReceived(
} // namespace webrtc
@implementation RTCRtpReceiver {
RTCPeerConnectionFactory *_factory;
rtc::scoped_refptr<webrtc::RtpReceiverInterface> _nativeRtpReceiver;
std::unique_ptr<webrtc::RtpReceiverDelegateAdapter> _observer;
}
@ -102,9 +103,11 @@ void RtpReceiverDelegateAdapter::OnFirstPacketReceived(
return _nativeRtpReceiver;
}
- (instancetype)initWithNativeRtpReceiver:
(rtc::scoped_refptr<webrtc::RtpReceiverInterface>)nativeRtpReceiver {
- (instancetype)initWithFactory:(RTCPeerConnectionFactory *)factory
nativeRtpReceiver:
(rtc::scoped_refptr<webrtc::RtpReceiverInterface>)nativeRtpReceiver {
if (self = [super init]) {
_factory = factory;
_nativeRtpReceiver = nativeRtpReceiver;
RTCLogInfo(
@"RTCRtpReceiver(%p): created receiver: %@", self, self.description);