首页 文章

冰候选委托方法调用时出现崩溃

提问于
浏览
0

enter image description here
Please help what is the issue.???

webrtc库调用一些内部方法并获取excess_bad . 然后坠毁了

如果需要,请提出更多信息 .

//code

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)

I am getting sip here.

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

getting crash when this delegate called.

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

Crash Report

异常类型:EXC_BAD_ACCESS(SIGSEGV)异常子类型:KERN_INVALID_ADDRESS位于0x5000000000000038终止信号:分段错误:11终止原因:命名空间SIGNAL,代码0xb终止进程:exc处理程序[0]由线程触发:9已过滤的syslog:未找到线程0名称:调度队列:com.apple.main线程线程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个GraphicsServices 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基金会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 Core基础0x0000000190583908 __CFRunLoopRun 1132 4的CoreFoundation 0x00000001904b2048 CFRunLoopRunSpecific 444 5 AVFAudio 0x00000001a9baafe8 GenericRunLoopThread ::条目(无效*)164 6 AVFAudio 0x00000001a9bd0f14 CAPThread ::条目(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_b ODY 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 li bsystem_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 0x10007 C000 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 0 x000000018f668dbc 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

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

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

    要么

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

相关问题