[vlc-devel] Deadlocked in stop if too close to play

jboileau jboileau at gmail.com
Mon Oct 26 17:42:45 CET 2009


I am using LibVLC in an application of my own under Win32. One problem
I have never been able to fix is a deadlock in
libvlc_media_player_stop if it is called too close to a
libvlc_media_player_play. The application hangs and pausing the
application in the development environment reveals that it is
deadlocked in the stop.

My application cycles through surveillance cameras using a timer, but
on an emergency signal I must switch to a particular camera. As you
may deduce: a play may have just been started when such a signal is
received. Thus a stop may be very close to a play.

I guess, to the limit, this code should work and not hang once in a while:

libvlc_media_player_play(aLibVLCMediaPlayer, &lLibVLCException);
libvlc_media_player_stop(aLibVLCMediaPlayer, &lLibVLCException);

but it does at least 10% of the time for me. I have pasted below what
little stack trace info I get from Visual Studio after the stop is
called. What baffles me is that it seems to show that the stop calls
libvlc_media_get_user_data. Looking at the VLC source code I could not
find this. libvlc_media_player_stop does not seem to call

Any ideas, avenues to try, etc. is immensely welcomed. This one has me
stumped and is a big problem for my application.

Jacques Boileau

 	ntdll.dll!NtWaitForSingleObject()  + 0xc	
 	libvlccore.dll!vlc_cond_wait()  + 0x4c	
 	libvlccore.dll!__vlc_object_detach()  + 0xea6	
 	libvlccore.dll!__var_DelCallback()  + 0x2a	
 	libvlc.dll!libvlc_media_get_user_data()  + 0xba	
 	libvlc.dll!libvlc_media_player_stop()  + 0x3f

More information about the vlc-devel mailing list