Skip to content

Crash Android app after multiple playback restart

Steps to reproduce:

  • Create new project in Unity (Win10 2021.3.18.f1).
  • Import latest vlc-unity-trial.unitypackage (same with older).
  • Config project: Switch to Android build, remove Vulkan api from Graphics APIs list, setup permissions in android manifest file. Mono/IL2CPP - no difference.
  • Set demo scene VLC Canvas Example with path to 4k video (for example https://streams.videolan.org/streams/HDR/LG_4K_View-the-Feeling.ts).
  • Build and run on device.
  • Play/stop playback about 20 times (more for low res videos).

Reproduced on devices:

  • Xiaomi Mi5S (Android 10)
  • Redmi Note 10 Pro (Android 12)

Full logcat logs:

During playback logcat spam:

...
2023.02.16 13:40:02.500 8402 8439 Info VLCUnity [VLC-Unity] get Video Frame 134
2023.02.16 13:40:02.519 8402 9469 Warn .VlcAndroidTes [SurfaceTexture-0-8402-16] bindTextureImage: clearing GL error: 0x500
2023.02.16 13:40:02.535 8402 8439 Info VLCUnity [VLC-Unity] get Video Frame 134
2023.02.16 13:40:02.539 8402 9469 Warn .VlcAndroidTes [SurfaceTexture-0-8402-16] bindTextureImage: clearing GL error: 0x500
2023.02.16 13:40:02.568 8402 8439 Info VLCUnity [VLC-Unity] get Video Frame 135
...

After multiple playback restart logcat start spam:

2023.02.16 13:40:09.734 8402 8535 Warn Adreno-GSL <sharedmem_gpuobj_alloc:2736>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
2023.02.16 13:40:09.745 8402 8535 Error Adreno-GSL <gsl_memory_alloc_pure:2604>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.

Then crash on any manipulation:

2023.02.16 13:40:12.101 8402 8402 Error InputEventReceiver Exception dispatching input event.
2023.02.16 13:40:12.101 8402 8402 Error MessageQueue-JNI Exception in MessageQueue callback: handleReceiveCallback
2023.02.16 13:40:12.102 8402 8402 Error MessageQueue-JNI java.lang.Error: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2023.02.16 13:40:12.102 8402 8402 Error MessageQueue-JNI Version '2021.3.18f1 (3129e69bc0c7)', Build type 'Release', Scripting Backend 'il2cpp', CPU 'armeabi-v7a'
2023.02.16 13:40:12.102 8402 8402 Error MessageQueue-JNI Build fingerprint: 'Redmi/sweet_global/sweet:12/SKQ1.210908.001/V13.0.16.0.SKFMIXM:user/release-keys'
2023.02.16 13:40:12.102 8402 8402 Error MessageQueue-JNI Revision: '0'
2023.02.16 13:40:12.102 8402 8402 Error MessageQueue-JNI ABI: 'arm'
2023.02.16 13:40:12.102 8402 8402 Error MessageQueue-JNI Timestamp: 2023-02-16 13:40:09+0300
2023.02.16 13:40:12.102 8402 8402 Error MessageQueue-JNI pid: 8402, tid: 8535, name: UnityGfxDeviceW  >>> com.DefaultCompany.VlcAndroidTest <<<
2023.02.16 13:40:12.102 8402 8402 Error MessageQueue-JNI uid: 10276
2023.02.16 13:40:12.102 8402 8402 Error MessageQueue-JNI signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xd8
2023.02.16 13:40:12.102 8402 8402 Error MessageQueue-JNI Cause: null pointer dereference
2023.02.16 13:40:12.102 8402 8402 Error MessageQueue-JNI     r0  00000004  r1  00000004  r2  00000000  r3  00000000
2023.02.16 13:40:12.102 8402 8402 Error MessageQueue-JNI     r4  ee7bc2a8  r5  00000001  r6  ee7bc350  r7  c002ce00
2023.02.16 13:40:12.102 8402 8402 Error MessageQueue-JNI     r8  00000000  r9  ee7bc2a4  r10 efabe498  r11 efabe30c
2023.02.16 13:40:12.102 8402 8402 Error MessageQueue-JNI     ip  efabe000  sp  bcf7b4c8  lr  d549258f  pc  d553e77a
2023.02.16 13:40:12.102 8402 8402 Error MessageQueue-JNI 
2023.02.16 13:40:12.102 8402 8402 Error MessageQueue-JNI backtrace:
2023.02.16 13:40:12.102 8402 8402 Error MessageQueue-JNI       #00 pc 0017b77a  /vendor/lib/egl/libGLESv2_adreno.so (BuildId: df11206b4d907c748e19d6ff770bb992)
2023.02.16 13:40:12.102 8402 8402 Error MessageQueue-JNI 
2023.02.16 13:40:12.102 8402 8402 Error MessageQueue-JNI 	at libGLESv2_adreno.0x17b77a(Native Method)
2023.02.16 13:40:12.102 8402 8402 Debug AndroidRuntime Shutting down VM
0001.01.01 00:00:00.000 -1 -1 Info  --------- beginning of crash
2023.02.16 13:40:12.103 8402 8402 Error AndroidRuntime FATAL EXCEPTION: main
2023.02.16 13:40:12.103 8402 8402 Error AndroidRuntime Process: com.DefaultCompany.VlcAndroidTest, PID: 8402
2023.02.16 13:40:12.103 8402 8402 Error AndroidRuntime java.lang.Error: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2023.02.16 13:40:12.103 8402 8402 Error AndroidRuntime Version '2021.3.18f1 (3129e69bc0c7)', Build type 'Release', Scripting Backend 'il2cpp', CPU 'armeabi-v7a'
2023.02.16 13:40:12.103 8402 8402 Error AndroidRuntime Build fingerprint: 'Redmi/sweet_global/sweet:12/SKQ1.210908.001/V13.0.16.0.SKFMIXM:user/release-keys'
2023.02.16 13:40:12.103 8402 8402 Error AndroidRuntime Revision: '0'
2023.02.16 13:40:12.103 8402 8402 Error AndroidRuntime ABI: 'arm'
2023.02.16 13:40:12.103 8402 8402 Error AndroidRuntime Timestamp: 2023-02-16 13:40:09+0300
2023.02.16 13:40:12.103 8402 8402 Error AndroidRuntime pid: 8402, tid: 8535, name: UnityGfxDeviceW  >>> com.DefaultCompany.VlcAndroidTest <<<
2023.02.16 13:40:12.103 8402 8402 Error AndroidRuntime uid: 10276
2023.02.16 13:40:12.103 8402 8402 Error AndroidRuntime signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xd8
2023.02.16 13:40:12.103 8402 8402 Error AndroidRuntime Cause: null pointer dereference
2023.02.16 13:40:12.103 8402 8402 Error AndroidRuntime     r0  00000004  r1  00000004  r2  00000000  r3  00000000
2023.02.16 13:40:12.103 8402 8402 Error AndroidRuntime     r4  ee7bc2a8  r5  00000001  r6  ee7bc350  r7  c002ce00
2023.02.16 13:40:12.103 8402 8402 Error AndroidRuntime     r8  00000000  r9  ee7bc2a4  r10 efabe498  r11 efabe30c
2023.02.16 13:40:12.103 8402 8402 Error AndroidRuntime     ip  efabe000  sp  bcf7b4c8  lr  d549258f  pc  d553e77a
2023.02.16 13:40:12.103 8402 8402 Error AndroidRuntime 
2023.02.16 13:40:12.103 8402 8402 Error AndroidRuntime backtrace:
2023.02.16 13:40:12.103 8402 8402 Error AndroidRuntime       #00 pc 0017b77a  /vendor/lib/egl/libGLESv2_adreno.so (BuildId: df11206b4d907c748e19d6ff770bb992)
2023.02.16 13:40:12.103 8402 8402 Error AndroidRuntime 
2023.02.16 13:40:12.103 8402 8402 Error AndroidRuntime 	at libGLESv2_adreno.0x17b77a(Native Method)

For Mi5S - same crash without any red errors in logcat.

No errors in editor. No problem with video playback or any other functions.

If enable "Log to Console" for script - for some reason script logs in logcat displayed with empty message, but normal in editor console.

What I tried:

  • Cutout texture output to Unity in script dont fix a problem.
  • Dispose and instantiate libVlc/mediaPlayer objects on play dont fix a problem.
  • Looks like some nasty memory leak, but not by fault of Unity objects/functions/GC.
  • Or it is specific problem with both my devices / project setup / trial package ?