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
@ -28,30 +28,35 @@ static webrtc::ObjCVideoTrackSource *getObjCVideoSource(
|
||||
rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> _nativeVideoSource;
|
||||
}
|
||||
|
||||
- (instancetype)initWithNativeVideoSource:
|
||||
(rtc::scoped_refptr<webrtc::VideoTrackSourceInterface>)nativeVideoSource {
|
||||
- (instancetype)initWithFactory:(RTCPeerConnectionFactory *)factory
|
||||
nativeVideoSource:
|
||||
(rtc::scoped_refptr<webrtc::VideoTrackSourceInterface>)nativeVideoSource {
|
||||
RTC_DCHECK(factory);
|
||||
RTC_DCHECK(nativeVideoSource);
|
||||
if (self = [super initWithNativeMediaSource:nativeVideoSource
|
||||
type:RTCMediaSourceTypeVideo]) {
|
||||
if (self = [super initWithFactory:factory
|
||||
nativeMediaSource:nativeVideoSource
|
||||
type:RTCMediaSourceTypeVideo]) {
|
||||
_nativeVideoSource = nativeVideoSource;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithNativeMediaSource:
|
||||
(rtc::scoped_refptr<webrtc::MediaSourceInterface>)nativeMediaSource
|
||||
type:(RTCMediaSourceType)type {
|
||||
- (instancetype)initWithFactory:(RTCPeerConnectionFactory *)factory
|
||||
nativeMediaSource:(rtc::scoped_refptr<webrtc::MediaSourceInterface>)nativeMediaSource
|
||||
type:(RTCMediaSourceType)type {
|
||||
RTC_NOTREACHED();
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (instancetype)initWithSignalingThread:(rtc::Thread *)signalingThread
|
||||
workerThread:(rtc::Thread *)workerThread {
|
||||
- (instancetype)initWithFactory:(RTCPeerConnectionFactory *)factory
|
||||
signalingThread:(rtc::Thread *)signalingThread
|
||||
workerThread:(rtc::Thread *)workerThread {
|
||||
rtc::scoped_refptr<webrtc::ObjCVideoTrackSource> objCVideoTrackSource(
|
||||
new rtc::RefCountedObject<webrtc::ObjCVideoTrackSource>());
|
||||
|
||||
return [self initWithNativeVideoSource:webrtc::VideoTrackSourceProxy::Create(
|
||||
signalingThread, workerThread, objCVideoTrackSource)];
|
||||
return [self initWithFactory:factory
|
||||
nativeVideoSource:webrtc::VideoTrackSourceProxy::Create(
|
||||
signalingThread, workerThread, objCVideoTrackSource)];
|
||||
}
|
||||
|
||||
- (NSString *)description {
|
||||
|
||||
Reference in New Issue
Block a user