Right method to release vlc
Posted: 22 May 2019 11:26
Hello,
I have a wxWidgets application with a few panels where I use vlc to read some videos, so when I start the application several windows are instantiated.
When I exit the application there are some random deadlocks.
When I google about that I can find the following thread: [url]https://forum.videolan.org/viewtopic.php?t=87932[/url].
So I will try it but I have another question about the right method to release a vlc, here is how I am doing it:
or do I only need to call libvlc_release and everything is done automatically ?
On internet when I look at samples everyone is doing it differently so hard to know what is the right solution.
I have a wxWidgets application with a few panels where I use vlc to read some videos, so when I start the application several windows are instantiated.
When I exit the application there are some random deadlocks.
When I google about that I can find the following thread: [url]https://forum.videolan.org/viewtopic.php?t=87932[/url].
So I will try it but I have another question about the right method to release a vlc, here is how I am doing it:
Code: Select all
wxVideoPlayerCtrl::~wxVideoPlayerCtrl()
{
// Not sure the lock is necessary...
wxCriticalSectionLocker lock(m_critsect);
if (m_mlp)
{
GetVlcAPI()->libvlc_media_player_stop(m_media_player);
GetVlcAPI()->libvlc_media_list_player_stop(m_mlp);
GetVlcAPI()->libvlc_media_player_release(m_media_player);
GetVlcAPI()->libvlc_media_list_release(m_ml);
GetVlcAPI()->libvlc_media_list_player_release(m_mlp);
GetVlcAPI()->libvlc_release(m_vlc_inst);
}
delete m_vlc;
m_vlc = nullptr;
}
On internet when I look at samples everyone is doing it differently so hard to know what is the right solution.