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}
diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCAudioSource.mm b/sdk/objc/Framework/Classes/PeerConnection/RTCAudioSource.mm
index 310171d..a6822f6 100644
--- a/sdk/objc/Framework/Classes/PeerConnection/RTCAudioSource.mm
+++ b/sdk/objc/Framework/Classes/PeerConnection/RTCAudioSource.mm
@@ -18,19 +18,23 @@
 @synthesize volume = _volume;
 @synthesize nativeAudioSource = _nativeAudioSource;
 
-- (instancetype)initWithNativeAudioSource:
-    (rtc::scoped_refptr<webrtc::AudioSourceInterface>)nativeAudioSource {
+- (instancetype)initWithFactory:(RTCPeerConnectionFactory *)factory
+              nativeAudioSource:
+                  (rtc::scoped_refptr<webrtc::AudioSourceInterface>)nativeAudioSource {
+  RTC_DCHECK(factory);
   RTC_DCHECK(nativeAudioSource);
-  if (self = [super initWithNativeMediaSource:nativeAudioSource
-                                         type:RTCMediaSourceTypeAudio]) {
+
+  if (self = [super initWithFactory:factory
+                  nativeMediaSource:nativeAudioSource
+                               type:RTCMediaSourceTypeAudio]) {
     _nativeAudioSource = nativeAudioSource;
   }
   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;
 }