ios - 冰候选人代理方法调用时崩溃

标签 ios swift webrtc

enter image description here
请帮助什么问题。

webrtc库调用某些内部方法并获得了extra_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)异常子类型:在0x5000000000000038终止信号处的KERN_INVALID_ADDRESS
    分段错误:11终止原因:命名空间SIGNAL,代码0xb
    终止过程:异常处理程序[0]由线程触发: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 GraphicsServices
    0x0000000191f35198 GSEventRunModal + 180 6 UIKit
    0x000000019648b818-[UIApplication _run] + 684 7 UIKit
    0x0000000196486550 UIApplicationMain + 208 8 Shukran
    0x0000000100080a1c 0x10007c000 + 18972 9 libdyld.dylib
    0x000000018f4945b8开始+ 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
  AVF音频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舒克兰
    0x0000000100168688 0x10007c000 + 968328 3舒克兰
    0x0000000100191020 0x10007c000 + 1134624 4 Shukran
    0x000000010033b1bc 0x10007c000 + 2879932 5 Shukran
    0x00000001002d906c 0x10007c000 + 2478188 6舒克兰
    0x00000001002d8670 0x10007c000 + 2475632 7舒克兰
    0x00000001002ca330 0x10007c000 + 2417456 8 Shukran
    0x00000001004293f0 0x10007c000 + 3855344 9舒克兰
    0x00000001002fb010 0x10007c000 + 2617360 10舒克兰
    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舒克兰
    0x00000001002f7544 0x10007c000 + 2602308 4舒克兰
    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舒克兰
    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

最佳答案

请检查您的iceServer是否运行正常,我已经使用了iceServers并解决了崩溃问题。或者,您可以构建自己的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")

关于ios - 冰候选人代理方法调用时崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39849479/

相关文章:

php - (Swift,iOS)根据 PHP 脚本中使用的 POST 变量从 mySQL 数据库解析 JSON 对象?

ios - 请求非结构或联合中的成员 'subview'?

android - react-native-navigation 如何关闭应用通知

ios - 单击 Swift 后如何更改 UIButton 图像?

node.js - 为什么 webrtc blob 地址位于信令服务器上?

javascript - 无法使用 Electron 运行屏幕共享 chrome 应用程序

node.js - Webrtc 服务器-客户端

ios - 我已将 Widgetkit 添加到我的应用程序中,但现在当应用程序在 Xcode 12 beta 上启动时在 iOS 13 上崩溃

ios - 无法从 NSObject 类访问静态变量,但我可以从 UIViewController

ios - 如何将 NSURL json 信息转换为字符串?