Mutex problems when stopping libvlc
Posted: 19 Apr 2010 10:24
by alb84
I am having some problems when stopping libvlc by clicking on a stop button...
I am using vmem output and lock and unlock callbacks which Wait and Release a Win32 Mutex but sometimes when I click on Stop the whole interface freezes...
What is the correct way to stop libvlc and handling the mutex correctly?
Re: Mutex problems when stopping libvlc
Posted: 19 Apr 2010 12:37
by alb84
Actually I commented the mutex and all the calls to CreateMutex, WaitForSingleObject, ReleaseMutex, and CloseHandle and run the code on a single core machine.
What I do is just call all the init stuff
...
m_vlcMediaplayer = libvlc_media_player_new( m_vlcInstance, &m_ex );
...
libvlc_media_player_play( m_vlcMediaplayer, &m_ex );
and the stop stuff
...
libvlc_media_player_stop( m_vlcMediaplayer, &m_ex );
...
libvlc_media_player_release( m_vlcMediaplayer );
...
I call no mutex stuff in the lock and unlock vmem callbacks.
Yet, even like this, sometimes the player is succesfully released, and sometimes not, and my gui freezes.
How the thread automatically created by libvlc works?
Is there an example to have an asynchronous stop work correctly?
Re: Mutex problems when stopping libvlc
Posted: 19 Apr 2010 19:21
by RĂ©mi Denis-Courmont
There is a known bug in VLC versions < 1.1.0 whereby _stop can dead lock. This probably has nothing to do with your vmem callbacks. Please update to LibVLC 1.1.
Re: Mutex problems when stopping libvlc
Posted: 20 Apr 2010 10:40
by alb84
Where I can get libVLC 1.1? The latest VLC client available for download is still 1.0 and I generated libvlc.lib from libvlc.dll as described here
http://wiki.videolan.org/GenerateLibFromDll