Android Webrtc JNI 错误(应用错误):本地引用 table 溢出(最大=512)

Android Webrtc JNI ERROR (app bug): local reference table overflow (max=512)

我在尝试通过

建立 webrtc 连接时遇到了问题 运行
PeerConnectionFactory.createPeerConnection(params.iceServers,
                params.pcConstraints, PeerConnection.Observer())

这是我要发送的限制条件:

MediaConstraints pcConstraints = new MediaConstraints();
        pcConstraints.optional.add(new MediaConstraints.KeyValuePair("DtlsSrtpKeyAgreement", "true"));
        pcConstraints.mandatory.add(new MediaConstraints.KeyValuePair("OfferToReceiveAudio", "true"));
        pcConstraints.mandatory.add(new MediaConstraints.KeyValuePair("OfferToReceiveVideo", "true"));

这里是错误:

01-22 00:04:45.327 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115] JNI ERROR (app bug): local reference table overflow (max=512)
01-22 00:04:45.327 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115] local reference table dump:
01-22 00:04:45.327 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]   Last 10 entries (of 512):
01-22 00:04:45.327 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]       511: 0x12f5b280 org.webrtc.MediaConstraints$KeyValuePair
01-22 00:04:45.327 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]       510: 0x12f5b670 byte[] (4 elements)
01-22 00:04:45.327 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]       509: 0x12f72610 java.lang.String "ISO-8859-1"
01-22 00:04:45.327 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]       508: 0x71029af0 java.lang.Class<java.lang.String>
01-22 00:04:45.327 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]       507: 0x12f62580 byte[] (19 elements)
01-22 00:04:45.327 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]       506: 0x12f725e0 java.lang.String "ISO-8859-1"
01-22 00:04:45.327 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]       505: 0x71029af0 java.lang.Class<java.lang.String>
01-22 00:04:45.327 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]       504: 0x70d0b170 java.lang.String "true"
01-22 00:04:45.327 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]       503: 0x12ead680 java.lang.Class<org.webrtc.MediaConstraints$KeyValuePair>
01-22 00:04:45.327 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]       502: 0x12ef6b80 java.lang.String "OfferToReceiveVi... (19 chars)
01-22 00:04:45.327 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]   Summary:
01-22 00:04:45.327 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]         1 of org.webrtc.PeerConnection$BundlePolicy
01-22 00:04:45.327 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]         1 of org.webrtc.PeerConnection$ContinualGatheringPolicy
01-22 00:04:45.327 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]         1 of org.webrtc.PeerConnection$RtcpMuxPolicy
01-22 00:04:45.327 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]         1 of org.webrtc.PeerConnection$IceTransportsType
01-22 00:04:45.327 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]         1 of org.webrtc.PeerConnection$TcpCandidatePolicy
01-22 00:04:45.327 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]        23 of org.webrtc.PeerConnection$TlsCertPolicy (1 unique instances)
01-22 00:04:45.327 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]         1 of org.webrtc.PeerConnection$CandidateNetworkPolicy
01-22 00:04:45.327 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]         1 of org.webrtc.PeerConnection$KeyType
01-22 00:04:45.327 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]         3 of org.webrtc.MediaConstraints$KeyValuePair (3 unique instances)
01-22 00:04:45.327 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]        23 of org.webrtc.PeerConnection$IceServer (23 unique instances)
01-22 00:04:45.327 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]       139 of java.lang.Class (10 unique instances)
01-22 00:04:45.327 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]         1 of java.lang.String[] (3 elements)
01-22 00:04:45.327 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]       209 of java.lang.String (143 unique instances)
01-22 00:04:45.328 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]         1 of java.util.ArrayList$ArrayListIterator
01-22 00:04:45.328 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]         1 of java.util.ArrayList
01-22 00:04:45.328 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]         1 of java.util.LinkedList$LinkIterator
01-22 00:04:45.328 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]         1 of java.util.LinkedList
01-22 00:04:45.328 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]        42 of byte[] (42 unique instances)
01-22 00:04:45.328 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]         2 of byte[] (3 elements) (2 unique instances)
01-22 00:04:45.328 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]         1 of byte[] (4 elements)
01-22 00:04:45.328 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]         4 of byte[] (5 elements) (4 unique instances)
01-22 00:04:45.328 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]         2 of byte[] (6 elements) (2 unique instances)
01-22 00:04:45.328 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]         2 of byte[] (7 elements) (2 unique instances)
01-22 00:04:45.328 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]         1 of byte[] (8 elements)
01-22 00:04:45.328 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]         1 of byte[] (11 elements)
01-22 00:04:45.328 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]         2 of byte[] (18 elements) (2 unique instances)
01-22 00:04:45.328 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]         5 of byte[] (19 elements) (5 unique instances)
01-22 00:04:45.328 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]         2 of byte[] (20 elements) (2 unique instances)
01-22 00:04:45.328 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]         1 of byte[] (21 elements)
01-22 00:04:45.328 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]        24 of byte[] (22 elements) (24 unique instances)
01-22 00:04:45.328 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]         4 of byte[] (23 elements) (4 unique instances)
01-22 00:04:45.328 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]         3 of byte[] (24 elements) (3 unique instances)
01-22 00:04:45.328 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]         1 of byte[] (28 elements)
01-22 00:04:45.328 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]         4 of byte[] (29 elements) (4 unique instances)
01-22 00:04:45.328 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]         1 of byte[] (30 elements)
01-22 00:04:45.328 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115]         1 of byte[] (43 elements)
01-22 00:04:45.328 22396-22396/co..webrtcpoc1 A/art: art/runtime/indirect_reference_table.cc:115] 
01-22 00:04:45.419 1097-1097/? D/wpa_supplicant: wlan0: Control interface command 'SIGNAL_POLL'
01-22 00:04:45.423 1097-1097/? D/wpa_supplicant: CTRL-DEBUG: global_ctrl_sock-sendto: sock=11 sndbuf=163840 outq=0 send_len=48
01-22 00:04:45.970 22396-22396/co..webrtcpoc1 A/art: art/runtime/barrier.cc:90] Check failed: count_ == 0 (count_=-1, 0=0) Attempted to destroy barrier with non zero count
01-22 00:04:45.971 22396-22396/co..webrtcpoc1 A/art: art/runtime/runtime.cc:366] Runtime aborting --- recursively, so no thread-specific detail!
01-22 00:04:45.971 22396-22396/co..webrtcpoc1 A/art: art/runtime/runtime.cc:366] 

                                                            --------- beginning of crash
01-22 00:04:45.971 22396-22396/co..webrtcpoc1 A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 22396 (moto.webrtcpoc1)
01-22 00:04:46.027 306-306/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-22 00:04:46.027 306-306/? A/DEBUG: Build fingerprint: 'Lenovo/YT3-850F/YT3-850F:6.0.1/MMB29M/YT3-850F_USR_S109_161226_Q1241_ROW:user/release-keys'
01-22 00:04:46.027 306-306/? A/DEBUG: Revision: '0'
01-22 00:04:46.028 306-306/? A/DEBUG: ABI: 'arm'
01-22 00:04:46.028 306-306/? A/DEBUG: pid: 22396, tid: 22396, name: moto.webrtcpoc1  >>> co..webrtcpoc1 <<<
01-22 00:04:46.029 306-306/? A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
01-22 00:04:46.067 306-306/? A/DEBUG: Abort message: 'art/runtime/indirect_reference_table.cc:115] JNI ERROR (app bug): local reference table overflow (max=512)'
01-22 00:04:46.067 306-306/? A/DEBUG:     r0 00000000  r1 0000577c  r2 00000006  r3 b6ff3b7c
01-22 00:04:46.067 306-306/? A/DEBUG:     r4 b6ff3b84  r5 b6ff3b34  r6 00000000  r7 0000010c
01-22 00:04:46.068 306-306/? A/DEBUG:     r8 b4cfd800  r9 b4cfbe44  sl b7741fbb  fp b4ce1708
01-22 00:04:46.068 306-306/? A/DEBUG:     ip 00000006  sp be9c55e0  lr b6d70d85  pc b6d73174  cpsr 40070010
01-22 00:04:46.114 306-306/? A/DEBUG: backtrace:
01-22 00:04:46.114 306-306/? A/DEBUG:     #00 pc 00044174  /system/lib/libc.so (tgkill+12)
01-22 00:04:46.115 306-306/? A/DEBUG:     #01 pc 00041d81  /system/lib/libc.so (pthread_kill+32)
01-22 00:04:46.115 306-306/? A/DEBUG:     #02 pc 0001ba2f  /system/lib/libc.so (raise+10)
01-22 00:04:46.115 306-306/? A/DEBUG:     #03 pc 00018be1  /system/lib/libc.so (__libc_android_abort+34)
01-22 00:04:46.115 306-306/? A/DEBUG:     #04 pc 000167a8  /system/lib/libc.so (abort+4)
01-22 00:04:46.115 306-306/? A/DEBUG:     #05 pc 0031f421  /system/lib/libart.so (_ZN3art7Runtime5AbortEv+212)
01-22 00:04:46.116 306-306/? A/DEBUG:     #06 pc 000f39d9  /system/lib/libart.so (_ZN3art10LogMessageD2Ev+2092)
01-22 00:04:46.116 306-306/? A/DEBUG:     #07 pc 000f0207  /system/lib/libart.so (_ZN3art7BarrierD2Ev+182)
01-22 00:04:46.116 306-306/? A/DEBUG:     #08 pc 00345961  /system/lib/libart.so (_ZN3art10ThreadList4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+144)
01-22 00:04:46.116 306-306/? A/DEBUG:     #09 pc 0031f4dd  /system/lib/libart.so (_ZN3art7Runtime5AbortEv+400)
01-22 00:04:46.116 306-306/? A/DEBUG:     #10 pc 000f39d9  /system/lib/libart.so (_ZN3art10LogMessageD2Ev+2092)
01-22 00:04:46.116 306-306/? A/DEBUG:     #11 pc 001d399f  /system/lib/libart.so (_ZN3art22IndirectReferenceTable3AddEjPNS_6mirror6ObjectE+226)
01-22 00:04:46.117 306-306/? A/DEBUG:     #12 pc 00271bc5  /system/lib/libart.so (_ZN3art3JNI14GetObjectClassEP7_JNIEnvP8_jobject+324)
01-22 00:04:46.117 306-306/? A/DEBUG:     #13 pc 0010726d  /system/lib/libart.so (_ZN3art8CheckJNI14GetObjectClassEP7_JNIEnvP8_jobject+376)
01-22 00:04:46.117 306-306/? A/DEBUG:     #14 pc 000adbe9  /data/app/co..webrtcpoc1-2/lib/arm/libjingle_peerconnection_so.so
01-22 00:04:46.117 306-306/? A/DEBUG:     #15 pc 000b607d  /data/app/co..webrtcpoc1-2/lib/arm/libjingle_peerconnection_so.so
01-22 00:04:46.117 306-306/? A/DEBUG:     #16 pc 000b6309  /data/app/co..webrtcpoc1-2/lib/arm/libjingle_peerconnection_so.so
01-22 00:04:46.117 306-306/? A/DEBUG:     #17 pc 000bb9ad  /data/app/co..webrtcpoc1-2/lib/arm/libjingle_peerconnection_so.so (Java_org_webrtc_PeerConnectionFactory_nativeCreatePeerConnection+524)
01-22 00:04:46.117 306-306/? A/DEBUG:     #18 pc 005b96f3  /data/app/co..webrtcpoc1-2/oat/arm/base.odex (offset 0x3d5000) (long org.webrtc.PeerConnectionFactory.nativeCreatePeerConnection(long, org.webrtc.PeerConnection$RTCConfiguration, org.webrtc.MediaConstraints, long)+158)
01-22 00:04:46.118 306-306/? A/DEBUG:     #19 pc 005bac85  /data/app/co..webrtcpoc1-2/oat/arm/base.odex (offset 0x3d5000) (org.webrtc.PeerConnection org.webrtc.PeerConnectionFactory.createPeerConnection(org.webrtc.PeerConnection$RTCConfiguration, org.webrtc.MediaConstraints, org.webrtc.PeerConnection$Observer)+248)
01-22 00:04:46.118 306-306/? A/DEBUG:     #20 pc 005bab57  /data/app/co..webrtcpoc1-2/oat/arm/base.odex (offset 0x3d5000) (org.webrtc.PeerConnection org.webrtc.PeerConnectionFactory.createPeerConnection(java.util.List, org.webrtc.MediaConstraints, org.webrtc.PeerConnection$Observer)+114)
01-22 00:04:46.118 306-306/? A/DEBUG:     #21 pc 00577753  /data/app/co..webrtcpoc1-2/oat/arm/base.odex (offset 0x3d5000) (void co..webrtcpoc1.VideoChatActivity.(java.lang.String)+358)
01-22 00:04:46.118 306-306/? A/DEBUG:     #22 pc 00578403  /data/app/co..webrtcpoc1-2/oat/arm/base.odex (offset 0x3d5000) (void co..webrtcpoc1.VideoChatActivity.onCreate(android.os.Bundle)+1166)
01-22 00:04:46.118 306-306/? A/DEBUG:     #23 pc 0265258d  /system/framework/arm/boot.oat (offset 0x1efd000)

通过将传入的 Ice Server 数量从 24 减少到 5 来修复它。