unosquare / ffmediaelement

FFME: The Advanced WPF MediaElement (based on FFmpeg)
https://unosquare.github.io/ffmediaelement/
Other
1.17k stars 238 forks source link

Changing capture device multiple times makes media element freeze #578

Open mountrivers opened 2 years ago

mountrivers commented 2 years ago

Changing caputer device multiple times makes media element freeze.

I made combobox to select webcam, audio device list

and my code is this

            if (Media.IsOpen)
                await Media.Stop();
            string resultUri = "";
            if (String.IsNullOrEmpty(videoDevice) && string.IsNullOrEmpty(audioDevice))
                return;
            else if ( string.IsNullOrEmpty(audioDevice))
                resultUri = $"device://dshow/?video={videoDevice}";
            else if ( string.IsNullOrEmpty(videoDevice))
                resultUri = $"device://dshow/?audio={audioDevice}";
            else
                resultUri = $"device://dshow/?audio={audioDevice}:video={videoDevice}";

            System.Uri uri = new System.Uri(resultUri);
            var a = await Media.Open(uri);
            var b = await Media.Play();
            Trace.WriteLine($"{a} / {b} ");

If i change video or audio device about 3~7 times

media element freeze

This is also Happen in Sample File.

Issue Categories

Version Information

Steps to Reproduce

[ in sample program ]

  1. Step 1 - device://dshow/?audio=AudioDeviceA:video=VideoDeviceA
  2. Step 2 - device://dshow/?audio=AudioDeviceB:video=VideoDeviceA
  3. Step 3 - device://dshow/?audio=AudioDeviceA:video=VideoDeviceA

Expected Results

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.