Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.AccessViolationException occurred in D3DRenderer #89

Open
mi1124 opened this issue Nov 9, 2018 · 9 comments
Open

System.AccessViolationException occurred in D3DRenderer #89

mi1124 opened this issue Nov 9, 2018 · 9 comments

Comments

@mi1124
Copy link

mi1124 commented Nov 9, 2018

Hi,

I get the following exception in D3DRenderer in SetBackBufferInternal():
System.AccessViolationException occurred. An attempt was made to read or write in the protected memory. This is often an indication that other memory is corrupted.

StackTrace:
bei MS.Win32.PresentationCore.UnsafeNativeMethods.InteropDeviceBitmap.Create(IntPtr d3dResource, Double dpiX, Double dpiY, UInt32 version, FrontBufferAvailableCallback pfnCallback, Boolean isSoftwareFallbackEnabled, SafeMILHandle& ppInteropDeviceBitmap, UInt32& pixelWidth, UInt32& pixelHeight)
bei System.Windows.Interop.D3DImage.SetBackBuffer(D3DResourceType backBufferType, IntPtr backBuffer, Boolean enableSoftwareFallback)
bei Vdi.VideoFramework.MediaPlayer.D3DRenderer.SetBackBufferInternal(IntPtr backBuffer) in D:\Sources\Repository\Main\Components\VideoFramework_2015\SourceCode\VideoFramework\MediaPlayer\D3DRenderer.cs:Zeile 387.

  • this exception occurs after sometime when I try playing mulitple videos .
  • I used [System.Runtime.ExceptionServices.HandleProcessCorruptedStateExceptionsAttribute()] on the function which was causing the AccessViolationException, but the application still crashes.

Any workaround for this exception?

@xmedeko
Copy link
Collaborator

xmedeko commented Nov 13, 2018

@mi1124
Copy link
Author

mi1124 commented Nov 13, 2018

Using EVR Presenter. The crash is only happening if TWO or more monitors are connected. It seems it doesnt happen if only one monitor is connected to the PC.

@xmedeko
Copy link
Collaborator

xmedeko commented Nov 13, 2018

Try VMR9 presenter. IMHO it's better than WPF-MediaKit EVR presenter. (I do not think VMR9 is generally better than EVR, just this this implementation of EVR is not perfect.)

@mi1124
Copy link
Author

mi1124 commented Nov 14, 2018

Sorry , it is not the number of monitors connected to the PC that is causing the crash.
The code crashes at - D3DImage.SetBackBuffer(D3DResourceType.IDirect3DSurface9, backBuffer, true);
with " Access Violation Exception in PresentationCore.dll. An attempt was made to read or write in the protected memory. This is often an indication that other memory is corrupted. "

Do you know how can I prevent backBuffer(i.e, pointer) from accessing protected memory?

@xmedeko
Copy link
Collaborator

xmedeko commented Nov 14, 2018

It works for well for me and many others. You have either some other problem in your setup or you have hit some WPF bug. Try VMR9 renderer.

@olivegamestudio
Copy link

I'm having the same symptom (callstack crash). I have my videos set to VMR9 too.

I simply have a single screen setup, then whilst videos are playing plugin another screen to the setup and pop with an access violation.

@xmedeko
Copy link
Collaborator

xmedeko commented Mar 15, 2019

How do play your videos on another screen? Can you reproduce the bug somehow with the Test Application? I use playing video on another screen - i.e. open WPF Window window on another screen with the player - and it works fine.

@olivegamestudio
Copy link

olivegamestudio commented Mar 15, 2019

I have a couple of videos playing on the primary screen only. i dont put them on the secondary screen or move them at all. where can i find the test application?

@xmedeko
Copy link
Collaborator

xmedeko commented Mar 15, 2019

You have written "then whilst videos are playing plugin another screen".
Test Application: https://github.com/Sascha-L/WPF-MediaKit/tree/master/Test%20Application
Also, try some other computer (with different graphics card), if you have dual or hybrid graphics card, try to switch to the other card.

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

No branches or pull requests

3 participants