mpvnet-player / mpv.net

🎞 mpv.net is a media player for Windows with a modern GUI.
GNU General Public License v2.0
3.43k stars 160 forks source link

Cannot launch from secondary monitor. #397

Closed User-3090 closed 2 years ago

User-3090 commented 2 years ago

Cannot launch mpvnet by clicking a file if file manager / explorer is located on secondary monitor. Nothing happens. No windows opens. I'm sort of guessing this might have to do with color management. Both screens have ICC profiles assigned.

Config:

Editor

vo=gpu-next icc-profile-auto vf=format=colormatrix=bt.709 vf=format=primaries=bt.709

Win10, RTX 3090, 472.xx Nvidia driver.

stax76 commented 2 years ago

With default settings, it's not reproducible, you can try starting from a console and check if errors are printed on the console.

User-3090 commented 2 years ago

Reverted to default config and same thing happens. Also happens when launching from cmd.exe. If cmd.exe Window is on primary screen it launches fine, if on second screen I get this trace:

Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at libmpv.mpv_command(IntPtr mpvHandle, IntPtr strings) at mpvnet.CorePlayer.CommandV(String[] args) at mpvnet.CorePlayer.ShowLogo() at mpvnet.MainForm.OnResize(EventArgs e) at System.Windows.Forms.Control.OnSizeChanged(EventArgs e) at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight) at System.Windows.Forms.Control.UpdateBounds() at System.Windows.Forms.Control.WmCreate(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.Form.WmCreate(Message& m) at mpvnet.MainForm.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

User-3090 commented 2 years ago

Forgot to mention, that the second screen is in portrait orientation if that matters.

stax76 commented 2 years ago

I'm not able to reproduce it, but probably can work around it.

stax76 commented 2 years ago

You can now try the new beta version, it should handle this issue.

User-3090 commented 2 years ago

Unfortunately the beta doesn't fix it. The trace print is gone. Now no output to terminal at all. Is there any flag for more verbose logging? Thanks for all your time and efforts in this project!

stax76 commented 2 years ago

Sorry about the delay, I was working on another issue.

You can generate a log file:

https://mpv.io/manual/master/#options-log-file

If you use mpv instead of mpv.net, does that work?

User-3090 commented 2 years ago

Sorry for the delay:

stax76 commented 2 years ago

To try if the problem is caused by an option, the command line option --config=no can be used (same as with original mpv).

If that does not work, I so far have nothing which can provide a hint on how to reproduce the problem, which typically means there is nothing I can do until a way is found to reproduce the issue.

AccessViolationException typically means the problem happens in native code, in libmpv, it's possible that it exists in mpv too but goes unnoticed because there is no .NET Runtime that detects it.

Do you see <LogoCrash>true</LogoCrash> in settings.xml? It means the code has crashed in the ShowLogo routine, it then does not execute the routine a second time. It's also possible to disable the logo drawing by putting show-logo = no in mpvnet.conf. If it's not solving the problem, it means the problem lies deeper.

User-3090 commented 2 years ago

<LogoCrash>false</LogoCrash> and show-logo = no makes no difference. It's been ages since I did .NET development, but I'll try to clone the repo and see what I can figure out when I have a bit of time.

Can't I use ProcDump to get a dump and view in WinDBG? I forget all the flags. If you are using that for development, do have a cmd line I could try? Once I have dump I can probably get around in WinDBG.

User-3090 commented 2 years ago

Okay, I figured out what is causing the crash:

Screen 1 is set 125% scaling in windows Screen 2 is set to 100% scaling in windows

in that config it crashes when launched from screen 2

when setting screen 2 also to 125% scaling it works fine!

stax76 commented 2 years ago

You found it. I'll try to fix it, but might need some days.

stax76 commented 2 years ago

I can reproduce it now!

stax76 commented 2 years ago

My error handing was faulty, in the last beta you can change the option:

UI > show-logo

Disabling it should prevent the issue.

stax76 commented 2 years ago

I found the problem now, it will be fixed in the next release.

User-3090 commented 2 years ago

Thanks, can't wait for a new release to test. I haven't seen a donation button anywhere. If it does exist, appreciate if you could point me to it :)

stax76 commented 2 years ago

Thanks considering a donation, which you can do here:

https://ko-fi.com/stax76

Here is a hotfix:

mpvnet.zip