【问题标题】:Android WebRTC SIGSEGV in nativeAddLocalStreamNativeAddLocalStream 中的 Android WebRTC SIGSEGV
【发布时间】:2018-04-10 13:52:18
【问题描述】:

我尝试构建一个 Android WebRTC 应用程序。目前我收到此错误:

04-10 15:40:13.082 10122-10122/? A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 10122 (...), pid 10122 (...)

我不知道为什么。奇怪的是,我真的不能说它何时以及为什么开始,因为该应用程序之前运行完美无瑕。

我试图找到错误并在一些调试的帮助下发现错误源于

    MediaStream stream = peerConnectionFactory.createLocalMediaStream("102");
    stream.addTrack(localAudioTrack);
    stream.addTrack(localVideoTrack);
    localPeer.addStream(stream);

localPeer 是我的本地 PeerConnection。

有人知道如何解决这个问题吗?

整个堆栈跟踪是:

04-10 15:40:13.139 10208-10208/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    Build fingerprint: 'google/bullhead/bullhead:8.1.0/OPM3.171019.016/4565142:user/release-keys'
    Revision: 'rev_1.0'
    ABI: 'arm64'
    pid: 10122, tid: 10122, name: emoteassistance  >>> dropslab.bruno.remoteassistance <<<
    signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
    Cause: null pointer dereference
        x0   0000000000000000  x1   0000007ff93b1010  x2   0000000000000000  x3   00000078166e217a
        x4   0000007ff93b0ff0  x5   0000007800bb6465  x6   0000000000000002  x7   0000007ff93b0fb0
        x8   569406812e3f47b7  x9   569406812e3f47b7  x10  0000000000430000  x11  00000078167a07a8
        x12  0000000000000008  x13  0000007ff93b059c  x14  00000078166bab20  x15  0000000000000000
        x16  0000000000000000  x17  0000007ff93b059c  x18  0000000013077e48  x19  00000077ff236df0
        x20  0000000000000000  x21  00000078168bea00  x22  0000007ff93b153c  x23  0000007800bf892b
        x24  000000000000000c  x25  000000789b444a40  x26  00000078168beaa0  x27  0000000000000003
        x28  0000007ff93b1270  x29  0000007ff93b1240  x30  00000077fd4c443c
        sp   0000007ff93b1230  pc   00000077fd4c443c  pstate 0000000060000000
04-10 15:40:13.142 3253-10222/? E/mm-camera-img: module_imglib_start_session:1778 ###Img_Loglevel 1
04-10 15:40:13.145 3253-10219/? E/mm-camera: q3a_port_init:1753  q3a_port_init: 3A VERSION --> 4.1.0.r9
04-10 15:40:13.146 3253-10217/? E/mm-camera-isp2: isp_module_start_session:360 num_session_opened 1
04-10 15:40:13.160 3253-10232/? E/libaprpmem:  Ion allocation success virtaddr : ret=3951620096 fd=38 heapid=33554432
04-10 15:40:13.163 3253-10232/? E/libaprpmem:  Ion allocation success virtaddr : ret=3947651072 fd=41 heapid=33554432
04-10 15:40:13.166 3253-10232/? E/libaprpmem:  Ion allocation success virtaddr : ret=3939713024 fd=42 heapid=33554432
04-10 15:40:13.168 10208-10208/? A/DEBUG: backtrace:
        #00 pc 00000000005bf43c  /data/app/dropslab.bruno.remoteassistance-AB_bvseEj1CPHtgYD8nSiw==/lib/arm64/libjingle_peerconnection_so.so (offset 0x21b000) (Java_org_webrtc_PeerConnection_nativeAddLocalStream+28)
        #01 pc 0000000000553bf0  /system/lib64/libart.so (art_quick_generic_jni_trampoline+144)
        #02 pc 000000000054ab88  /system/lib64/libart.so (art_quick_invoke_stub+584)
        #03 pc 00000000000dc594  /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+204)
        #04 pc 000000000029b49c  /system/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+344)
        #05 pc 0000000000295a90  /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+700)
        #06 pc 0000000000533d68  /system/lib64/libart.so (MterpInvokeDirect+356)
        #07 pc 000000000053ca14  /system/lib64/libart.so (ExecuteMterpImpl+14484)
        #08 pc 0000000000275c00  /system/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool)+444)
        #09 pc 000000000027b7cc  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame*, art::JValue*)+216)
        #10 pc 0000000000295a70  /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+668)
        #11 pc 0000000000532ad8  /system/lib64/libart.so (MterpInvokeVirtual+652)
        #12 pc 000000000053c914  /system/lib64/libart.so (ExecuteMterpImpl+14228)
        #13 pc 0000000000275c00  /system/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool)+444)
        #14 pc 000000000027b7cc  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame*, art::JValue*)+216)
        #15 pc 0000000000295a70  /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+668)
        #16 pc 0000000000533d68  /system/lib64/libart.so (MterpInvokeDirect+356)
        #17 pc 000000000053ca14  /system/lib64/libart.so (ExecuteMterpImpl+14484)
        #18 pc 0000000000275c00  /system/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool)+444)
        #19 pc 000000000027b7cc  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame*, art::JValue*)+216)
        #20 pc 0000000000295a70  /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+668)
        #21 pc 0000000000533d68  /system/lib64/libart.so (MterpInvokeDirect+356)
        #22 pc 000000000053ca14  /system/lib64/libart.so (ExecuteMterpImpl+14484)
        #23 pc 0000000000275c00  /system/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool)+444)
        #24 pc 000000000027b7cc  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame*, art::JValue*)+216)
        #25 pc 0000000000295a70  /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+668)
        #26 pc 0000000000532ad8  /system/lib64/libart.so (MterpInvokeVirtual+652)
        #27 pc 000000000053c914  /system/lib64/libart.so (ExecuteMterpImpl+14228)
        #28 pc 0000000000275c00  /system/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool)+444)
        #29 pc 000000000027b7cc  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame*, art::JValue*)+216)
        #30 pc 0000000000295a70  /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+668)
        #31 pc 0000000000533ab8  /system/lib64/libart.so (MterpInvokeInterface+1576)
        #32 pc 000000000053cb14  /system/lib64/libart.so (ExecuteMterpImpl+14740)
        #33 pc 0000000000275c00  /system/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool)+444)
        #34 pc 000000000027b7cc  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame*, art::JValue*)+216)
        #35 pc 0000000000295a70  /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+668)
        #36 pc 0000000000532ad8  /system/lib64/libart.so (MterpInvokeVirtual+652)
        #37 pc 000000000053c914  /system/lib64/libart.so (ExecuteMterpImpl+14228)
        #38 pc 0000000000275c00  /system/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool)+444)
        #39 pc 000000000027b7cc  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame*, art::JValue*)+216)
04-10 15:40:13.169 10208-10208/? A/DEBUG:     #40 pc 0000000000295a70  /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+668)
        #41 pc 0000000000532ad8  /system/lib64/libart.so (MterpInvokeVirtual+652)
        #42 pc 000000000053c914  /system/lib64/libart.so (ExecuteMterpImpl+14228)
        #43 pc 0000000000275c00  /system/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool)+444)
        #44 pc 000000000027b7cc  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame*, art::JValue*)+216)
        #45 pc 0000000000295a70  /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+668)
        #46 pc 0000000000533d68  /system/lib64/libart.so (MterpInvokeDirect+356)
        #47 pc 000000000053ca14  /system/lib64/libart.so (ExecuteMterpImpl+14484)
        #48 pc 0000000000275c00  /system/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool)+444)
        #49 pc 000000000027b7cc  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame*, art::JValue*)+216)
        #50 pc 0000000000295a70  /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+668)
        #51 pc 0000000000532ad8  /system/lib64/libart.so (MterpInvokeVirtual+652)
        #52 pc 000000000053c914  /system/lib64/libart.so (ExecuteMterpImpl+14228)
        #53 pc 0000000000275c00  /system/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool)+444)
        #54 pc 000000000027b7cc  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame*, art::JValue*)+216)
        #55 pc 0000000000295a70  /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+668)
        #56 pc 0000000000532ad8  /system/lib64/libart.so (MterpInvokeVirtual+652)
        #57 pc 000000000053c914  /system/lib64/libart.so (ExecuteMterpImpl+14228)
        #58 pc 0000000000275c00  /system/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool)+444)
        #59 pc 000000000027b7cc  /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame*, art::JValue*)+216)
        #60 pc 0000000000295a70  /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+668)
        #61 pc 0000000000532ad8  /system/lib64/libart.so (MterpInvokeVirtual+652)
        #62 pc 000000000053c914  /system/lib64/libart.so (ExecuteMterpImpl+14228)
        #63 pc 0000000000275c00  /system/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool)+444)

【问题讨论】:

    标签: java android webrtc segmentation-fault


    【解决方案1】:

    你应该先检查native peerConnection是否初始化正确,因为奇怪的情况是not-null Java object PeerConnetion返回native peerConnection是否正确初始化。例如,如果你尝试使用最新的webrtc lib使用旧的 webrtc 提供的 stun/turn 服务器,就会出现这个问题。在这种情况下,当您尝试将任何内容(DataChannel、VideoTrack、AudioTrack 等)附加到 peerConnection 对象时,您将得到这个本机空指针。

    在使用之前检查您的 nativePeerConnection:

    if(0 == localPeer.getNativePeerConnection()) {
        Log.e("oops", "Illegal PeerConnection object. Something wrong in construction of native peerConnection.");
    }
    

    【讨论】:

    • 您应该从日志语句中删除脏话。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-02
    • 2016-11-29
    • 1970-01-01
    相关资源
    最近更新 更多