WebRTC PeerConnection在setLocalDescription()上崩溃

时间:2019-05-22 23:01:16

标签: android kotlin webrtc

我正在尝试使用PeerConnection启动“呼叫”。我首先创建一个要约,然后传递一个回调,该回调在setLocalDescription()上调用PeerConnection。但是,这会使应用程序崩溃,并具有null异常。这是堆栈跟踪

2019-05-23 00:10:23.583 13684-14658/me.amryousef.homedoor A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x6c in tid 14658 (worker_thread -)
2019-05-23 00:10:23.628 538-4027/? E/QCamera: <HAL><ERROR> processCaptureRequest: 4865: Did not find matching stream to update index
2019-05-23 00:10:23.649 14736-14736/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2019-05-23 00:10:23.649 14736-14736/? A/DEBUG: Build fingerprint: 'OnePlus/OnePlus3/OnePlus3:8.0.0/OPR1.170623.032/47:user/release-keys'
2019-05-23 00:10:23.649 14736-14736/? A/DEBUG: Revision: '0'
2019-05-23 00:10:23.649 14736-14736/? A/DEBUG: ABI: 'arm64'
2019-05-23 00:10:23.649 14736-14736/? A/DEBUG: pid: 13684, tid: 14658, name: worker_thread -  >>> me.amryousef.homedoor <<<
2019-05-23 00:10:23.649 14736-14736/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x6c
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x6c
2019-05-22 23:46:39.120 13650-13650/? A/DEBUG: Cause: null pointer dereference
2019-05-22 23:46:39.120 13650-13650/? A/DEBUG:     x0   000000749d387ff0  x1   000000749d388008  x2   000000749a400000  x3   0000000000000003
2019-05-22 23:46:39.120 13650-13650/? A/DEBUG:     x4   0000000000000141  x5   8000000000000000  x6   ff63646a6e756471  x7   7f7f7f7f7f7f7f7f
2019-05-22 23:46:39.120 13650-13650/? A/DEBUG:     x8   0000000000000000  x9   91cee4b1723ef4f4  x10  0000000000000000  x11  000000749d388008
2019-05-22 23:46:39.120 13650-13650/? A/DEBUG:     x12  00000000ffffffff  x13  00000000ffffff80  x14  000000000000000d  x15  aaaaaaaaaaaaaaab
2019-05-22 23:46:39.120 13650-13650/? A/DEBUG:     x16  00000074bcf32cb0  x17  00000074bced0f2c  x18  000000749d3861ec  x19  000000749cc54000
2019-05-22 23:46:39.120 13650-13650/? A/DEBUG:     x20  0000000000000000  x21  000000749b816998  x22  000000749cc54200  x23  0000000000000000
2019-05-22 23:46:39.120 13650-13650/? A/DEBUG:     x24  0000000000000000  x25  000000749b816454  x26  000000749cc540f0  x27  000000749d593dd1
2019-05-22 23:46:39.120 13650-13650/? A/DEBUG:     x28  000000000022308b  x29  000000749d388060  x30  000000749da066e4
2019-05-22 23:46:39.120 13650-13650/? A/DEBUG:     sp   000000749d387ff0  pc   000000749da066e8  pstate 0000000060000000

PeerConnection处理的完整实现可以在此gist

中找到

null pointer dereference的原因是什么?创建offer的过程中缺少什么?


这是我建立PeerConnection的方式

peerConnectionFactory = PeerConnectionFactory
            .builder()
            .createPeerConnectionFactory()

我正在使用以下版本

"org.webrtc:google-webrtc:1.0.27771"

2 个答案:

答案 0 :(得分:0)

我认为这是google-webrtc版本问题。但我不知道为什么。您不应使用“ org.webrtc:google-webrtc:1.0。+”。您可以尝试使用适当的版本,例如'org.webrtc:google-webrtc:1.0.24277'

'org.webrtc:google-webrtc:1.0。+'使用版本1.0.28032-0,并且将无法设置LocalDescription(sdp没有VP8信息)

答案 1 :(得分:0)

问题是我没有设置任何视频编解码器(编码/解码器)工厂。根据{{​​3}},这在某些时候成为必需。

解决方法是像这样构建PeerConnection

peerConnectionFactory = PeerConnectionFactory
            .builder()
            .setVideoDecoderFactory(DefaultVideoDecoderFactory(rootEglBase.eglBaseContext))
            .setVideoEncoderFactory(DefaultVideoEncoderFactory(rootEglBase.eglBaseContext, true, true))
            .createPeerConnectionFactory()