Skip to content

libvlc crash when creating media players several times in a row

Steps to reproduce

Create an app using libvlc on windows. Every few seconds, destroy the media player and create it again with a different stream (looping between A and B is enough to reproduce the issue, but I didn't get it to crash with only one media). Randomly (in less than 5 minutes in general), the application crashes.

The sample code I'm using is presented here : https://github.com/jeremyVignelles/TestLibvlcNative/tree/testRtspCycle

Environment

OS : Windows, didn't have time to create a sample on linux to reproduce the issue.

VLC version: Reproduced with 3.0.7.1 and 4.0.0 master at time of yesterday.

Video source: RTSP streams from Axis cameras (could it be related to the reset seen in #21893 ?). I also tried with a Dahua and a D-LINK camera, and it seems to crash too, but way less often. I didn't manage to make it crash with VLC RTSP streams, nor with files, but I didn't test very thoroughly. All streams are using RTP over UDP, with h.264

StackTrace

Trying to debug with gdb on windows, the application was so slow that it didn't crash. However, I managed to build VLC4 with LLVM and PDB with the help of martin and steve. Here are the relevant stack traces I got:

 	ntdll.dll!00007ffce30791f2()	Inconnu
 	ntdll.dll!00007ffce3081622()	Inconnu
 	ntdll.dll!00007ffce308192a()	Inconnu
 	ntdll.dll!00007ffce308a8e9()	Inconnu
 	ntdll.dll!00007ffce2fc081d()	Inconnu
 	ntdll.dll!00007ffce2fbfba1()	Inconnu
 	ucrtbase.dll!00007ffce0cff79b()	Inconnu
 	ucrtbase.dll!00007ffce0d10fe6()	Inconnu
 	libavcodec_plugin.dll!av_free(void * ptr) Ligne 225	C
 	libavcodec_plugin.dll!av_freep(void * arg) Ligne 234	C
 	libavcodec_plugin.dll!avcodec_close(AVCodecContext * avctx) Ligne 1108	C
 	libavcodec_plugin.dll!avcodec_free_context(AVCodecContext * * pavctx) Ligne 180	C
 	libavcodec_plugin.dll!EndVideoDec(vlc_object_t * obj) Ligne 1384	C
 	libvlccore.dll!module_unneed(vlc_object_t * obj, module_t * module) Ligne 276	C
 	libvlccore.dll!decoder_Clean(decoder_t * p_dec) Ligne 56	C
 	libvlccore.dll!DeleteDecoder(decoder_t * p_dec) Ligne 1931	C
 	libvlccore.dll!input_DecoderDelete(decoder_t * p_dec) Ligne 2157	C
 	libvlccore.dll!EsOutDestroyDecoder(es_out_t * out, es_out_id_t * p_es) Ligne 2060	C
 	libvlccore.dll!EsOutUnselectEs(es_out_t * out, es_out_id_t * es, bool b_update) Ligne 2226	C
 	libvlccore.dll!EsOutVaControlLocked(es_out_t * out, int i_query, char * args) Ligne 2791	C
 	libvlccore.dll!EsOutControl(es_out_t * out, int i_query, char * args) Ligne 3470	C
 	libvlccore.dll!es_out_vaControl(es_out_t * out, int i_query, char * args) Ligne 158	C
 	libvlccore.dll!es_out_Control(es_out_t * out, int i_query, ...) Ligne 167	C
 	libvlccore.dll!CmdExecuteControl(es_out_t * p_out, ts_cmd_t * p_cmd) Ligne 1556	C
 	libvlccore.dll!ControlLocked(es_out_t * p_out, int i_query, char * args) Ligne 637	C
 	libvlccore.dll!Control(es_out_t * p_out, int i_query, char * args) Ligne 764	C
 	libvlccore.dll!es_out_vaControl(es_out_t * out, int i_query, char * args) Ligne 158	C
 	libvlccore.dll!es_out_Control(es_out_t * out, int i_query, ...) Ligne 167	C
 	libvlccore.dll!es_out_SetMode(es_out_t * p_out, int i_mode) Ligne 99	C
 	libvlccore.dll!End(input_thread_t * p_input) Ligne 1367	C
 	libvlccore.dll!Run(void * data) Ligne 471	C
 	libvlccore.dll!vlc_entry(void * p) Ligne 468	C
 	ucrtbase.dll!00007ffce0d0d912()	Inconnu
 	kernel32.dll!00007ffce1b47bd4()	Inconnu
 	ntdll.dll!00007ffce2fece71()	Inconnu
 	ntdll.dll!00007ffce301c0e4()	Inconnu
 	KernelBase.dll!00007ffce00a8ba3()	Inconnu
 	libvlccore.dll!vlc_join(vlc_thread * th, void * * result) Ligne 532	C
 	libvlccore.dll!vlc_player_Delete(vlc_player_t * player) Ligne 3677	C
 	libvlc.dll!libvlc_media_player_destroy(libvlc_media_player_t * p_mi) Ligne 802	C
 	libvlc.dll!libvlc_media_player_release(libvlc_media_player_t * p_mi) Ligne 835	C
 	testVlc.exe!000000000040164e()	Inconnu
 	kernel32.dll!00007ffce1b47bd4()	Inconnu
 	ntdll.dll!00007ffce2fece71()	Inconnu
 	ntdll.dll!00007ffce301f994()	Inconnu
 	ntdll.dll!00007ffce2fe0835()	Inconnu
 	KernelBase.dll!00007ffce00ec069()	Inconnu
 	libmmdevice_plugin.dll!MMSession(audio_output * aout, IMMDeviceEnumerator * it) Ligne 967	C
 	libmmdevice_plugin.dll!MMThread(void * data) Ligne 1069	C
 	libvlccore.dll!vlc_entry(void * p) Ligne 468	C
 	ucrtbase.dll!00007ffce0d0d912()	Inconnu
 	kernel32.dll!00007ffce1b47bd4()	Inconnu
 	ntdll.dll!00007ffce2fece71()	Inconnu
 	ntdll.dll!00007ffce301f994()	Inconnu
 	ntdll.dll!00007ffce2fe0835()	Inconnu
 	KernelBase.dll!00007ffce00ec069()	Inconnu
 	libvlccore.dll!WaitOnAddressFallback(volatile void * addr, void * value, unsigned __int64 size, unsigned long ms) Ligne 397	C
 	libvlccore.dll!vlc_addr_wait(void * addr, unsigned int val) Ligne 429	C
 	libvlccore.dll!vlc_cond_wait(vlc_cond_t * cond, vlc_mutex_t * mutex) Ligne 266	C
 	libvlccore.dll!vlc_player_destructor_Thread(void * data) Ligne 903	C
 	libvlccore.dll!vlc_entry(void * p) Ligne 468	C
 	ucrtbase.dll!00007ffce0d0d912()	Inconnu
 	kernel32.dll!00007ffce1b47bd4()	Inconnu
 	ntdll.dll!00007ffce2fece71()	Inconnu
 	ntdll.dll!00007ffce301f994()	Inconnu
 	ntdll.dll!00007ffce2fe0835()	Inconnu
 	KernelBase.dll!00007ffce00ec069()	Inconnu
	libvlccore.dll!WaitOnAddressFallback(volatile void * addr, void * value, unsigned __int64 size, unsigned long ms) Ligne 397	C
 	libvlccore.dll!vlc_addr_wait(void * addr, unsigned int val) Ligne 429	C
 	libvlccore.dll!vlc_cond_wait(vlc_cond_t * cond, vlc_mutex_t * mutex) Ligne 266	C
 	libwinhibit_plugin.dll!Run(void * obj) Ligne 66	C
 	libvlccore.dll!vlc_entry(void * p) Ligne 468	C
 	ucrtbase.dll!00007ffce0d0d912()	Inconnu
 	kernel32.dll!00007ffce1b47bd4()	Inconnu
 	ntdll.dll!00007ffce2fece71()	Inconnu
 	win32u.dll!00007ffce1011164()	Inconnu
 	user32.dll!00007ffce1c8477d()	Inconnu
	libdirect3d11_plugin.dll!EventThread(void * p_this) Ligne 120	C
 	libvlccore.dll!vlc_entry(void * p) Ligne 468	C
 	ucrtbase.dll!00007ffce0d0d912()	Inconnu
 	kernel32.dll!00007ffce1b47bd4()	Inconnu
 	ntdll.dll!00007ffce2fece71()	Inconnu
 	ntdll.dll!00007ffce301f994()	Inconnu
 	ntdll.dll!00007ffce2fe0835()	Inconnu
 	KernelBase.dll!00007ffce00ec069()	Inconnu
 	libvlccore.dll!WaitOnAddressFallback(volatile void * addr, void * value, unsigned __int64 size, unsigned long ms) Ligne 397	C
 	libvlccore.dll!vlc_addr_timedwait(void * addr, unsigned int val, __int64 delay) Ligne 442	C
 	libvlccore.dll!vlc_cond_wait_delay(vlc_cond_t * cond, vlc_mutex_t * mutex, __int64 delay) Ligne 288	C
 	libvlccore.dll!vlc_cond_timedwait(vlc_cond_t * cond, vlc_mutex_t * mutex, __int64 deadline) Ligne 300	C
 	libvlccore.dll!vout_control_Pop(vout_control_t * ctrl, vout_control_cmd_t * cmd, __int64 deadline) Ligne 157	C
 	libvlccore.dll!Thread(void * object) Ligne 1616	C
 	libvlccoreSee #22649 (closed).dll!vlc_entry(void * p) Ligne 468	C
 	ucrtbase.dll!00007ffce0d0d912()	Inconnu
 	kernel32.dll!00007ffce1b47bd4()	Inconnu
 	ntdll.dll!00007ffce2fece71()	Inconnu

== Logs

Will be attached

Edited by Jean-Baptiste Kempf
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information