crash in vlc_tick_wait when called from a thread not managed by VLC on Android
I have an "access demux" module that uses a library which handles its own thread, the module will create and destroy es_out
in callbacks from the librarie's threads. calling es_out_Del from these thread crashes the application.
from my understanding, in src/android/thread.c
- the thread local variable
thread
used here is only initialized when the thread is created byvlc_clone
- the call on
vlc_tick_wait
will unreferencethread->killed
which is un-initialized here here
replacing vlc_tick_wait
with the implementation from src/posix/thread.c
solves the issue for me.
Backtrace for reference
Abort message: '../../src/linux/thread.c:126: int vlc_atomic_timedwait(void *, unsigned int, vlc_tick_t): assertion "!"unreachable"" failed'
#00 0x00000000000830f0 /apex/com.android.runtime/lib64/bionic/libc.so (abort+160) (BuildId: 87ed7ba713785c50670d166a6a1664a7)
#01 0x000000000008348c /apex/com.android.runtime/lib64/bionic/libc.so (__assert2+36) (BuildId: 87ed7ba713785c50670d166a6a1664a7)
#02 0x0000000000b560a4 /data/app/io.videolabs.simplevlcplayer-fCvmEtqMn6B8G9tsvK4feg==/base.apk!libvlc.so (offset 0x2a8000) (vlc_atomic_timedwait+204) (BuildId: f2929dd559eb74e77197ddddcdfa23104d87653a)
vlc_atomic_timedwait
/vlc/vlc/build-android-aarch64-linux-android/src/../../src/linux/thread.c:126:13
#03 0x0000000000b57444 /data/app/io.videolabs.simplevlcplayer-fCvmEtqMn6B8G9tsvK4feg==/base.apk!libvlc.so (offset 0x2a8000) (vlc_tick_sleep+136) (BuildId: f2929dd559eb74e77197ddddcdfa23104d87653a)
vlc_tick_wait
/vlc/vlc/build-android-aarch64-linux-android/src/../../src/android/thread.c:218:12
vlc_tick_sleep
/vlc/vlc/build-android-aarch64-linux-android/src/../../src/android/thread.c:223:5
#04 0x0000000000af7f2c /data/app/io.videolabs.simplevlcplayer-fCvmEtqMn6B8G9tsvK4feg==/base.apk!libvlc.so (offset 0x2a8000) (BuildId: f2929dd559eb74e77197ddddcdfa23104d87653a)
EsOutDrainDecoder
/vlc/vlc/build-android-aarch64-linux-android/src/../../src/input/es_out.c:3021:9
#05 0x0000000000afcc54 /data/app/io.videolabs.simplevlcplayer-fCvmEtqMn6B8G9tsvK4feg==/base.apk!libvlc.so (offset 0x2a8000) (BuildId: f2929dd559eb74e77197ddddcdfa23104d87653a)
EsOutDelLocked
/vlc/vlc/build-android-aarch64-linux-android/src/../../src/input/es_out.c:3037:9
#06 0x0000000000afdcc4 /data/app/io.videolabs.simplevlcplayer-fCvmEtqMn6B8G9tsvK4feg==/base.apk!libvlc.so (offset 0x2a8000) (BuildId: f2929dd559eb74e77197ddddcdfa23104d87653a)
EsOutDel
/vlc/vlc/build-android-aarch64-linux-android/src/../../src/input/es_out.c:3097:5
#07 0x0000000000b0ef6c /data/app/io.videolabs.simplevlcplayer-fCvmEtqMn6B8G9tsvK4feg==/base.apk!libvlc.so (offset 0x2a8000) (BuildId: f2929dd559eb74e77197ddddcdfa23104d87653a)
es_out_Del
/vlc/vlc/build-android-aarch64-linux-android/src/../../include/vlc_es_out.h:149:5
CmdExecuteDel
/vlc/vlc/build-android-aarch64-linux-android/src/../../src/input/es_out_timeshift.c:1579:9
#08 0x0000000000b0f404 /data/app/io.videolabs.simplevlcplayer-fCvmEtqMn6B8G9tsvK4feg==/base.apk!libvlc.so (offset 0x2a8000) (BuildId: f2929dd559eb74e77197ddddcdfa23104d87653a)
Del
/vlc/vlc/build-android-aarch64-linux-android/src/../../src/input/es_out_timeshift.c:447:9
#09 0x0000000000d12724 /data/app/io.videolabs.simplevlcplayer-fCvmEtqMn6B8G9tsvK4feg==/base.apk!libvlc.so (offset 0x2a8000) (BuildId: f2929dd559eb74e77197ddddcdfa23104d87653a)
es_out_Del
/vlc/vlc/build-android-aarch64-linux-android/modules/../../include/vlc_es_out.h:149:5
Edited by Pierre Lamot