冰候选委托方法调用

时间:2016-10-04 10:03:40

标签: ios swift webrtc

enter image description here 请帮忙解决问题。???

webrtc库调用一些内部方法并获取excess_bad。和坠毁

如果需要,请提供更多信息。

//代码

 let iceServer = RTCICEServer(uri:URL(string: resturi), username: “***”, password: “***”)

// Enable SSL globally for WebRTC in our app
let pcFactory:RTCPeerConnectionFactory = RTCPeerConnectionFactory()

let rtcConfiguration = RTCConfiguration()
rtcConfiguration.iceServers = [iceServer!]

let pair1 = RTCPair(key: "OfferToReceiveAudio", value: "true")
let pair2 = RTCPair(key: "OfferToReceiveVideo", value: "false")

let pair3 = RTCPair(key: "DtlsSrtpKeyAgreement", value: "true")

self.mediaConstraints = RTCMediaConstraints(mandatoryConstraints: [pair1!,pair2!], optionalConstraints:[pair3!])

 // Create the peer connection using the ICE server list and the current class as the delegate

    let localStream:RTCMediaStream = pcFactory.mediaStream(withLabel: “12345”)
    let audioTrack:RTCAudioTrack = pcFactory.audioTrack(withID: “123456”)
    audioTrack.delegate = self

    let status = localStream.addAudioTrack(audioTrack)

 self.peerConnection = pcFactory.peerConnection(with: rtcConfiguration, constraints: self.mediaConstraints!, delegate: self)

  let pstatus = self.peerConnection!.add(localStream)

  print(status)
  print(pstatus)

//Let’s look at how the offer is created, which initiates the call.
 self.peerConnection!.createOffer(with: self, constraints: self.mediaConstraints)

我在这里啜饮。

public func peerConnection(_ peerConnection: RTCPeerConnection!, didCreateSessionDescription sdp: RTCSessionDescription!, error: Error!)

在此委托调用时崩溃。

func peerConnection(_ peerConnection: RTCPeerConnection!, gotICECandidate candidate: RTCICECandidate!)

崩溃报告

  
    

异常类型:EXC_BAD_ACCESS(SIGSEGV)异常子类型:KERN_INVALID_ADDRESS位于0x5000000000000038终止信号:     分段故障:11终止原因:命名空间SIGNAL,代码0xb     终止进程:exc handler [0]由​​Thread:9

触发   
     

已过滤的系统日志:未找到

     

线程0名称:调度队列:com.apple.main-thread线程0:0
  libsystem_kernel.dylib 0x000000018f58816c mach_msg_trap + 8 1   libsystem_kernel.dylib 0x000000018f587fdc mach_msg + 72 2
  CoreFoundation 0x0000000190585cec   __CFRunLoopServiceMachPort + 192 3 CoreFoundation 0x0000000190583908 __CFRunLoopRun + 1132 4 CoreFoundation
    0x00000001904b2048 CFRunLoopRunSpecific + 444 5图形服务
    0x0000000191f35198 GSEventRunModal + 180 6 UIKit
    0x000000019648b818 - [UIApplication _run] + 684 7 UIKit
    0x0000000196486550 UIApplicationMain + 208 8 Shukran
    0x0000000100080a1c 0x10007c000 + 18972 9 libdyld.dylib
    0x000000018f4945b8 start + 4

     

线程1名称:com.apple.uikit.eventfetch-thread线程1:0
  libsystem_kernel.dylib 0x000000018f58816c mach_msg_trap + 8 1   libsystem_kernel.dylib 0x000000018f587fdc mach_msg + 72 2
  CoreFoundation 0x0000000190585cec    CFRunLoopServiceMachPort + 192 3 CoreFoundation 0x0000000190583908 __CFRunLoopRun + 1132 4 CoreFoundation
    0x00000001904b2048 CFRunLoopRunSpecific + 444 5基金会     0x0000000190fc0b1c - [NSRunLoop(NSRunLoop)runMode:beforeDate:] + 304   6基金会0x0000000190fe160c    - [NSRunLoop(NSRunLoop)runUntilDate:] + 96 7 UIKit 0x0000000196e00e6c - [UIEventFetcher threadMain] + 136 8 Foundation     0x00000001910be50c __NSThread__start
+ 1024 9
  libsystem_pthread.dylib 0x000000018f66b860 _pthread_body + 240   10 libsystem_pthread.dylib 0x000000018f66b770 _pthread_body +   0 11 libsystem_pthread.dylib 0x000000018f668dbc thread_start +   4

     

线程2名称:AVAudioSession通知线程线程2:0
  libsystem_kernel.dylib 0x000000018f58816c mach_msg_trap + 8 1   libsystem_kernel.dylib 0x000000018f587fdc mach_msg + 72 2
  CoreFoundation 0x0000000190585cec   __CFRunLoopServiceMachPort + 192 3 CoreFoundation 0x0000000190583908 __CFRunLoopRun + 1132 4 CoreFoundation
    0x00000001904b2048 CFRunLoopRunSpecific + 444 5 AVFAudio
    0x00000001a9baafe8 GenericRunLoopThread :: Entry(void *)+ 164 6
  AVFAudio 0x00000001a9bd0f14   CAPThread :: Entry(CAPThread *)+ 84 7 libsystem_pthread.dylib
    0x000000018f66b860 _pthread_body + 240 8 libsystem_pthread.dylib
    0x000000018f66b770 _pthread_body + 0 9 libsystem_pthread.dylib
    0x000000018f668dbc thread_start + 4

     

线程3名称:com.apple.NSURLConnectionLoader线程3:0
  libsystem_kernel.dylib 0x000000018f58816c mach_msg_trap + 8 1   libsystem_kernel.dylib 0x000000018f587fdc mach_msg + 72 2
  CoreFoundation 0x0000000190585cec    CFRunLoopServiceMachPort + 192 3 CoreFoundation 0x0000000190583908 __CFRunLoopRun + 1132 4 CoreFoundation
    0x00000001904b2048 CFRunLoopRunSpecific + 444 5 CFNetwork
    0x0000000190c9fcec + [NSURLConnection(Loader)_resourceLoadLoop:] +   336 6基金会0x00000001910be50c   __NSThread__start
+ 1024 7 libsystem_pthread.dylib 0x000000018f66b860 _pthread_body + 240 8 libsystem_pthread.dylib
    0x000000018f66b770 _pthread_body + 0 9 libsystem_pthread.dylib
    0x000000018f668dbc thread_start + 4

     

线程4:0 libsystem_pthread.dylib 0x000000018f668db0   start_wqthread + 0

     

线程5:0 libsystem_kernel.dylib 0x000000018f5a6a88   __workq_kernreturn + 8 1 libsystem_pthread.dylib 0x000000018f669188 _pthread_wqthread + 968 2
  libsystem_pthread.dylib 0x000000018f668db4 start_wqthread + 4

     

线程6:0 libsystem_pthread.dylib 0x000000018f668db0   start_wqthread + 0

     

线程7:0 libsystem_kernel.dylib 0x000000018f5a5e1c   __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x000000018f66a9d0 _pthread_cond_wait + 640 2 Shukran
    0x000000010030009c 0x10007c000 + 2637980 3 libsystem_pthread.dylib     0x000000018f66b860 _pthread_body + 240 4 libsystem_pthread.dylib
    0x000000018f66b770 _pthread_body + 0 5 libsystem_pthread.dylib
    0x000000018f668dbc thread_start + 4

     

线程8:0 libsystem_kernel.dylib 0x000000018f5a623c   __select + 8 1 Shukran 0x00000001003004d0 0x10007c000 + 2639056 2 libsystem_pthread.dylib
    0x000000018f66b860 _pthread_body + 240 3 libsystem_pthread.dylib
    0x000000018f66b770 _pthread_body + 0 4 libsystem_pthread.dylib
    0x000000018f668dbc thread_start + 4

     

线程9名称:VoiceProcessThread线程9崩溃:0 Shukran
    0x00000001001956ac 0x10007c000 + 1152684 1 Shukran
    0x000000010019569c 0x10007c000 + 1152668 2 Shukran
    0x0000000100168688 0x10007c000 + 968328 3 Shukran
    0x0000000100191020 0x10007c000 + 1134624 4 Shukran
    0x000000010033b1bc 0x10007c000 + 2879932 5 Shukran
    0x00000001002d906c 0x10007c000 + 2478188 6 Shukran
    0x00000001002d8670 0x10007c000 + 2475632 7 Shukran
    0x00000001002ca330 0x10007c000 + 2417456 8 Shukran
    0x00000001004293f0 0x10007c000 + 3855344 9 Shukran
    0x00000001002fb010 0x10007c000 + 2617360 10 Shukran
    0x00000001002faf94 0x10007c000 + 2617236 11 libsystem_pthread.dylib     0x000000018f66b860 _pthread_body + 240 12 libsystem_pthread.dylib
    0x000000018f66b770 _pthread_body + 0 13 libsystem_pthread.dylib
    0x000000018f668dbc thread_start + 4

     

线程10名称:PacerThread线程10:0 libsystem_kernel.dylib
    0x000000018f5a5e1c __psynch_cvwait + 8 1 libsystem_pthread.dylib
    0x000000018f66a9d0 _pthread_cond_wait + 640 2 Shukran
    0x000000010028548c 0x10007c000 + 2135180 3 Shukran
    0x00000001002f7544 0x10007c000 + 2602308 4 Shukran
    0x00000001004294f0 0x10007c000 + 3855600 5 Shukran
    0x00000001002fb010 0x10007c000 + 2617360 6 Shukran
    0x00000001002faf94 0x10007c000 + 2617236 7 libsystem_pthread.dylib     0x000000018f66b860 _pthread_body + 240 8 libsystem_pthread.dylib
    0x000000018f66b770 _pthread_body + 0 9 libsystem_pthread.dylib
    0x000000018f668dbc thread_start + 4

     

线程11名称:ModuleProcessThread线程11:0
  libsystem_kernel.dylib 0x000000018f5a5e1c __psynch_cvwait + 8   1 libsystem_pthread.dylib 0x000000018f66a9d0   _pthread_cond_wait + 640 2 Shukran 0x000000010028548c 0x10007c000 + 2135180 3 Shukran
    0x00000001002f7544 0x10007c000 + 2602308 4 Shukran
    0x00000001004294f0 0x10007c000 + 3855600 5 Shukran
    0x00000001002fb010 0x10007c000 + 2617360 6 Shukran
    0x00000001002faf94 0x10007c000 + 2617236 7 libsystem_pthread.dylib     0x000000018f66b860 _pthread_body + 240 8 libsystem_pthread.dylib
    0x000000018f66b770 _pthread_body + 0 9 libsystem_pthread.dylib
    0x000000018f668dbc thread_start + 4

     

线程9与ARM线程状态(64位)崩溃:       x0:0x000000010303c100 x1:0x0000000000000000 x2:0x0000000000000000 x3:0x00000001024694e8       x4:0x0000000000000000 x5:0x0000000000000010 x6:0x0000000000000002 x7:0x000000016e54a45c       x8:0x5000000000000000 x9:0x0000000000000000 x10:0x000000016e54b818 x11:0x0000000000000000 x12:0x03e0fe0003e0fe00   x13:0x000000018f66b770 x14:0x000000018f668dbc x15:   0x0000000000000010 x16:0x000000018f669ab8 x17:0x0000000000000001   x18:0x0000000000000000 x19:0x0000000000000004 x20:   0x0000000104082e00 x21:0x00000001702a42c0 x22:0x000000016e54a278   x23:0x00000001702a42e8 x24:0x000000016e54a240 x25:   0x00000001702a42c8 x26:0x00000001702a42e0 x27:0xd96031967698005a
  x28:0x0000000000000000 fp:0x000000016e54a1f0 lr:   0x000000010019569c       sp:0x000000016e549b10 pc:0x00000001001956ac cpsr:0x60000000

1 个答案:

答案 0 :(得分:0)

请检查您的iceServer是否正常运行,我使用了以下iceServers并解决了崩溃问题。或者您可以构建自己的STUN server。这可能是你遇到崩溃的原因之一。

let iceServer1:RTCICEServer = RTCICEServer.init(uri: URL.init(string: "stun:stun.l.google.com:19302"), username: "", password: "")

OR

let iceServer2:RTCICEServer = RTCICEServer.init(uri: URL.init(string: "turn:numb.viagenie.ca"), username: "webrtc@live.com", password: "muazkh")