webrtc / apprtc

appr.tc has been shutdown. Please use the Dockerfile to run your own test/dev instance.
BSD 3-Clause "New" or "Revised" License
4.16k stars 1.37k forks source link

Android native app crash when using my apprtc instead of appr.tc link #619

Closed einsteinarbert closed 5 years ago

einsteinarbert commented 5 years ago

When I connect via chrome with my website run apprtc code, it work, but in android app it crash in lib C++, here is full logcat of Android (android app connect to appr.tc work in normal):

2019-04-07 02:34:10.527 8537-9389/org.appspot.apprtc D/de.tavendo.autobahn.WebSocketConnection: WebSocket connection created. 2019-04-07 02:34:10.528 8537-8537/org.appspot.apprtc D/ViewRootImpl@32bf41c[ConnectActivity]: Relayout returned: old=[0,0][720,1280] new=[0,0][720,1280] result=0x5 surface={valid=false 0} changed=true 2019-04-07 02:34:10.540 8537-8537/org.appspot.apprtc D/ViewRootImpl@ab0f806[CallActivity]: dispatchAttachedToWindow 2019-04-07 02:34:10.541 8537-8537/org.appspot.apprtc I/org.webrtc.Logging: SurfaceViewRenderer: fullscreen_video_view: onMeasure(). New size: 1279x677 2019-04-07 02:34:10.541 8537-8537/org.appspot.apprtc I/org.webrtc.Logging: SurfaceViewRenderer: pip_video_view: onMeasure(). New size: 1223x252 2019-04-07 02:34:10.567 8537-8537/org.appspot.apprtc D/ViewRootImpl@ab0f806[CallActivity]: Relayout returned: old=[0,0][0,0] new=[0,0][1280,720] result=0x7 surface={valid=true 3611250688} changed=true 2019-04-07 02:34:10.571 8537-8556/org.appspot.apprtc D/mali_winsys: EGLint new_window_surface(egl_winsys_display , void , EGLSurface, EGLConfig, egl_winsys_surface , egl_color_buffer_format , EGLBoolean) returns 0x3000, [1280x720]-format:1 2019-04-07 02:34:10.571 8537-8556/org.appspot.apprtc D/OpenGLRenderer: eglCreateWindowSurface = 0xde9a14e0 2019-04-07 02:34:10.572 8537-8537/org.appspot.apprtc I/org.webrtc.Logging: SurfaceViewRenderer: fullscreen_video_view: onMeasure(). New size: 1280x720 2019-04-07 02:34:10.573 8537-8537/org.appspot.apprtc I/org.webrtc.Logging: SurfaceViewRenderer: pip_video_view: onMeasure(). New size: 1224x252 2019-04-07 02:34:10.581 8537-8537/org.appspot.apprtc I/org.webrtc.Logging: EglRenderer: fullscreen_video_viewsetLayoutAspectRatio: 1.7777778 2019-04-07 02:34:10.582 8537-8537/org.appspot.apprtc I/org.webrtc.Logging: EglRenderer: pip_video_viewsetLayoutAspectRatio: 4.857143 2019-04-07 02:34:10.595 8537-8537/org.appspot.apprtc D/SurfaceView: BG show() Surface(name=Background for - SurfaceView - org.appspot.apprtc/org.appspot.apprtc.CallActivity@fca2d19@0) org.webrtc.SurfaceViewRenderer{fca2d19 VFE...C.. ......ID 0,0-1280,720 #7f07001d app:id/fullscreen_video_view} 2019-04-07 02:34:10.605 8537-8537/org.appspot.apprtc D/SurfaceView: surfaceCreated 2 org.webrtc.SurfaceViewRenderer{fca2d19 VFE...C.. ......ID 0,0-1280,720 #7f07001d app:id/fullscreen_video_view} 2019-04-07 02:34:10.606 8537-8537/org.appspot.apprtc D/SurfaceView: surfaceChanged (1280,720) 2 org.webrtc.SurfaceViewRenderer{fca2d19 VFE...C.. ......ID 0,0-1280,720 #7f07001d app:id/fullscreen_video_view} 2019-04-07 02:34:10.606 8537-8537/org.appspot.apprtc I/org.webrtc.Logging: SurfaceEglRenderer: fullscreen_video_view: surfaceChanged: format: 4 size: 1280x720 2019-04-07 02:34:10.607 8537-9388/org.appspot.apprtc D/mali_winsys: EGLint new_window_surface(egl_winsys_display , void *, EGLSurface, EGLConfig, egl_winsys_surface *, egl_color_buffer_format , EGLBoolean) returns 0x3000, [1280x720]-format:2 2019-04-07 02:34:10.612 8537-8537/org.appspot.apprtc D/SurfaceView: BG show() Surface(name=Background for - SurfaceView - org.appspot.apprtc/org.appspot.apprtc.CallActivity@bc781d5@0) org.webrtc.SurfaceViewRenderer{bc781d5 V.E...... ......ID 28,440-1252,692 #7f07002f app:id/pip_video_view} 2019-04-07 02:34:10.622 8537-8537/org.appspot.apprtc D/SurfaceView: surfaceCreated 2 org.webrtc.SurfaceViewRenderer{bc781d5 V.E...... ......ID 28,440-1252,692 #7f07002f app:id/pip_video_view} 2019-04-07 02:34:10.622 8537-8537/org.appspot.apprtc D/SurfaceView: surfaceChanged (1224,252) 2 org.webrtc.SurfaceViewRenderer{bc781d5 V.E...... ......ID 28,440-1252,692 #7f07002f app:id/pip_video_view} 2019-04-07 02:34:10.622 8537-8537/org.appspot.apprtc I/org.webrtc.Logging: SurfaceEglRenderer: pip_video_view: surfaceChanged: format: 4 size: 1224x252 2019-04-07 02:34:10.637 8537-8537/org.appspot.apprtc D/AppRTCAudioManager: WiredHeadsetReceiver.onReceive@[name=main, id=2]: a=android.intent.action.HEADSET_PLUG, s=unplugged, m=mic, n=null, sb=true 2019-04-07 02:34:10.637 8537-8537/org.appspot.apprtc D/AppRTCAudioManager: --- updateAudioDeviceState: wired headset=false, BT state=HEADSET_UNAVAILABLE 2019-04-07 02:34:10.638 8537-8537/org.appspot.apprtc D/AppRTCAudioManager: Device status: available=[EARPIECE, SPEAKER_PHONE], selected=EARPIECE, user selected=NONE 2019-04-07 02:34:10.638 8537-8537/org.appspot.apprtc D/AppRTCAudioManager: --- updateAudioDeviceState done 2019-04-07 02:34:10.639 8537-8537/org.appspot.apprtc D/CallRTCClient: Creating peer connection, delay=455ms 2019-04-07 02:34:10.654 8537-8537/org.appspot.apprtc D/CallRTCClient: Creating OFFER... 2019-04-07 02:34:10.654 8537-9391/org.appspot.apprtc D/PCRTCClient: Create peer connection. 2019-04-07 02:34:10.658 8537-9397/org.appspot.apprtc I/peerconnectionfactory.cc: (line 492): Using default network controller factory 2019-04-07 02:34:10.658 8537-9397/org.appspot.apprtc I/alr_experiment.cc: (line 65): Using ALR experiment settings: pacing factor: 1, max pacer queue length: 2875, ALR start bandwidth usage percent: 80, ALR end budget level percent: 40, ALR end budget level percent: -60, ALR experiment group ID: 3 2019-04-07 02:34:10.658 8537-9397/org.appspot.apprtc I/bitrate_prober.cc: (line 62): Bandwidth probing enabled, set to inactive 2019-04-07 02:34:10.658 8537-9397/org.appspot.apprtc I/rtp_transport_controller_send.cc: (line 45): Using Legacy SSCC 2019-04-07 02:34:10.658 8537-9397/org.appspot.apprtc I/aimd_rate_control.cc: (line 76): Using aimd rate control with back off factor 0.85 2019-04-07 02:34:10.658 8537-9397/org.appspot.apprtc I/delay_based_bwe.cc: (line 104): Using Trendline filter for delay change estimation with window size 20 2019-04-07 02:34:10.658 8537-9397/org.appspot.apprtc I/send_side_congestion_controller.cc: (line 275): SignalNetworkState Down 2019-04-07 02:34:10.658 8537-9397/org.appspot.apprtc I/delay_based_bwe.cc: (line 314): BWE Setting start bitrate to: 300000 2019-04-07 02:34:10.658 8537-9397/org.appspot.apprtc I/paced_sender.cc: (line 362): ProcessThreadAttached 0x0xc93500c0 2019-04-07 02:34:10.659 8537-9397/org.appspot.apprtc I/cpu_info.cc: (line 46): Available number of cores: 8 2019-04-07 02:34:10.659 8537-9397/org.appspot.apprtc I/aimd_rate_control.cc: (line 76): Using aimd rate control with back off factor 0.85 2019-04-07 02:34:10.659 8537-9397/org.appspot.apprtc I/remote_bitrate_estimator_single_stream.cc: (line 56): RemoteBitrateEstimatorSingleStream: Instantiating. 2019-04-07 02:34:10.659 8537-9398/org.appspot.apprtc W/iceserverparsing.cc: (line 171): Transport parameter should always be udp or tcp. 2019-04-07 02:34:10.659 8537-9398/org.appspot.apprtc I/peerconnection.cc: (line 853): Session: is destroyed. 2019-04-07 02:34:10.660 8537-9397/org.appspot.apprtc I/paced_sender.cc: (line 362): ProcessThreadAttached 0x0x0 2019-04-07 02:34:10.660 8537-9397/org.appspot.apprtc I/paced_sender.cc: (line 362): ProcessThreadAttached 0x0x0 2019-04-07 02:34:10.660 8537-9397/org.appspot.apprtc I/rtc_event_log_impl.cc: (line 195): Stopping WebRTC event log. 2019-04-07 02:34:10.660 8537-9397/org.appspot.apprtc I/rtc_event_log_impl.cc: (line 212): WebRTC event log successfully stopped. 2019-04-07 02:34:10.662 8537-9391/org.appspot.apprtc A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 9391 (pool-1-thread-1)** 2019-04-07 02:34:10.680 8537-8537/org.appspot.apprtc D/ViewRootImpl@ab0f806[CallActivity]: MSG_RESIZED_REPORT: frame=Rect(0, 0 - 1280, 720) ci=Rect(0, 0 - 0, 0) vi=Rect(0, 42 - 0, 0) or=2 2019-04-07 02:34:10.680 8537-8537/org.appspot.apprtc D/ViewRootImpl@ab0f806[CallActivity]: MSG_WINDOW_FOCUS_CHANGED 1 2019-04-07 02:34:10.684 8537-8537/org.appspot.apprtc I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus 2019-04-07 02:34:11.869 8537-8537/org.appspot.apprtc D/ViewRootImpl@ab0f806[CallActivity]: Relayout returned: old=[0,0][1280,720] new=[0,0][1280,720] result=0x3 surface={valid=true 3611250688} changed=false

einsteinarbert commented 5 years ago

tombstone_00.txt Here is my dump tomstone file for crash

einsteinarbert commented 5 years ago

Update, my log Symbolized file:

********** Crash dump: **********
Build fingerprint: 'samsung/gracerltexx/gracerlte:8.0.0/R16NW/N935FXXS4BRK2:user/release-keys'
pid: 19552, tid: 19680, name: pool-1-thread-1  >>> org.appspot.apprtc <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
Stack frame #00 pc 00498e2e  /data/app/org.appspot.apprtc-rNtF587UXMPHjh_xQ4YHUQ==/lib/arm/libjingle_peerconnection_so.so (offset 0x145000) (Java_org_webrtc_PeerConnection_nativeCreateDataChannel+49): Routine webrtc::jni::JNI_PeerConnection_CreateDataChannel(_JNIEnv*, webrtc::JavaParamRef<_jobject*> const&, webrtc::JavaParamRef<_jstring*> const&, webrtc::JavaParamRef<_jobject*> const&) at /media/huyen/Data/workspace/src/out/Debug/../../sdk/android/src/jni/pc/peerconnection.cc:432
Stack frame #01 pc 0000f30f  /data/app/org.appspot.apprtc-rNtF587UXMPHjh_xQ4YHUQ==/oat/arm/base.odex (offset 0xa000)
Crash dump is completed

********** Crash dump: **********
Build fingerprint: 'samsung/gracerltexx/gracerlte:8.0.0/R16NW/N935FXXS4BRK2:user/release-keys'
pid: 19894, tid: 19954, name: pool-1-thread-1  >>> org.appspot.apprtc <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
Stack frame #00 pc 00498e2e  /data/app/org.appspot.apprtc-rNtF587UXMPHjh_xQ4YHUQ==/lib/arm/libjingle_peerconnection_so.so (offset 0x145000) (Java_org_webrtc_PeerConnection_nativeCreateDataChannel+49): Routine webrtc::jni::JNI_PeerConnection_CreateDataChannel(_JNIEnv*, webrtc::JavaParamRef<_jobject*> const&, webrtc::JavaParamRef<_jstring*> const&, webrtc::JavaParamRef<_jobject*> const&) at /media/huyen/Data/workspace/src/out/Debug/../../sdk/android/src/jni/pc/peerconnection.cc:432
Stack frame #01 pc 0000f30f  /data/app/org.appspot.apprtc-rNtF587UXMPHjh_xQ4YHUQ==/oat/arm/base.odex (offset 0xa000)
Crash dump is completed

********** Crash dump: **********
Build fingerprint: 'samsung/gracerltexx/gracerlte:8.0.0/R16NW/N935FXXS4BRK2:user/release-keys'
pid: 20099, tid: 20144, name: pool-1-thread-1  >>> org.appspot.apprtc <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
Stack frame #00 pc 00498e2e  /data/app/org.appspot.apprtc-rNtF587UXMPHjh_xQ4YHUQ==/lib/arm/libjingle_peerconnection_so.so (offset 0x145000) (Java_org_webrtc_PeerConnection_nativeCreateDataChannel+49): Routine webrtc::jni::JNI_PeerConnection_CreateDataChannel(_JNIEnv*, webrtc::JavaParamRef<_jobject*> const&, webrtc::JavaParamRef<_jstring*> const&, webrtc::JavaParamRef<_jobject*> const&) at /media/huyen/Data/workspace/src/out/Debug/../../sdk/android/src/jni/pc/peerconnection.cc:432
Stack frame #01 pc 0000f30f  /data/app/org.appspot.apprtc-rNtF587UXMPHjh_xQ4YHUQ==/oat/arm/base.odex (offset 0xa000)
einsteinarbert commented 5 years ago

Update: I found the reason in my collinder log (my server using stunnel for has https) http: TLS handshake error connection reset by peer.

einsteinarbert commented 5 years ago

Now I can run SSL on port 443 with this command, but Android still can't connect

nohup /root/uav-project/gooogleSDK/google-cloud-sdk/bin/dev_appserver.py --ssl_certificate_path /root/new.crt --ssl_certificate_key_path /root/key.pem --enable_host_checking false --dev_appserver_log_level info --specified_service_ports default:442 --host my_domain.com --port 8080 /root/apprtc/out/app_engine/ &

When Android connect, it report error:

2019-04-09 22:37:43.415 11589-11971/org.appspot.apprtc E/AndroidRuntime: FATAL EXCEPTION: pool-2-thread-1
    Process: org.appspot.apprtc, PID: 11589
    java.lang.NullPointerException: Attempt to invoke virtual method 'org.webrtc.DataChannel org.webrtc.PeerConnection.createDataChannel(java.lang.String, org.webrtc.DataChannel$Init)' on a null object reference
        at org.appspot.apprtc.PeerConnectionClient.createPeerConnectionInternal(PeerConnectionClient.java:618)
        at org.appspot.apprtc.PeerConnectionClient.access$500(PeerConnectionClient.java:72)
        at org.appspot.apprtc.PeerConnectionClient$2.run(PeerConnectionClient.java:357)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at java.lang.Thread.run(Thread.java:764)
einsteinarbert commented 5 years ago

any one hereeee? please help, I cant' do anything @@

einsteinarbert commented 5 years ago
2019-04-24 21:33:00.592 18668-18668/org.appspot.apprtc E/ViewRootImpl: sendUserActionEvent() returned.
2019-04-24 21:33:15.037 18668-18969/org.appspot.apprtc E/PCRTCClient: Peerconnection error: Failed to create peer connection: Attempt to invoke virtual method 'org.webrtc.DataChannel org.webrtc.PeerConnection.createDataChannel(java.lang.String, org.webrtc.DataChannel$Init)' on a null object reference
2019-04-24 21:33:15.039 18668-18969/org.appspot.apprtc E/AndroidRuntime: FATAL EXCEPTION: pool-1-thread-1
    Process: org.appspot.apprtc, PID: 18668
    java.lang.NullPointerException: Attempt to invoke virtual method 'org.webrtc.DataChannel org.webrtc.PeerConnection.createDataChannel(java.lang.String, org.webrtc.DataChannel$Init)' on a null object reference
        at org.appspot.apprtc.PeerConnectionClient.createPeerConnectionInternal(PeerConnectionClient.java:587)
        at org.appspot.apprtc.PeerConnectionClient.lambda$createPeerConnection$2$PeerConnectionClient(PeerConnectionClient.java:377)
        at org.appspot.apprtc.-$$Lambda$PeerConnectionClient$DxSWe8xIrScS-NNI7idUmv1-Yqk.run(Unknown Source:2)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
2019-04-24 21:33:15.156 18668-18668/org.appspot.apprtc E/AppRTCMobileActivity: Fatal error: Attempt to invoke virtual method 'org.webrtc.DataChannel org.webrtc.PeerConnection.createDataChannel(java.lang.String, org.webrtc.DataChannel$Init)' on a null object reference

    java.lang.NullPointerException: Attempt to invoke virtual method 'org.webrtc.DataChannel org.webrtc.PeerConnection.createDataChannel(java.lang.String, org.webrtc.DataChannel$Init)' on a null object reference
        at org.appspot.apprtc.PeerConnectionClient.createPeerConnectionInternal(PeerConnectionClient.java:587)
        at org.appspot.apprtc.PeerConnectionClient.lambda$createPeerConnection$2$PeerConnectionClient(PeerConnectionClient.java:377)
        at org.appspot.apprtc.-$$Lambda$PeerConnectionClient$DxSWe8xIrScS-NNI7idUmv1-Yqk.run(Unknown Source:2)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
einsteinarbert commented 5 years ago
2019-04-26 00:24:02.401 8421-8786/org.appspot.apprtc D/PCRTCClient: Create peer connection.
2019-04-26 00:24:02.407 8421-8786/org.appspot.apprtc E/PCRTCClient: Peerconnection error: Failed to create peer connection: Attempt to invoke virtual method 'org.webrtc.RtpSender org.webrtc.PeerConnection.addTrack(org.webrtc.MediaStreamTrack, java.util.List)' on a null object reference
2019-04-26 00:24:02.409 8421-8786/org.appspot.apprtc E/AndroidRuntime: FATAL EXCEPTION: pool-2-thread-2
    Process: org.appspot.apprtc, PID: 8421
    java.lang.NullPointerException: Attempt to invoke virtual method 'org.webrtc.RtpSender org.webrtc.PeerConnection.addTrack(org.webrtc.MediaStreamTrack, java.util.List)' on a null object reference
        at org.appspot.apprtc.PeerConnectionClient.createPeerConnectionInternal(PeerConnectionClient.java:606)
        at org.appspot.apprtc.PeerConnectionClient.lambda$createPeerConnection$2$PeerConnectionClient(PeerConnectionClient.java:377)
        at org.appspot.apprtc.-$$Lambda$PeerConnectionClient$DxSWe8xIrScS-NNI7idUmv1-Yqk.run(Unknown Source:2)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
2019-04-26 00:24:02.410 8421-8421/org.appspot.apprtc D/ViewRootImpl@47a073b[CallActivity]: MSG_RESIZED_REPORT: frame=[0,0][720,1280] ci=[0,0][0,0] vi=[0,42][0,0] or=1
2019-04-26 00:24:02.410 8421-8421/org.appspot.apprtc D/ViewRootImpl@23246e[Toast]: MSG_RESIZED_REPORT: frame=[94,674][626,751] ci=[0,0][0,0] vi=[0,0][0,0] or=1
2019-04-26 00:24:02.410 8421-8421/org.appspot.apprtc D/ViewRootImpl@47a073b[CallActivity]: MSG_RESIZED: frame=[0,0][720,1280] ci=[0,0][0,0] vi=[0,42][0,417] or=1
2019-04-26 00:24:02.413 8421-8442/org.appspot.apprtc W/libEGL: EGLNativeWindowType 0x7832ac2010 disconnect failed
2019-04-26 00:24:02.413 8421-8442/org.appspot.apprtc D/OpenGLRenderer: eglDestroySurface = 0x783cbffa80, 0x7832ac2000
2019-04-26 00:24:02.413 8421-8421/org.appspot.apprtc D/ViewRootImpl@23246e[Toast]: dispatchDetachedFromWindow
2019-04-26 00:24:02.427 8421-8421/org.appspot.apprtc D/InputTransport: Input channel destroyed: fd=119
2019-04-26 00:24:02.445 8421-8421/org.appspot.apprtc D/ViewRootImpl@24e0294[CallActivity]: Relayout returned: old=[0,42][720,1280] new=[40,434][680,888] result=0x7 surface={true 516246216704} changed=true
2019-04-26 00:24:02.449 8421-8442/org.appspot.apprtc D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000,  [640x454]-format:1
2019-04-26 00:24:02.449 8421-8442/org.appspot.apprtc D/OpenGLRenderer: eglCreateWindowSurface = 0x783cbffa80, 0x7832ac2010
2019-04-26 00:24:02.453 8421-8421/org.appspot.apprtc D/ScrollView:  onsize change changed 
2019-04-26 00:24:02.455 8421-8421/org.appspot.apprtc I/SurfaceViewRenderer: fullscreen_video_view: onMeasure(). New size: 720x1280
2019-04-26 00:24:02.456 8421-8421/org.appspot.apprtc I/SurfaceViewRenderer: pip_video_view: onMeasure(). New size: 664x252
2019-04-26 00:24:02.466 8421-8421/org.appspot.apprtc D/ViewRootImpl@47a073b[CallActivity]: Relayout returned: old=[0,0][720,1280] new=[0,0][720,1280] result=0x1 surface={true 516642381824} changed=false
2019-04-26 00:24:02.467 8421-8421/org.appspot.apprtc I/EglRenderer: fullscreen_video_viewsetLayoutAspectRatio: 0.5625
2019-04-26 00:24:02.467 8421-8421/org.appspot.apprtc I/EglRenderer: pip_video_viewsetLayoutAspectRatio: 2.6349206
2019-04-26 00:24:02.475 8421-8421/org.appspot.apprtc D/ViewRootImpl@47a073b[CallActivity]: MSG_RESIZED: frame=[0,0][720,1280] ci=[0,0][0,0] vi=[0,42][0,0] or=1
2019-04-26 00:24:02.475 8421-8421/org.appspot.apprtc D/ViewRootImpl@24e0294[CallActivity]: MSG_WINDOW_FOCUS_CHANGED 1 1
2019-04-26 00:24:02.479 8421-8421/org.appspot.apprtc D/ScrollView: initGoToTop
2019-04-26 00:24:02.480 8421-8421/org.appspot.apprtc E/AppRTCMobileActivity: Fatal error: Attempt to invoke virtual method 'org.webrtc.RtpSender org.webrtc.PeerConnection.addTrack(org.webrtc.MediaStreamTrack, java.util.List)' on a null object reference

    java.lang.NullPointerException: Attempt to invoke virtual method 'org.webrtc.RtpSender org.webrtc.PeerConnection.addTrack(org.webrtc.MediaStreamTrack, java.util.List)' on a null object reference
        at org.appspot.apprtc.PeerConnectionClient.createPeerConnectionInternal(PeerConnectionClient.java:606)
        at org.appspot.apprtc.PeerConnectionClient.lambda$createPeerConnection$2$PeerConnectionClient(PeerConnectionClient.java:377)
        at org.appspot.apprtc.-$$Lambda$PeerConnectionClient$DxSWe8xIrScS-NNI7idUmv1-Yqk.run(Unknown Source:2)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
2019-04-26 00:24:02.481 8421-8421/org.appspot.apprtc D/Dialog: mIsSamsungBasicInteraction = false
2019-04-26 00:24:02.481 8421-8421/org.appspot.apprtc D/Dialog: mIsSamsungBasicInteraction = false, isMetaDataInActivity = false
2019-04-26 00:24:02.484 8421-8421/org.appspot.apprtc I/DecorView: createDecorCaptionView >> DecorView@32f102c[], isFloating: true, isApplication: true, hasWindowDecorCaption: false, hasWindowControllerCallback: false
2019-04-26 00:24:02.492 8421-8421/org.appspot.apprtc D/ScrollView: initGoToTop
2019-04-26 00:24:02.510 8421-8421/org.appspot.apprtc D/InputTransport: Input channel constructed: fd=138
2019-04-26 00:24:02.511 8421-8421/org.appspot.apprtc D/ViewRootImpl@df2f7d7[CallActivity]: setView = DecorView@32f102c[CallActivity] TM=true MM=false
2019-04-26 00:24:02.524 8421-8421/org.appspot.apprtc D/InputTransport: Input channel constructed: fd=146
2019-04-26 00:24:02.525 8421-8421/org.appspot.apprtc D/ViewRootImpl@5ca46e2[Toast]: setView = android.widget.LinearLayout{d853a73 V.E...... ......I. 0,0-0,0} TM=true MM=false
2019-04-26 00:24:02.542 8421-8421/org.appspot.apprtc W/StaticLayout: maxLineHeight should not be -1.  maxLines:2 lineCount:2
2019-04-26 00:24:02.547 8421-8421/org.appspot.apprtc I/chatty: uid=10040(org.appspot.apprtc) identical 7 lines
einsteinarbert commented 5 years ago

Ok, finnaly again I answered for my self

# Copyright 2015 Google Inc. All Rights Reserved.

"""AppRTC Constants.

This module contains the constants used in AppRTC Python modules.
"""
import os

# Deprecated domains which we should to redirect to REDIRECT_URL.
REDIRECT_DOMAINS =  [
  'apprtc.appspot.com', 'apprtc.webrtc.org', 'www.appr.tc'
]
# URL which we should redirect to if matching in REDIRECT_DOMAINS.
REDIRECT_URL = 'https://appr.tc'

ROOM_MEMCACHE_EXPIRATION_SEC = 60 * 60 * 24
MEMCACHE_RETRY_LIMIT = 100

LOOPBACK_CLIENT_ID = 'LOOPBACK_CLIENT_ID'

# Turn/Stun server override. This allows AppRTC to connect to turn servers
# directly rather than retrieving them from an ICE server provider.
#ICE_SERVER_OVERRIDE = None
# Enable by uncomment below and comment out above, then specify turn and stun
ICE_SERVER_OVERRIDE = [
  {
    "urls": "turn:my_ipaddr:port?transport=udp",
    "username": "my_user_name",
    "credential": "my_paswd"
  },
  {
    "urls": "turn:my_ipaddr:port?transport=tcp",
    "username": "my_user_name",
    "credential": "my_paswd"
  }
]

ICE_SERVER_BASE_URL = ''
ICE_SERVER_URL_TEMPLATE = ''
ICE_SERVER_API_KEY = os.environ.get('')

# Dictionary keys in the collider instance info constant.
WSS_INSTANCE_HOST_KEY = 'my_ipaddr:8443'
WSS_INSTANCE_NAME_KEY = 'wsserver-std'
WSS_INSTANCE_ZONE_KEY = 'us-central1-a'
WSS_INSTANCES = [{
    WSS_INSTANCE_HOST_KEY: 'my_ipaddr:8443',
    WSS_INSTANCE_NAME_KEY: 'collinder-2',
    WSS_INSTANCE_ZONE_KEY: 'vn-nhanhoa-02'
}, {
    WSS_INSTANCE_HOST_KEY: 'my_ipaddr:8443',
    WSS_INSTANCE_NAME_KEY: 'collinder-1',
    WSS_INSTANCE_ZONE_KEY: 'vn-nhanhoa-01'
}]

WSS_HOST_PORT_PAIRS = [ins[WSS_INSTANCE_HOST_KEY] for ins in WSS_INSTANCES]

# memcache key for the active collider host.
WSS_HOST_ACTIVE_HOST_KEY = 'my_ipaddr:8443'

# Dictionary keys in the collider probing result.
WSS_HOST_IS_UP_KEY = 'is_up'
WSS_HOST_STATUS_CODE_KEY = 'status_code'
WSS_HOST_ERROR_MESSAGE_KEY = 'error_message'

RESPONSE_ERROR = 'ERROR'
RESPONSE_ROOM_FULL = 'FULL'
RESPONSE_UNKNOWN_ROOM = 'UNKNOWN_ROOM'
RESPONSE_UNKNOWN_CLIENT = 'UNKNOWN_CLIENT'
RESPONSE_DUPLICATE_CLIENT = 'DUPLICATE_CLIENT'
RESPONSE_SUCCESS = 'SUCCESS'
RESPONSE_INVALID_REQUEST = 'INVALID_REQUEST'

IS_DEV_SERVER = os.environ.get('APPLICATION_ID', '').startswith('dev')

BIGQUERY_URL = 'https://www.googleapis.com/auth/bigquery'

# Dataset used in production.
BIGQUERY_DATASET_PROD = 'prod'

# Dataset used when running locally.
BIGQUERY_DATASET_LOCAL = 'dev'

# BigQuery table within the dataset.
BIGQUERY_TABLE = 'analytics'

Be attention at this config:

ICE_SERVER_OVERRIDE = [
  {
    "urls": "turn:my_ipaddr:port?transport=udp",
    "username": "my_user_name",
    "credential": "my_paswd"
  },
  {
    "urls": "turn:my_ipaddr:port?transport=tcp",
    "username": "my_user_name",
    "credential": "my_paswd"
  }
]

There are some error when read url in android application: org/appspot/apprtc/RoomParametersFetcher.java

 // Return the list of ICE servers described by a WebRTCPeerConnection
  // configuration string.
  private List<PeerConnection.IceServer> iceServersFromPCConfigJSON(String pcConfig)
      throws JSONException {
    JSONObject json = new JSONObject(pcConfig);
    JSONArray servers = json.getJSONArray("iceServers");
    List<PeerConnection.IceServer> ret = new ArrayList<>();
    for (int i = 0; i < servers.length(); ++i) {
      JSONObject server = servers.getJSONObject(i);
      String url = server.getString("urls");
      String credential = server.has("credential") ? server.getString("credential") : "";
        PeerConnection.IceServer turnServer =
            PeerConnection.IceServer.builder(url)
              .setPassword(credential)
              .createIceServer();
      ret.add(turnServer);
    }
    return ret;
  }

I edit that when found error because now webrtc can build on android studio :))

 private List<PeerConnection.IceServer> iceServersFromPCConfigJSON(String pcConfig)
      throws JSONException {
    JSONObject json = new JSONObject(pcConfig);
    JSONArray servers = json.getJSONArray("iceServers");
    List<PeerConnection.IceServer> ret = new ArrayList<>();
    for (int i = 0; i < servers.length(); ++i) {
      JSONObject server = servers.getJSONObject(i);
      String url = server.getString("urls");
      String credential = server.has("credential") ? server.getString("credential") : "";
      // I ADDED THAT LINE:
      String username = server.has("username") ? server.getString("username") : "";
        PeerConnection.IceServer turnServer =
            PeerConnection.IceServer.builder(url).setTlsCertPolicy(PeerConnection.TlsCertPolicy.TLS_CERT_POLICY_SECURE)
              .setPassword(credential)
              .setUsername(username)
              .createIceServer();
      ret.add(turnServer);
    }
    return ret;
  }

Now my server cann allow connect even when via 3G mobile network <3 <3

swotsystem commented 3 years ago

@einsteinarbert Thank you.

lgs96 commented 1 year ago

@einsteinarbert Hi, are you still working on it? The problems that you tackled are what I try to solve now, so I could solve most of my issue from your posts. Thank you for your contributions.