[vlc-devel] Another HLS question: vlc_object_alive vs. Close

Chris Smowton cs448 at cam.ac.uk
Mon Jun 4 22:48:16 CEST 2012


Hi,

I just fixed an interesting bug in the HTTP live streaming module: when 
being used via (at least) the QT GUI, it seemed we could rely on getting 
a synchronous kill when the media finished, meaning that by the time 
Close methods were called vlc_object_alive(...) would return false. 
However when using the same thing via (at least) the vlcj bindings for 
libvlc, it wasn't practical to synchronously call vlc_object_kill from 
within the event handler for media ending because by the time my code 
gets the event it has already been marshalled across a thread boundary 
and we've likely returned from the event handler routine.

The upshot of all of this is that httplive.c::Close can get called when 
vlc_object_alive(...) still returns true, and in that situation we 
vlc_join waiting for a thread that will not die.

My fix was simply to add an extra b_closed flag and replace all 
vlc_object_alive with (!b_closed) && vlc_object_alive, but is that 
right? What are the rules for Close vs. the state of vlc_object_alive? 
Is it a bug in the bindings not to respond to an EOF with an immediate 
kill, or should modules be able to deal with that situation?

Chris



More information about the vlc-devel mailing list