[BUG]: Crash on Android devices when streaming to Amazon IVS Server
Package version
2.4.0-exp.9
Environment
* OS: Android
* Device: Reproducible both on Samsung Galaxy S8 & Oculus Quest 1
* Unity version: 2021.3.3f1
* Codec: H264
Steps To Reproduce
Amazon recently added support to stream to Amazon IVS (Interactive Video Service) directly using WebRTC, which is the same infrastructure used by Twitch. This opens up the opportunity to stream from within a Unity application directly to Twitch (at least on Android. On Windows, it seems that the required H264 profile is not supported somehow).
This setup works in principle, but the application crashes frequently.
I understand that to reproduce, you would need to have access to the code I'm using to set up the connection with a Twitch Stream. I'd be happy to share it privately with Unity staff if necessary.
Current Behavior
The streaming does work at times, but there are frequent crashes. Some crashes appear right after the application starts, some only after several seconds or even minutes. The recent changes in 2.4.0-exp.9 didn't fix the issue for me. The issue seems to appear irrespective of whether OpenGLES3 or Vulkan is used, and whether 'Optimized Frame Pacing' is enabled or not.
Here's an excerpt from the Android log from a Galaxy S8 device:
08-03 19:40:13.744 3526 25161 E libexynosscaler: GetNonStreamScaler: NULL Scaler handle
08-03 19:40:13.773 3526 25161 E libexynosscaler: GetNonStreamScaler: NULL Scaler handle
08-03 19:40:13.775 5142 5524 D TelephonyManager: getAllCellInfo : Caller (PID / UID / TID): 5142 / 1000 / 5524
08-03 19:40:13.811 3526 25161 E libexynosscaler: GetNonStreamScaler: NULL Scaler handle
08-03 19:40:13.840 3526 25161 E libexynosscaler: GetNonStreamScaler: NULL Scaler handle
08-03 19:40:13.855 984 1159 D BluetoothAdapter: STATE_ON
08-03 19:40:13.873 3526 25161 E libexynosscaler: GetNonStreamScaler: NULL Scaler handle
08-03 19:40:13.906 3526 25161 E libexynosscaler: GetNonStreamScaler: NULL Scaler handle
08-03 19:40:13.937 5594 5594 I SKBD : and isTosAccept false
08-03 19:40:13.940 3526 25161 E libexynosscaler: GetNonStreamScaler: NULL Scaler handle
08-03 19:40:13.957 5142 5528 D SDHMS:s : SIOP:: AP:270(396,110) BAT:344(344,0) CHG:378(378,0) USB:338(338,0) PA:301(357,50) LRP:0(0,-999) ATC:0(0,-999)
08-03 19:40:13.974 3526 25161 I chatty : uid=1046(mediacodec) [email protected] identical 1 line
08-03 19:40:14.010 3526 25161 E libexynosscaler: GetNonStreamScaler: NULL Scaler handle
08-03 19:40:14.019 25053 25157 I org.webrtc.Logging: HardwareVideoEncoder: Sync frame generated
08-03 19:40:14.019 25053 25157 I org.webrtc.Logging: HardwareVideoEncoder: Prepending config frame of size 21 to output buffer with offset 0, size 29216
08-03 19:40:14.043 3526 25161 E libexynosscaler: GetNonStreamScaler: NULL Scaler handle
08-03 19:40:14.075 3526 25161 I chatty : uid=1046(mediacodec) [email protected] identical 1 line
08-03 19:40:14.109 3526 25161 E libexynosscaler: GetNonStreamScaler: NULL Scaler handle
08-03 19:40:14.138 5594 5594 I SKBD : and isTosAccept false
08-03 19:40:14.143 3526 25161 E libexynosscaler: GetNonStreamScaler: NULL Scaler handle
08-03 19:40:14.275 3526 25161 I chatty : uid=1046(mediacodec) [email protected] identical 4 lines
08-03 19:40:14.308 3526 25161 E libexynosscaler: GetNonStreamScaler: NULL Scaler handle
08-03 19:40:14.310 3835 4022 I WifiVendorHal: getWifiLinkLayerStats(l.2973) before calling iface.getLinkLayerStats
08-03 19:40:14.311 3291 3291 I [email protected]: enter getLinkLayerStats
08-03 19:40:14.311 3291 3291 I [email protected]: enter getLinkLayerStatsInternal
08-03 19:40:14.317 3291 3291 I [email protected]: Successfully getLinkLayerStats.
08-03 19:40:14.317 3835 4022 I WifiVendorHal: getWifiLinkLayerStats(l.2973) after calling iface.getLinkLayerStats
08-03 19:40:14.339 5594 5594 I SKBD : and isTosAccept false
08-03 19:40:14.341 3526 25161 E libexynosscaler: GetNonStreamScaler: NULL Scaler handle
08-03 19:40:14.366 3835 4022 I WifiVendorHal: getWifiLinkLayerStats(l.2973) before calling iface.getLinkLayerStats
08-03 19:40:14.367 3291 3291 I [email protected]: enter getLinkLayerStats
08-03 19:40:14.367 3291 3291 I [email protected]: enter getLinkLayerStatsInternal
08-03 19:40:14.371 3291 3291 I [email protected]: Successfully getLinkLayerStats.
08-03 19:40:14.372 3835 4022 I WifiVendorHal: getWifiLinkLayerStats(l.2973) after calling iface.getLinkLayerStats
08-03 19:40:14.373 3526 25161 E libexynosscaler: GetNonStreamScaler: NULL Scaler handle
08-03 19:40:14.402 3835 4022 I WifiStateMachine: checkScoreBasedQuality - mPreviousScore[0]:76 mPreviousScore[1]:75 mPreviousScore[2]:76 s2Score:76mPrevoiusScoreAverage:75
08-03 19:40:14.407 3526 25161 E libexynosscaler: GetNonStreamScaler: NULL Scaler handle
08-03 19:40:14.504 3526 25161 I chatty : uid=1046(mediacodec) [email protected] identical 3 lines
08-03 19:40:14.535 3526 25161 E libexynosscaler: GetNonStreamScaler: NULL Scaler handle
08-03 19:40:14.539 5594 5594 I SKBD : and isTosAccept false
08-03 19:40:14.567 3526 25161 E libexynosscaler: GetNonStreamScaler: NULL Scaler handle
08-03 19:40:14.667 3526 25161 I chatty : uid=1046(mediacodec) [email protected] identical 3 lines
08-03 19:40:14.700 3526 25161 E libexynosscaler: GetNonStreamScaler: NULL Scaler handle
08-03 19:40:14.727 3835 3844 I system_server: Background concurrent copying GC freed 482982(22MB) AllocSpace objects, 38(1368KB) LOS objects, 28% free, 59MB/83MB, paused 819us total 349.764ms
08-03 19:40:14.735 3526 25161 E libexynosscaler: GetNonStreamScaler: NULL Scaler handle
08-03 19:40:14.740 5594 5594 I SKBD : and isTosAccept false
08-03 19:40:14.741 3835 3842 D SurfaceControl: finalize(protected), animation-leash is released by finalize, sc=Surface(name=Surface(name=d3622b2 StatusBar)/@0xe936ec2 - animation-leash)/@0x421fa4e, nativeObject=506779284352, caller=java.lang.Daemons$FinalizerDaemon.doFinalize:250 java.lang.Daemons$FinalizerDaemon.runInternal:237 java.lang.Daemons$Daemon.run:103 java.lang.Thread.run:764 <bottom of call stack> <bottom of call stack> <bottom of call stack>
08-03 19:40:14.741 3835 3842 D SurfaceControl: finalize(protected), animation-leash is released by finalize, sc=Surface(name=Surface(name=d3622b2 StatusBar)/@0xe936ec2 - animation-leash)/@0x908b3bd, nativeObject=506280570368, caller=java.lang.Daemons$FinalizerDaemon.doFinalize:250 java.lang.Daemons$FinalizerDaemon.runInternal:237 java.lang.Daemons$Daemon.run:103 java.lang.Thread.run:764 <bottom of call stack> <bottom of call stack> <bottom of call stack>
08-03 19:40:14.743 3835 3842 D SurfaceControl: finalize(protected), animation-leash is released by finalize, sc=Surface(name=Surface(name=AppWindowToken{59e9bd9 token=Token{aec5620 ActivityRecord{be50123 u0 com.sec.android.app.launcher/.activities.LauncherActivity t2}}})/@0x3a175f1 - animation-leash)/@0xd2cc86c, nativeObject=506280760064, caller=java.lang.Daemons$FinalizerDaemon.doFinalize:250 java.lang.Daemons$FinalizerDaemon.runInternal:237 java.lang.Daemons$Daemon.run:103 java.lang.Thread.run:764 <bottom of call stack> <bottom of call stack> <bottom of call stack>
08-03 19:40:14.744 3835 3842 D SurfaceControl: finalize(protected), animation-leash is released by finalize, sc=Surface(name=Surface(name=bf48b2f NavigationBar)/@0xb726e72 - animation-leash)/@0x5f1ee88, nativeObject=506156439968, caller=java.lang.Daemons$FinalizerDaemon.doFinalize:250 java.lang.Daemons$FinalizerDaemon.runInternal:237 java.lang.Daemons$Daemon.run:103 java.lang.Thread.run:764 <bottom of call stack> <bottom of call stack> <bottom of call stack>
08-03 19:40:14.746 3835 3842 D SurfaceControl: finalize(protected), animation-leash is released by finalize, sc=Surface(name=Surface(name=AppWindowToken{59e9bd9 token=Token{aec5620 ActivityRecord{be50123 u0 com.sec.android.app.launcher/.activities.LauncherActivity t2}}})/@0x3a175f1 - animation-leash)/@0x69ae9eb, nativeObject=506246693088, caller=java.lang.Daemons$FinalizerDaemon.doFinalize:250 java.lang.Daemons$FinalizerDaemon.runInternal:237 java.lang.Daemons$Daemon.run:103 java.lang.Thread.run:764 <bottom of call stack> <bottom of call stack> <bottom of call stack>
08-03 19:40:14.746 3835 3842 D SurfaceControl: finalize(protected), animation-leash is released by finalize, sc=Surface(name=Surface(name=AppWindowToken{b77d5a6 token=Token{cd45301 ActivityRecord{e2750e8 u0 com.DojiTechnologies.TwitchStreaming/com.unity3d.player.UnityPlayerActivity t8421}}})/@0x5c6cd7 - animation-leash)/@0x123a93a, nativeObject=506156440256, caller=java.lang.Daemons$FinalizerDaemon.doFinalize:250 java.lang.Daemons$FinalizerDaemon.runInternal:237 java.lang.Daemons$Daemon.run:103 java.lang.Thread.run:764 <bottom of call stack> <bottom of call stack> <bottom of call stack>
08-03 19:40:14.747 3835 3842 D SurfaceControl: finalize(protected), animation-leash is released by finalize, sc=Surface(name=Surface(name=f5bbc6a com.android.systemui.ImageWallpaper)/@0x357683c - animation-leash)/@0x2cba865, nativeObject=506246695296, caller=java.lang.Daemons$FinalizerDaemon.doFinalize:250 java.lang.Daemons$FinalizerDaemon.runInternal:237 java.lang.Daemons$Daemon.run:103 java.lang.Thread.run:764 <bottom of call stack> <bottom of call stack> <bottom of call stack>
08-03 19:40:14.747 3835 3842 D SurfaceControl: finalize(protected), animation-leash is released by finalize, sc=Surface(name=Surface(name=d3622b2 StatusBar)/@0xe936ec2 - animation-leash)/@0xa721fcf, nativeObject=506246695680, caller=java.lang.Daemons$FinalizerDaemon.doFinalize:250 java.lang.Daemons$FinalizerDaemon.runInternal:237 java.lang.Daemons$Daemon.run:103 java.lang.Thread.run:764 <bottom of call stack> <bottom of call stack> <bottom of call stack>
08-03 19:40:14.747 3835 3842 D SurfaceControl: finalize(protected), animation-leash is released by finalize, sc=Surface(name=Surface(name=bf48b2f NavigationBar)/@0xb726e72 - animation-leash)/@0x659f019, nativeObject=506246694336, caller=java.lang.Daemons$FinalizerDaemon.doFinalize:250 java.lang.Daemons$FinalizerDaemon.runInternal:237 java.lang.Daemons$Daemon.run:103 java.lang.Thread.run:764 <bottom of call stack> <bottom of call stack> <bottom of call stack>
08-03 19:40:14.748 3835 3842 D SurfaceControl: finalize(protected), animation-leash is released by finalize, sc=Surface(name=Surface(name=c96c12c Splash Screen com.DojiTechnologies.TwitchStreaming)/@0xf742e78 - animation-leash)/@0x6f9ba24, nativeObject=506746308160, caller=java.lang.Daemons$FinalizerDaemon.doFinalize:250 java.lang.Daemons$FinalizerDaemon.runInternal:237 java.lang.Daemons$Daemon.run:103 java.lang.Thread.run:764 <bottom of call stack> <bottom of call stack> <bottom of call stack>
08-03 19:40:14.766 3526 25161 E libexynosscaler: GetNonStreamScaler: NULL Scaler handle
08-03 19:40:14.874 3526 25161 I chatty : uid=1046(mediacodec) [email protected] identical 3 lines
08-03 19:40:14.907 3526 25161 E libexynosscaler: GetNonStreamScaler: NULL Scaler handle
08-03 19:40:14.908 984 1159 D BluetoothAdapter: STATE_ON
08-03 19:40:14.938 3526 25161 E libexynosscaler: GetNonStreamScaler: NULL Scaler handle
08-03 19:40:14.941 5594 5594 I SKBD : and isTosAccept false
08-03 19:40:14.974 3526 25161 E libexynosscaler: GetNonStreamScaler: NULL Scaler handle
08-03 19:40:15.007 3526 25161 E libexynosscaler: GetNonStreamScaler: NULL Scaler handle
08-03 19:40:15.017 25053 25076 W TwitchStreamin: 0xebadde09 skipped times: 0
08-03 19:40:15.023 25053 25076 E CRASH : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
08-03 19:40:15.023 25053 25076 E CRASH : Version '2021.3.3f1 (af2e63e8f9bd)', Build type 'Release', Scripting Backend 'il2cpp', CPU 'arm64-v8a'
08-03 19:40:15.023 25053 25076 E CRASH : Build fingerprint: 'samsung/dreamltexx/dreamlte:9/PPR1.180610.011/G950FXXUCDUD1:user/release-keys'
08-03 19:40:15.023 25053 25076 E CRASH : Revision: '10'
08-03 19:40:15.023 25053 25076 E CRASH : ABI: 'arm64'
08-03 19:40:15.024 25053 25076 E CRASH : Timestamp: 2022-08-03 19:40:15+0200
08-03 19:40:15.024 25053 25076 E CRASH : pid: 25053, tid: 25076, name: GC Finalizer >>> com.DojiTechnologies.TwitchStreaming <<<
08-03 19:40:15.024 25053 25076 E CRASH : uid: 10256
08-03 19:40:15.024 25053 25076 E CRASH : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
08-03 19:40:15.024 25053 25076 E CRASH : Cause: null pointer dereference
08-03 19:40:15.024 25053 25076 E CRASH : x0 0000000000000000 x1 0000000000000000 x2 0000000000000000 x3 00000075e51d3d34
08-03 19:40:15.024 25053 25076 E CRASH : x4 0000000000000000 x5 00000000ffffffff x6 00000000ffffffff x7 00000075131379c0
08-03 19:40:15.025 25053 25076 E CRASH : x8 00000075e175d7a8 x9 0000000000000001 x10 0000000000000000 x11 0000000000000017
08-03 19:40:15.025 25053 25076 E CRASH : x12 0000000000000018 x13 0000000000000003 x14 00000075e583e000 x15 0000000000000001
08-03 19:40:15.025 25053 25076 E CRASH : x16 00000075e66f5178 x17 0000007687d47650 x18 0000000000000000 x19 0000000000000000
08-03 19:40:15.025 25053 25076 E CRASH : x20 00000075e5788338 x21 00000075e417b910 x22 0000007510930908 x23 00000075e5846000
08-03 19:40:15.025 25053 25076 E CRASH : x24 00000075e175d588 x25 0000000000000001 x26 00000075e4144680 x27 00000075e46f7ecc
08-03 19:40:15.025 25053 25076 E CRASH : x28 00000075e6501c65 x29 00000075e175d340
08-03 19:40:15.025 25053 25076 E CRASH : sp 00000075e175d290 lr 00000075e5bc4580 pc 00000075e5bc4580
08-03 19:40:15.025 25053 25076 E CRASH :
08-03 19:40:15.025 25053 25076 E CRASH : backtrace:
08-03 19:40:15.025 25053 25076 E CRASH : #00 pc 0000000000136580 /data/app/com.DojiTechnologies.TwitchStreaming-i-64AFtov4VDGR_e_QrZYg==/lib/arm64/libunity.so (BuildId: 11442fb6246093e160d39fa706b5731f81f66ca5)
08-03 19:40:15.025 25053 25076 E CRASH : #01 pc 00000000000baf0c /data/app/com.DojiTechnologies.TwitchStreaming-i-64AFtov4VDGR_e_QrZYg==/lib/arm64/libunity.so (BuildId: 11442fb6246093e160d39fa706b5731f81f66ca5)
08-03 19:40:15.025 25053 25076 E CRASH : #02 pc 0000000000f64528 /data/app/com.DojiTechnologies.TwitchStreaming-i-64AFtov4VDGR_e_QrZYg==/lib/arm64/libil2cpp.so (BuildId: a819d80bc9dfdc8bda5d9302b4be771325af2eb2)
08-03 19:40:15.025 25053 25076 E CRASH : #03 pc 0000000000f51d48 /data/app/com.DojiTechnologies.TwitchStreaming-i-64AFtov4VDGR_e_QrZYg==/lib/arm64/libil2cpp.so (BuildId: a819d80bc9dfdc8bda5d9302b4be771325af2eb2)
08-03 19:40:15.025 25053 25076 E CRASH : #04 pc 000000000046d2fc /data/app/com.DojiTechnologies.TwitchStreaming-i-64AFtov4VDGR_e_QrZYg==/lib/arm64/libil2cpp.so (BuildId: a819d80bc9dfdc8bda5d9302b4be771325af2eb2)
08-03 19:40:15.025 25053 25076 E CRASH : #05 pc 000000000046d15c /data/app/com.DojiTechnologies.TwitchStreaming-i-64AFtov4VDGR_e_QrZYg==/lib/arm64/libil2cpp.so (BuildId: a819d80bc9dfdc8bda5d9302b4be771325af2eb2)
08-03 19:40:15.025 25053 25076 E CRASH : #06 pc 0000000000486e80 /data/app/com.DojiTechnologies.TwitchStreaming-i-64AFtov4VDGR_e_QrZYg==/lib/arm64/libil2cpp.so (BuildId: a819d80bc9dfdc8bda5d9302b4be771325af2eb2)
08-03 19:40:15.025 25053 25076 E CRASH : #07 pc 000000000049a330 /data/app/com.DojiTechnologies.TwitchStreaming-i-64AFtov4VDGR_e_QrZYg==/lib/arm64/libil2cpp.so (BuildId: a819d80bc9dfdc8bda5d9302b4be771325af2eb2)
08-03 19:40:15.025 25053 25076 E CRASH : #08 pc 0000000000486dc8 /data/app/com.DojiTechnologies.TwitchStreaming-i-64AFtov4VDGR_e_QrZYg==/lib/arm64/libil2cpp.so (BuildId: a819d80bc9dfdc8bda5d9302b4be771325af2eb2)
08-03 19:40:15.026 25053 25076 E CRASH : #09 pc 000000000045a8b8 /data/app/com.DojiTechnologies.TwitchStreaming-i-64AFtov4VDGR_e_QrZYg==/lib/arm64/libil2cpp.so (BuildId: a819d80bc9dfdc8bda5d9302b4be771325af2eb2)
08-03 19:40:15.026 25053 25076 E CRASH : #10 pc 0000000000475ee8 /data/app/com.DojiTechnologies.TwitchStreaming-i-64AFtov4VDGR_e_QrZYg==/lib/arm64/libil2cpp.so (BuildId: a819d80bc9dfdc8bda5d9302b4be771325af2eb2)
08-03 19:40:15.026 25053 25076 E CRASH : #11 pc 0000000000084df0 /system/lib64/libc.so (__pthread_start(void*)+208) (BuildId: 09804db31f9d5cfd6e3dcad0bc8ece7e)
08-03 19:40:15.026 25053 25076 E CRASH : #12 pc 0000000000023a8c /system/lib64/libc.so (__start_thread+68) (BuildId: 09804db31f9d5cfd6e3dcad0bc8ece7e)
08-03 19:40:15.141 5594 5594 I SKBD : and isTosAccept false
08-03 19:40:15.176 3835 3969 D SamsungAlarmManager: Expired : 8
08-03 19:40:15.177 3835 3969 V SamsungAlarmManager: Sending to uid : 10035 action=com.google.android.gms.auth.authzen.cryptauth.DEVICE_STATE_CHECK_DELAY_COMPLETE alarm=Alarm{112abbb type 3 when 494903168 com.google.android.gms}
08-03 19:40:15.185 3835 3969 I SamsungAlarmManager: setLocked to kernel - T:2 / 20220803T194103, SetElapsed=494951546, nowELAPSED=494903177
08-03 19:40:15.186 3835 3969 I SamsungAlarmManager: setLocked to kernel - T:3 / 20220803T194100, SetElapsed=494947992, nowELAPSED=494903177
08-03 19:40:15.189 3835 4166 D SamsungAlarmManager: setInexact Intent (T:3/F:0/AC:false) 20320731T194015 - CU:10035/CP:1106
08-03 19:40:15.189 3835 4166 I SamsungAlarmManager: setLocked to kernel - T:2 / 20220803T194103, SetElapsed=494951546, nowELAPSED=494903181
08-03 19:40:15.189 3835 4166 I SamsungAlarmManager: setLocked to kernel - T:3 / 20220803T194100, SetElapsed=494947992, nowELAPSED=494903181
08-03 19:40:15.204 3835 4166 D ConnectivityService: filterNetworkStateForUid() uid: 10035, pid: 1106
08-03 19:40:15.204 3835 4166 D ConnectivityService: isNetworkWithLinkPropertiesBlocked: uid=10035, vpn=DISCONNECTED,false
08-03 19:40:15.204 3835 4166 D ConnectivityService: filterNetworkStateForUid() uid: 10035, pid: 1106, networkInfo: [type: WIFI[], state: CONNECTED/CONNECTED, reason: (unspecified), extra: (none), failover: false, available: true, roaming: false]
08-03 19:40:15.205 1106 25164 I Authzen : [DeviceStateSyncManager] The server is in sync with current state. Nothing to do
08-03 19:40:15.317 3835 4022 I WifiVendorHal: getWifiLinkLayerStats(l.2973) before calling iface.getLinkLayerStats
08-03 19:40:15.318 3291 3291 I [email protected]: enter getLinkLayerStats
08-03 19:40:15.318 3291 3291 I [email protected]: enter getLinkLayerStatsInternal
08-03 19:40:15.324 3291 3291 I [email protected]: Successfully getLinkLayerStats.
08-03 19:40:15.324 3835 4022 I WifiVendorHal: getWifiLinkLayerStats(l.2973) after calling iface.getLinkLayerStats
08-03 19:40:15.342 5594 5594 I SKBD : and isTosAccept false
08-03 19:40:15.399 3304 3347 W SurfaceFlinger: SurfaceFlinger is stopped during 30001 ms, stop count=1
08-03 19:40:15.400 3304 3304 I SurfaceFlinger: SFWD update time=301641016691351
08-03 19:40:15.542 5594 5594 I SKBD : and isTosAccept false
08-03 19:40:15.743 5594 5594 I SKBD : and isTosAccept false
08-03 19:40:15.885 25053 25069 E CRASH : other thread is trapped; signum = 11
08-03 19:40:15.886 25053 25069 E AndroidRuntime: FATAL EXCEPTION: UnityMain
08-03 19:40:15.886 25053 25069 E AndroidRuntime: Process: com.DojiTechnologies.TwitchStreaming, PID: 25053
08-03 19:40:15.886 25053 25069 E AndroidRuntime: java.lang.Error: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
08-03 19:40:15.886 25053 25069 E AndroidRuntime: Version '2021.3.3f1 (af2e63e8f9bd)', Build type 'Release', Scripting Backend 'il2cpp', CPU 'arm64-v8a'
08-03 19:40:15.886 25053 25069 E AndroidRuntime: Build fingerprint: 'samsung/dreamltexx/dreamlte:9/PPR1.180610.011/G950FXXUCDUD1:user/release-keys'
08-03 19:40:15.886 25053 25069 E AndroidRuntime: Revision: '10'
08-03 19:40:15.886 25053 25069 E AndroidRuntime: ABI: 'arm64'
08-03 19:40:15.886 25053 25069 E AndroidRuntime: Timestamp: 2022-08-03 19:40:15+0200
08-03 19:40:15.886 25053 25069 E AndroidRuntime: pid: 25053, tid: 25076, name: GC Finalizer >>> com.DojiTechnologies.TwitchStreaming <<<
08-03 19:40:15.886 25053 25069 E AndroidRuntime: uid: 10256
08-03 19:40:15.886 25053 25069 E AndroidRuntime: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
08-03 19:40:15.886 25053 25069 E AndroidRuntime: Cause: null pointer dereference
08-03 19:40:15.886 25053 25069 E AndroidRuntime: x0 0000000000000000 x1 0000000000000000 x2 0000000000000000 x3 00000075e51d3d34
08-03 19:40:15.886 25053 25069 E AndroidRuntime: x4 0000000000000000 x5 00000000ffffffff x6 00000000ffffffff x7 00000075131379c0
08-03 19:40:15.886 25053 25069 E AndroidRuntime: x8 00000075e175d7a8 x9 0000000000000001 x10 0000000000000000 x11 0000000000000017
08-03 19:40:15.886 25053 25069 E AndroidRuntime: x12 0000000000000018 x13 0000000000000003 x14 00000075e583e000 x15 0000000000000001
08-03 19:40:15.886 25053 25069 E AndroidRuntime: x16 00000075e66f5178 x17 0000007687d47650 x18 0000000000000000 x19 0000000000000000
08-03 19:40:15.886 25053 25069 E AndroidRuntime: x20 00000075e5788338 x21 00000075e417b910 x22 0000007510930908 x23 00000075e5846000
08-03 19:40:15.886 25053 25069 E AndroidRuntime: x24 00000075e175d588 x25 0000000000000001 x26 00000075e4144680 x27 00000075e46f7ecc
08-03 19:40:15.886 25053 25069 E AndroidRuntime: x28 00000075e6501c65 x29 00000075e175d340
08-03 19:40:15.886 25053 25069 E AndroidRuntime: sp 00000075e175d290 lr 00000075e5bc4580 pc 00000075e5bc4580
08-03 19:40:15.886 25053 25069 E AndroidRuntime:
08-03 19:40:15.886 25053 25069 E AndroidRuntime: backtrace:
08-03 19:40:15.886 25053 25069 E AndroidRuntime: #00 pc 0000000000136580 /data/app/com.DojiTechnologies.TwitchStreaming-i-64AFtov4VDGR_e_QrZYg==/lib/arm64/libunity.so (BuildId: 11442fb6246093e160d39fa706b5731f81f66ca5)
08-03 19:40:15.886 25053 25069 E AndroidRuntime: #01 pc 00000000000baf0c /data/app/com.DojiTechnologies.TwitchStreaming-i-64AFtov4VDGR_e_QrZYg==/lib/arm64/libunity.so (BuildId: 11442fb6246093e160d39fa706b5731f81f66ca5)
08-03 19:40:15.886 25053 25069 E AndroidRuntime: #02 pc 0000000000f64528 /data/app/com.DojiTechnologies.TwitchStreaming-i-64AFtov4VDGR_e_QrZYg==/lib/arm64/libil2cpp.so (BuildId: a819d80bc9dfdc8bda5d9302b4be771325af2eb2)
08-03 19:40:15.886 25053 25069 E AndroidRuntime: #03 pc 0000000000f51d48 /data/app/com.DojiTechnologies.TwitchStreaming-i-64AFtov4VDGR_e_QrZYg==/lib/arm64/libil2cpp.so (BuildId: a819d80bc9dfdc8bda5d9302b4be771325af2eb2)
08-03 19:40:15.886 25053 25069 E AndroidRuntime: #04 pc 000000000046d2fc /data/app/com.DojiTechnologies.TwitchStreaming-i-64AFtov4VDGR_e_QrZYg==/lib/arm64/libil2cpp.so (BuildId: a819d80bc9dfdc8bda5d9302b4be771325af2eb2)
08-03 19:40:15.886 25053 25069 E AndroidRuntime: #05 pc 000000000046d15c /data/app/com.DojiTechnologies.TwitchStreaming-i-64AFtov4VDGR_e_QrZYg==/lib/arm64/libil2cpp.so (BuildId: a819d80bc9dfdc8bda5d9302b4be771325af2eb2)
08-03 19:40:15.886 25053 25069 E AndroidRuntime: #06 pc 0000000000486e80 /data/app/com.DojiTechnologies.TwitchStreaming-i-64AFtov4VDGR_e_QrZYg==/lib/arm64/libil2cpp.so (BuildId: a819d80bc9dfdc8bda5d9302b4be771325af2eb2)
08-03 19:40:15.886 25053 25069 E AndroidRuntime: #07 pc 000000000049a330 /data/app/com.DojiTechnologies.TwitchStreaming-i-64AFtov4VDGR_e_QrZYg==/lib/arm64/libil2cpp.so (BuildId: a819d80bc9dfdc8bda5d9302b4be771325af2eb2)
08-03 19:40:15.886 25053 25069 E AndroidRuntime: #08 pc 0000000000486dc8 /data/app/com.DojiTechnologies.TwitchStreaming-i-64AFtov4VDGR_e_QrZYg==/lib/arm64/libil2cpp.so (BuildId: a819d80bc9dfdc8bda5d9302b4be771325af2eb2)
08-03 19:40:15.886 25053 25069 E AndroidRuntime: #09 pc 000000000045a8b8 /data/app/com.DojiTechnologies.TwitchStreaming-i-64AFtov4VDGR_e_QrZYg==/lib/arm64/libil2cpp.so (BuildId: a819d80bc9dfdc8bda5d9302b4be771325af2eb2)
08-03 19:40:15.886 25053 25069 E AndroidRuntime: #10 pc 0000000000475ee8 /data/app/com.DojiTechnologies.TwitchStreaming-i-64AFtov4VDGR_e_QrZYg==/lib/arm64/libil2cpp.so (BuildId: a819d80bc9dfdc8bda5d9302b4be771325af2eb2)
08-03 19:40:15.886 25053 25069 E AndroidRuntime: #11 pc 0000000000084df0 /system/lib64/libc.so (__pthread_start(void*)+208) (BuildId: 09804db31f9d5cfd6e3dcad0bc8ece7e)
08-03 19:40:15.886 25053 25069 E AndroidRuntime: #12 pc 0000000000023a8c /system/lib64/libc.so (__start_thread+68) (BuildId: 09804db31f9d5cfd6e3dcad0bc8ece7e)
08-03 19:40:15.886 25053 25069 E AndroidRuntime:
08-03 19:40:15.886 25053 25069 E AndroidRuntime: at libunity.0x136580(Native Method)
08-03 19:40:15.886 25053 25069 E AndroidRuntime: at libunity.0xbaf0c(Native Method)
08-03 19:40:15.886 25053 25069 E AndroidRuntime: at libil2cpp.0xf64528(Native Method)
08-03 19:40:15.886 25053 25069 E AndroidRuntime: at libil2cpp.0xf51d48(Native Method)
08-03 19:40:15.886 25053 25069 E AndroidRuntime: at libil2cpp.0x46d2fc(Native Method)
08-03 19:40:15.886 25053 25069 E AndroidRuntime: at libil2cpp.0x46d15c(Native Method)
08-03 19:40:15.886 25053 25069 E AndroidRuntime: at libil2cpp.0x486e80(Native Method)
08-03 19:40:15.886 25053 25069 E AndroidRuntime: at libil2cpp.0x49a330(Native Method)
08-03 19:40:15.886 25053 25069 E AndroidRuntime: at libil2cpp.0x486dc8(Native Method)
08-03 19:40:15.886 25053 25069 E AndroidRuntime: at libil2cpp.0x45a8b8(Native Method)
08-03 19:40:15.886 25053 25069 E AndroidRuntime: at libil2cpp.0x475ee8(Native Method)
08-03 19:40:15.886 25053 25069 E AndroidRuntime: at libc.__pthread_start(void*)(__pthread_start:208)
08-03 19:40:15.886 25053 25069 E AndroidRuntime: at libc.__start_thread(__start_thread:68)
08-03 19:40:15.891 3835 4166 D Debug : !@DumpState : SHIP
08-03 19:40:15.891 3835 4166 D Debug : !@DumpState : debug level:0x4f4c
08-03 19:40:15.891 3835 4166 D Debug : !@Dumpstate : Finally, system will skip dumpstate
08-03 19:40:15.892 3835 4166 W ActivityManager: crash : com.DojiTechnologies.TwitchStreaming,0
08-03 19:40:15.893 3835 4166 W ActivityManager: Force finishing activity com.DojiTechnologies.TwitchStreaming/com.unity3d.player.UnityPlayerActivity
08-03 19:40:15.894 3835 3835 D Telecom:SamsungPrebindingServiceImpl: onTopActivityChanged : ComponentInfo{com.sec.android.app.launcher/com.sec.android.app.launcher.activities.LauncherActivity}
08-03 19:40:15.906 3835 3835 D CS_HdrController: updateMultiWindowState : 0
08-03 19:40:15.906 3835 3835 D MdnieScenarioControlService: MultiWindowState : false
08-03 19:40:15.908 3835 3861 D StorageManagerService: getExternalStorageMountMode : 3
08-03 19:40:15.908 3835 3861 D StorageManagerService: getExternalStorageMountMode : 3
08-03 19:40:15.908 3835 3861 D StorageManagerService: getExternalStorageMountMode : final mountMode=3, uid : 1000, packageName : com.samsung.android.lool
08-03 19:40:15.908 3835 3861 I ApplicationPolicy: isApplicationExternalStorageWhitelisted:com.samsung.android.lool user:0
08-03 19:40:15.908 3835 3861 D ApplicationPolicy: isApplicationExternalStorageWhitelisted: DO is not enabled on user 0. Allowed.
08-03 19:40:15.908 3835 3861 D ActivityManager: package com.samsung.android.lool, user - 0 is SDcard whitelisted
08-03 19:40:15.908 3835 3861 I ApplicationPolicy: isApplicationExternalStorageBlacklisted:com.samsung.android.lool user:0
08-03 19:40:15.909 3835 3861 D ApplicationPolicy: isApplicationExternalStorageBlacklisted: DO is not enabled on user 0. Allowed.
08-03 19:40:15.909 3835 3861 I ApplicationPolicy: isApplicationExternalStorageBlacklisted:com.samsung.android.lool user:0
08-03 19:40:15.909 3835 3861 D ApplicationPolicy: isApplicationExternalStorageBlacklisted: DO is not enabled on user 0. Allowed.
08-03 19:40:15.910 3835 3835 D GameManagerService: MultiWindowEventListener.onFocusStackChanged(), state=0, top=ComponentInfo{com.sec.android.app.launcher/
Expected Behavior
A stable stream without crashes.
Anything else?
No response
@julienkay How about other platform? Windows or macOS?
Thanks for your answer! Unfortunately, I can't test either of those for other reasons.
Windows: The issue is that the server expects one of the following H264 profiles (I think they use Pion in their WebRTC stack):
- level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f
- level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42001f
- level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f
- level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42e01f
- level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=4d001f
- level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=4d001f
My PC (Nvidia GTX 960) only contains the following profiles when I create a WebRTC Offer:
- implementation_name=NvCodec;level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=420033
- implementation_name=NvCodec;level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=640033
- implementation_name=NvCodec;level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=4d0033
For that reason a WebRTC connection can't be initiated on Windows and will fail already at the signaling stage (this works fine on all Android devices I tested, where profile-level-id=42e01f is supported).
In summary, the sever expects me to use H264 Profile Level 3.1, but the WebRTC package automatically chooses the highest available Profile Level 5.1, (independent of which resolution and bitrate I put into Camera.CaptureStream()). Being able to explicitly choose a lower profile level would fix this, but I guess this is separate issue / feature request.
~~I guess I could use VP9 with a software encoder instead for testing, but from the documentation I do not know how to enable software encoding? There used to be an EncoderType.Software enum to pass to WebRTC.Initialize(), but that seems to have changed?~~ EDIT: It seems the server-side does require H264 and won't work with other codecs, so I'm stuck with using H264.
Mac: I don't have access to a Mac, that I could test this on.
How about 2.4.0-exp.10 ?
We customise the SDP string when signaling, and we test them with Unity and browsers but not Pion. It is possible that this modification may occurs the crash by the process of SDPs on Pion.
2.4.0-exp.10 has the same issues. I don't think the error happens during signaling. On Android the signaling process is always successful. Even streaming works for a few seconds until the app crashes with the error posted above.
@julienkay Users reported some SoC of Android has crashed here. https://github.com/Unity-Technologies/com.unity.webrtc/issues/437
Do you think this issue is about specific SoCs?
@julienkay
Does the sample PeerConnection scene of the WebRTC package work on your Android device? (using H264 codec)
@karasusan I'm not sure this is a problem with a specific SoC. Quest 1 has a Snapdragon 835, and AFAIK my Galaxy S8 being the EU version means it has an Exynos 9 Octa 8895. So two different SoCs having the same issues.
@kannan-xiao4 The PeerConnection sample seems to work fine on my device. I couldn't reproduce any crashes. (tested with 2.4.0-exp.10)
In case you want to investigate further, I just added both of you to a private repository with code that reproduces the issue.
@julienkay I would be glad if we have the smallest sample to replicate the issue.
I'm not quite sure I understand. Can you elaborate? The repository I Invited you to is the smallest reproducible sample code I can produce: https://github.com/Doji-Technologies/twitch-streaming-unity/invitations
@julienkay I would be glad if we have the smallest sample to replicate the issue.
The repository I Invited you to is the smallest reproducible sample code I can produce: https://github.com/Doji-Technologies/twitch-streaming-unity/invitations
May I have the zip file for the minimum project?
I've just sent the project via mail. Thank you for looking into this!
memo: WRS-415
Seems Amazon IVS web broadcast SDK is a WebRTC SFU server, which coverts WebRTC to RTMP or HLS etc.
If you need to debug at the server side, we encorage srs-unity, which is open source, and I would like to help you to finger out the issue.
We build some examples for unity WebRTC to publish stream to WebRTC SFU server, seems works well, so the issue might be introduced from client side or media content.
If you want, you can also find me at discord
@winlinvip Thanks for sharing your great work. I have one question, I would like to know this project works well with the latest version of WebRTC package.
@winlinvip Thanks for sharing your great work. I have one question, I would like to know this project works well with the latest version of WebRTC package.
I tested with 2.4.0-exp.11, 3.0.0-pre.1, 3.0.0-pre.2, 3.0.0-pre.3, 3.0.0-pre.4 it works good. Please see environment for detail.
Note: Because 2.4 change the API of camera, which is not compatible, see https://github.com/ossrs/srs-unity/issues/2 and https://github.com/Unity-Technologies/com.unity.webrtc/issues/498