title: iOS Webrtc - Crash in RTCPeerConnectionFactory.VideoSourceWithCapturer
body: <p>I am using static library "libWebRTC.a" to create IOS App by binding it using Xamarin binding.</p>
  
  <p>when I call <code>_factory.VideoSourceWithCapturer(capturer, mediaConstraints);</code> in this code the application crashes</p>
  
  <pre><code>      RTCVideoTrack CreateLocalVideoTrack()
      {
          RTCVideoTrack localVideoTrack = null;
          AVCaptureDevice.RequestAccessForMediaType(AVMediaType.Video, (bool isAccessGranted) =&gt;
          {
              if (isAccessGranted)
              {
                  String cameraID = "";
                  for (int i = 0; i &lt; AVCaptureDevice.DevicesWithMediaType(AVMediaType.Video).Length; i++)
                  {
                      if (AVCaptureDevice.DevicesWithMediaType(AVMediaType.Video)[i].Position == AVCaptureDevicePosition.Front)
                      {
                          cameraID = AVCaptureDevice.DevicesWithMediaType(AVMediaType.Video)[i].LocalizedName;
                          break;
                      }
                  }
                  //do something
  
                  RTCVideoCapturer capturer = RTCVideoCapturer.CapturerWithDeviceName(cameraID);
  
                  RTCMediaConstraints mediaConstraints = DefaultMediaStreamConstraints();
                  RTCVideoSource videoSource = _factory.VideoSourceWithCapturer(capturer, mediaConstraints);
                  localVideoTrack = _factory.VideoTrackWithID(@"ARDAMSv0", videoSource);
              }
              else
              {
  
              }
          });
  
          return localVideoTrack;
      }
  </code></pre>
  
  <p>and this is the message :</p>
  
  <blockquote>
    <p>Native stacktrace:</p>
    
    <p>critical:  0   libmonosgen-2.0.dylib               0x0000000100a18184 mono_handle_native_sigsegv + 260</p>
    
    <p>critical:  1   libmonosgen-2.0.dylib               0x0000000100a23618 mono_sigsegv_signal_handler + 220</p>
    
    <p>critical:  2   libsystem_platform.dylib            0x0000000185a08348 _sigtramp + 52</p>
    
    <p>critical:  3   TestRTC                             0x000000010020b1fc _ZN7cricket13VideoCapturer15SetCaptureStateENS_12CaptureStateE + 52</p>
    
    <p>critical:  4   TestRTC                             0x0000000100214764 _ZN7cricket19WebRtcVideoCapturer5StartERKNS_11VideoFormatE + 1084</p>
    
    <p>critical:  5   TestRTC                             0x000000010020b190 _ZN7cricket13VideoCapturer14StartCapturingERKNS_11VideoFormatE + 52</p>
    
    <p>critical:  6   TestRTC                             0x0000000100202020 _ZN7cricket14CaptureManager26StartWithBestCaptureFormatEPNS_18VideoCapturerStateEPNS_13Vi
    deoCapturerE + 204</p>
    
    <p>critical:  7   TestRTC                             0x0000000100201ea0 _ZN7cricket14CaptureManager17StartVideoCaptureEPNS_13VideoCapturerERKNS_11VideoFormatE + 196</p>
    
    <p>critical:  8   TestRTC                             0x000000010028c658 _ZN3rtc21FunctorMessageHandlerIbNS_14MethodFunctor2IN7cricket14CaptureManagerEMS3_FbPNS2_13VideoCapturerERKNS2_11VideoFormatEEbS5_S8_EEE9OnMessageEPNS_7MessageE + 24</p>
    
    <p>critical:  9   TestRTC                             0x00000001001f10c4 <em>ZN3rtc6Thread22ReceiveSendsFromThreadEPKS0</em> + 116</p>
    
    <p>critical:  10  TestRTC                             0x00000001001dc338 _ZN3rtc12MessageQueue3GetEPNS_7MessageEib + 156</p>
    
    <p>critical:  11  TestRTC                             0x00000001001f0df0 _ZN3rtc6Thread15ProcessMessagesEi + 108
    TestRTC[634:2</p>
  </blockquote>