[vlc-devel] Potential race condition in libvlc_media_player_play

Hugo Beauzee-Luyssen beauze.h at gmail.com
Thu Apr 30 17:06:35 CEST 2009


Hi,

I'm currently working on VLMC, which uses the libvlc.
I've recently came across something I think is a bug :
When I load and play a file (in my test, especially a mpeg file)
sometimes it fires a libvlc_MediaPlayerPlaying, but sometimes (in most
of the case actually) it don't.

After reviewing the code, I think the problem is located in the
libvlc_media_player_play() code :
basically, the function create an input thread, which will execute the
Run function, that will call Init, and after a few other calls, it
finally calls Trigger, which is supposed to call a callback, which is
set at the end of the media_player_play function ( var_AddCallback(
p_input_thread, "intf-event", input_event_changed, p_mi ); )

The problem is, in some cases, that callback is set after the Trigger
function has been called, therefore, the callback is never called, and
no event is fired.

I'd love to fix this, however I'm not really confident in touching the
way vlc handles the threads... before doing anything stupid, does
anyone has any hints on how I could fix this ?

Thanks by advance !

--
Hugo Beauzée-Luyssen



More information about the vlc-devel mailing list