Meta.Vlc
Meta.Vlc copied to clipboard
Potential handle leak when recreating VlcPlayer instances
I'm encountering a potential handle leak when recreating a VlcPlayer
instance every second. Here's the code;
public MainWindow()
{
InitializeComponent();
var disp = Dispatcher;
Meta.Vlc.Wpf.VlcPlayer vlc = new VlcPlayer(disp);
vlc.Initialize("libvlc");
vlc.LoadMedia("1.mp4");
vlc.Play();
Task.Run(async () =>
{
while (true)
{
await Task.Delay(1000);
vlc.Stop();
vlc.Dispose();
disp.Invoke(() =>
{
vlc = new VlcPlayer(disp);
vlc.Initialize("libvlc");
vlc.LoadMedia("1.mp4");
vlc.Play();
});
}
});
}
It's really lazy, I know.
On the arrow is where I started the above code and let it run for a while. The graph shows open handles by process. The above code is all that's done in the project. There's no other code running.
I'm also getting the handle leak in my custom VlcPlayer, using my own render process through SetVideoDecodeCallbacks
, etc.
Any ideas?
Create player is a very heavy operation, I think you should multiplexing players.