Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

VlcControl.Dispose never ends after trying to open Blu-ray disk without licensing or after ejecting the disc #691

Open
1 task done
Asteron1024 opened this issue Jun 17, 2021 · 1 comment

Comments

@Asteron1024
Copy link

I have an issue about Vlc.DotNet.

Generic information

  • Vlc.DotNet version : 3.1.0
  • Vlc.DotNet project used : WPF/WinForms
  • libvlc version : 3.0.7 (x86/x64)
  • .net version : 4.7.2
  • Project language : C#
  • Project build architecture : x86/x64
  • Operating system : Windows 10 x64 v2004

Summary

I run Samples.Wpf.Advanced project and play blu-ray disc source
To set license for the blu ray disc i added setting environment vabiable MAKEMKVCON to windows constructor and when starting to play I write my blu-ray key in the memory mapped file.
It good works in normal conditions but if I eject the disc during loading or not call SetLicense() at all, the next call of VlcControl.Dispose never ends and the application is in deadlock

        public MainWindow()
        {
            InitializeComponent();
            var currentAssembly = Assembly.GetEntryAssembly();
            var currentDirectory = new FileInfo(currentAssembly.Location).DirectoryName;
            var libDirectory = new DirectoryInfo(System.IO.Path.Combine(currentDirectory, "libvlc", IntPtr.Size == 4 ? "win-x86" : "win-x64"));
            vlcLibDirectory = new DirectoryInfo(libDirectory );

            var localPath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
            var makemkvRelativePath = Environment.Is64BitProcess ? @"makemkvcon64.exe" : @"makemkvcon.exe";
            var makemkvPath = Path.Combine(localPath, makemkvRelativePath);
            Environment.SetEnvironmentVariable("MAKEMKVCON", makemkvPath);
        }

        private void PlayButtonClick(object sender, RoutedEventArgs e)
        { 
            this.control?.Dispose();
            this.control = new VlcControl();
            this.ControlContainer.Content = this.control;
            this.control.SourceProvider.CreatePlayer(this.vlcLibDirectory);

            this.control.SourceProvider.MediaPlayer.Log += (_, args) =>
            {
                string message = $"libVlc : {args.Level} {args.Message} @ {args.Module}";
                System.Diagnostics.Debug.WriteLine(message);
            };

            control.SourceProvider.MediaPlayer.Play(new Uri(@"bluray:///F:\"));

            // Writing to memory mapped file here
            SetLicense();
        }

        private void StopButtonClick(object sender, RoutedEventArgs e)
        {
            this.control?.Dispose(); // this call never ends if not calling SetLicense() or eject the disc during loading the disc 
        }

How to stop or dispose correctly VlcControl in this case?

  • I confirm that my issue doesn't happen in VLC itself.
@jeremyVignelles
Copy link
Collaborator

Looks similar to #625 : There are a lot of these issues in libvlc, and I was told they would likely be fixed in libvlc 4 with the new stop async.
Unfortunately, this project is dead and will never be compatible with libvlc4

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants