unosquare / ffmediaelement

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

.net 6.0 update - ntdll.dll fault #582

Closed alesebi91 closed 2 years ago

alesebi91 commented 2 years ago

.net 6.0 update - ntdll.dll fault

Hi, after updating my WPF app to dotnet 6.0 using the latest nuget package version (FFME.Windows.Wpf v4.4.350) I encountered the following problem:

Faulting application name: MyApp.exe, version: 0.0.2.0, time stamp: 0x61735063
Faulting module name: ntdll.dll, version: 10.0.19041.1288, time stamp: 0xa280d1d6
Exception code: 0xc0000409
Fault offset: 0x00000000000a2070

It occurs when after playing a video I try to play another one:

<ffme:MediaElement x:Name="VideoSlideshowMediaElement" Grid.Row="0"
   LoadedBehavior="Play"
   LoopingBehavior="Stop"
   Stretch="Fill">
</ffme:MediaElement>
//Code behind - play the first video
await VideoSlideshowMediaElement.Open("C:\MyVideoFolder\FirstVideo.mp4");
//Code behind - play the second video after previous end
VideoSlideshowMediaElement.MediaEnded += async (sender, e) =>
{
   await VideoSlideshowMediaElement.Open("C:\MyVideoFolder\SecondVideo.mp4");
};

VideoSlideshowMediaElement.MediaReady += (sender, e) =>
{
   if (Math.Round(VideoSlideshowMediaElement.ActualPosition.Value.TotalSeconds) > 0)
   {
      VideoSlideshowMediaElement.Position = TimeSpan.Zero;    //Seek to 0
   }
};

Using the same code with dotnet 5.0 it works like a charm.

Issue Categories

Version Information

Steps to Reproduce

  1. Step 1 Play a video from local source
  2. Step 2 Play second video from local source

Expected Results

No errors

Sample Code

XAML

<ffme:MediaElement x:Name="VideoSlideshowMediaElement" Grid.Row="0"
   LoadedBehavior="Play"
   LoopingBehavior="Stop"
   Stretch="Fill">
</ffme:MediaElement>

C

//Code behind - play the first video
await VideoSlideshowMediaElement.Open("C:\MyVideoFolder\FirstVideo.mp4");
//Code behind - play the second video after previous end
VideoSlideshowMediaElement.MediaEnded += async (sender, e) =>
{
   await VideoSlideshowMediaElement.Open("C:\MyVideoFolder\SecondVideo.mp4");
};

VideoSlideshowMediaElement.MediaReady += (sender, e) =>
{
   if (Math.Round(VideoSlideshowMediaElement.ActualPosition.Value.TotalSeconds) > 0)
   {
      VideoSlideshowMediaElement.Position = TimeSpan.Zero;    //Seek to 0
   }
};
alesebi91 commented 2 years ago

Found correlation with bug #586 (MediaEnded fires multiple times)