Fixed crash when PCF is destroyed before MediaSource/Track in ObjC
Bug: webrtc:9231 Change-Id: I31b86aa560f4ad230c9a94fedebebf320e0370a4 Reviewed-on: https://webrtc-review.googlesource.com/88221 Reviewed-by: Kári Helgason <kthelgason@webrtc.org> Commit-Queue: Kári Helgason <kthelgason@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23981}
This commit is contained in:
committed by
Commit Bot
parent
5a3d87d122
commit
01cee079dc
@ -31,18 +31,19 @@
|
||||
std::string nativeId = [NSString stdStringForString:trackId];
|
||||
rtc::scoped_refptr<webrtc::AudioTrackInterface> track =
|
||||
factory.nativeFactory->CreateAudioTrack(nativeId, source.nativeAudioSource);
|
||||
if (self = [self initWithNativeTrack:track type:RTCMediaStreamTrackTypeAudio]) {
|
||||
if (self = [self initWithFactory:factory nativeTrack:track type:RTCMediaStreamTrackTypeAudio]) {
|
||||
_source = source;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithNativeTrack:
|
||||
(rtc::scoped_refptr<webrtc::MediaStreamTrackInterface>)nativeTrack
|
||||
type:(RTCMediaStreamTrackType)type {
|
||||
- (instancetype)initWithFactory:(RTCPeerConnectionFactory *)factory
|
||||
nativeTrack:(rtc::scoped_refptr<webrtc::MediaStreamTrackInterface>)nativeTrack
|
||||
type:(RTCMediaStreamTrackType)type {
|
||||
NSParameterAssert(factory);
|
||||
NSParameterAssert(nativeTrack);
|
||||
NSParameterAssert(type == RTCMediaStreamTrackTypeAudio);
|
||||
return [super initWithNativeTrack:nativeTrack type:type];
|
||||
return [super initWithFactory:factory nativeTrack:nativeTrack type:type];
|
||||
}
|
||||
|
||||
|
||||
@ -51,7 +52,8 @@
|
||||
rtc::scoped_refptr<webrtc::AudioSourceInterface> source =
|
||||
self.nativeAudioTrack->GetSource();
|
||||
if (source) {
|
||||
_source = [[RTCAudioSource alloc] initWithNativeAudioSource:source.get()];
|
||||
_source =
|
||||
[[RTCAudioSource alloc] initWithFactory:self.factory nativeAudioSource:source.get()];
|
||||
}
|
||||
}
|
||||
return _source;
|
||||
|
||||
Reference in New Issue
Block a user