Samillion / ModernZ

A sleek and modern OSC for mpv designed to enhance functionality by adding more features, all while preserving the core standards of mpv's OSC.
GNU Lesser General Public License v2.1
53 stars 5 forks source link

Minimize, maximize and close buttons unresponsive after pausing the video #18

Closed Xurdejl closed 1 month ago

Xurdejl commented 1 month ago

The minimize, maximize, and close buttons become unresponsive after pausing a video. This issue doesn't always occur immediately after pausing. Entering and exiting full screen seems to make them work again.

Samillion commented 1 month ago

I'm unable to reproduce this, could you do the following please:

When you're running it with --v, try to reproduce the problem so it's shown in the logs.

Xurdejl commented 1 month ago

here are the logs output.txt

Samillion commented 1 month ago

The most notable thing from your log is this:

[  27.389][d][osd] Spent 14.227 ms in osd_render (slow!)

From what I can tell, you used the seekbar, which generated thumbnails, paused, maximized, unpaused...etc Each time osc is initiated just fine:

[  26.077][d][modernz] osc_init

[  24.898][d][cplayer] Run command: disable-section, flags=64, args=[name="input"]
[  24.898][d][cplayer] Run command: disable-section, flags=64, args=[name="window-controls"]

[  25.240][d][cplayer] Run command: enable-section, flags=64, args=[name="input", flags=""]
[  25.240][d][cplayer] Run command: enable-section, flags=64, args=[name="window-controls", flags=""]

[  26.087][d][cplayer] Run command: script-binding, flags=73, args=[name="modernz/__keybinding2"]

Something is causing a high load which is causing this (osd_render => slow). I noticed some invalidated LUT

This is only happening for ModernZ OSC? Looking at the logs, nothing from ModernZ is erroring or not functioning as intended.

Xurdejl commented 1 month ago

Yes, I tried replicating it on the other fork, but it worked just fine

Samillion commented 1 month ago

This is weird, I tried to reproduce using your exact config and shaders, still wasn't able to.

If you don't mind testing something. Could you run it with --border=yes and see if it happens with native window controls?

As far as I can tell, the cause is due to high load, which is causing OSD elements in general to render slowly (as shown in your log), but you said this only happens on ModernZ.

Trying to pin down the accomplice basically.

Xurdejl commented 1 month ago

I tried it, and it doesn't happen with the native controls. I also realized that it's only the maximize and minimize buttons that become unresponsive

Samillion commented 1 month ago

Perfect. I'll create a branch and give you a script tomorrow to try and see if it continues to happen.

Thank you very much for testing this, my last request, could you give me your mpv.conf and modernz.conf as you have it now?

I want to adjust the code based on your configuration, and then identify the global factor to make sure it doesn't happen to anyone.

Honestly, I might re-write the window controls elements, since they're a modified version of past forks.

Xurdejl commented 1 month ago

sure, here are my files mpv.zip

Samillion commented 1 month ago

Could you try to re-produce the bug with this version please: https://github.com/Samillion/ModernZ/blob/devel_wc_bug/modernz.lua

If possible, produce a log --v --log-file=output.txt

Samillion commented 1 month ago

A bit off-topic, but in your mpv.conf you have this:

directory-filter-types=video, audio

Does it actually add audio files to the playlist with the space? I merely ask because I had to remove the space between video, and audio, otherwise the option wasn't read correctly.

directory-filter-types=video,audio
Xurdejl commented 1 month ago

Could you try to re-produce the bug with this version please: https://github.com/Samillion/ModernZ/blob/devel_wc_bug/modernz.lua

If possible, produce a log --v --log-file=output.txt

output.txt

A bit off-topic, but in your mpv.conf you have this:

directory-filter-types=video, audio

Does it actually add audio files to the playlist with the space? I merely ask because I had to remove the space between video, and audio, otherwise the option wasn't read correctly.

directory-filter-types=video,audio

Oh, yes, it doesn't work. Thanks for pointing it out. I actually use a different player for music

Samillion commented 1 month ago

Checking your log right now. So the bug occurred again in that version, right?

I actually use a different player for music

😱 You're cheating on mpv with another player? How could you? I'm calling the police.

Samillion commented 1 month ago

I'm honestly stumped. The logs show ModernZ functioning as intended without any warns.

If you search for the keyword slow in your log, you'll see that there is definitely slow downs in render, which I assume why it would cause this issue in the OSC.

Examples from your log:

[   0.173][v][vo/gpu-next/libplacebo] Spent 106.777 ms enumerating instance extensions (slow!)
[   0.388][v][vo/gpu-next/libplacebo] Spent 177.154 ms creating vulkan device (slow!)
[   2.373][d][osd] Spent 53.591 ms in osd_render (slow!)

But what I'm stumped on is that it only happens on ModernZ for you.

I've asked the guys at irc, hopefully one will be able to guide me to what I'm not seeing.

Samillion commented 1 month ago

I just remembered a similar issue here that was resolved by updating mpv.

@Keith94 do you happen to remember which version you updated from? I want to try and locate the exact mpv git commit that resolved these issues, maybe it'll help me track this down better.

Samillion commented 1 month ago

Could you try this version please: https://github.com/Samillion/ModernZ/blob/wc_bug_a2/modernz.lua

Let me know if the bug is still happening.

Xurdejl commented 1 month ago

I'm honestly stumped. The logs show ModernZ functioning as intended without any warns.

If you search for the keyword slow in your log, you'll see that there is definitely slow downs in render, which I assume why it would cause this issue in the OSC.

Examples from your log:

[   0.173][v][vo/gpu-next/libplacebo] Spent 106.777 ms enumerating instance extensions (slow!)
[   0.388][v][vo/gpu-next/libplacebo] Spent 177.154 ms creating vulkan device (slow!)
[   2.373][d][osd] Spent 53.591 ms in osd_render (slow!)

But what I'm stumped on is that it only happens on ModernZ for you.

I've asked the guys at irc, hopefully one will be able to guide me to what I'm not seeing.

idk, maybe there is something wrong with my pc, it's quite old.

Could you try this version please: https://github.com/Samillion/ModernZ/blob/wc_bug_a2/modernz.lua

Let me know if the bug is still happening.

Tried with this and still happening

Samillion commented 1 month ago

idk, maybe there is something wrong with my pc, it's quite old.

Nah, if it's only happening on ModernZ, then it's something I did wrong.

I apologize for asking you to test a lot, could you try this update please? https://github.com/Samillion/ModernZ/blob/wc_bug_a2/modernz.lua

Xurdejl commented 1 month ago

I apologize for asking you to test a lot, could you try this update please?

No worries.

https://github.com/Samillion/ModernZ/blob/wc_bug_a2/modernz.lua

Same problem here

Samillion commented 1 month ago

Last attempt of the day, I promise: https://github.com/Samillion/ModernZ/blob/wc_bug_a2/modernz.lua

Xurdejl commented 1 month ago

Last attempt of the day, I promise: https://github.com/Samillion/ModernZ/blob/wc_bug_a2/modernz.lua

Still happening.

I noticed that normally it fixes itself if I let the osc hide.

Samillion commented 1 month ago

Thank you so much for all the tests.

I noticed that normally it fixes itself if I let the osc hide.

I adjusted the code. Whenever you're able to test, please. Bug still occurs? https://github.com/Samillion/ModernZ/blob/wc_bug_a2/modernz.lua

Xurdejl commented 1 month ago

yes, still occurs

Samillion commented 1 month ago

Last version: https://github.com/Samillion/ModernZ/blob/wc_bug_a2/modernz.lua

In this one you'll notice the title and controls are smaller.

If this doesn't fix it, I'll have to ask for some guidance, so it might take a while. Hopefully this fixes it though.

Keith94 commented 1 month ago

I can reproduce the issue too with the above linked script. Using latest mpv 4ab1ab8 built on Oct 14 2024

Samillion commented 1 month ago

Well, crap.

I'll sit down tomorrow and re-write a whole lot.

Samillion commented 1 month ago

Could you try this version and see if it's fixed in it, please: https://github.com/Samillion/ModernZ/blob/wc_bug_rewrite/modernz.lua

This is a dev version, if you notice any other bugs other than the already opened issues, please let me know.

https://github.com/Samillion/ModernZ/commit/1c523201349e662511967a33868d7f997e5c2a34

An attempt to fix Window controls not functioning:
- Re-wrote in a consistent string format for osc_styles
- Properly use full ASS tags to eliminate unclosed ones
- Add areas to control show/hide better
- Observe title-bar property

Other fixes:
- Fix unnecessary deadzone above OSC
- Fix interactive playlist hiding behind OSC if video is paused

If the bug still persists, may I ask for a favor? I apologize for the burden, only if it's not a bother.

Could you record a video showcasing the bug? I want to reproduce with the exact steps.

Samillion commented 1 month ago

If that doesn't work, I'm thinking about making an alpha cache function, so that alpha values are only done once and not every time OSC is shown/hidden. In theory it SHOULD improve performance.

Samillion commented 1 month ago

I applied the alpha cache https://github.com/Samillion/ModernZ/commit/fe5bc33b8171cd00664f04e30e76d8f4dcb1ffae

Please let me know if the bug occurs.

Keith94 commented 1 month ago

I can still reproduce it but i'll record something in a bit

Samillion commented 1 month ago

I reverted cache, it introduced new problems.

Samillion commented 1 month ago

I added tracing for window controls so that it would show up in the log https://github.com/Samillion/ModernZ/blob/wc_bug_rewrite/modernz.lua

Could you please upload a log with the bug occuring in it? Again, apologies for all the requests, and I appreciate all the testing.

Keith94 commented 1 month ago

output.txt

https://github.com/user-attachments/assets/48c61a5b-4984-4b31-916a-ed970e9c9654

the window title and controls also don't show up in fullscreen, only shows up in borderless (pinned window)

https://github.com/user-attachments/assets/b1d68dd1-6516-4c33-9a9a-f36b175d1320

double click the window controls toggle fullscreen (basically the clicks go right through)

https://github.com/user-attachments/assets/21d9a820-31c9-4361-b73d-8716f2281e8c

when the restore button works, first time you activate it, it jumps by a few pixels. not sure why

Samillion commented 1 month ago

I can finally reproduce this, thank you so much.

Video with low volume commentary lol (ignore cursor position, it's weird in there)

https://github.com/user-attachments/assets/87bf5e1e-93d9-4d22-9aef-5b4fb4a4183e

Keith94 commented 1 month ago

Yeah it's a weird one! Buttons work flawlessly if you never pause the video. 🤣

Hope that helps!

Samillion commented 1 month ago

I've come across a wall, because I'm able to reproduce the window controls/pixels bug on stock mpv

To reproduce, do the following:

https://github.com/user-attachments/assets/5c3a02d5-13cb-4d71-87e2-fea6275587fd

I was checking all code, calculations, then I decided to check and bam. Are you guys able to re-produce it as well on stock?

Keith94 commented 1 month ago

Yeah I can reproduce it as well following your steps.

Samillion commented 1 month ago

This is good news, because now I can blame someone else, which is good for my self esteem. 🤣

I've left a note to the guys on irc, and I'll open an issue later on mpv's repo.

Keith94 commented 1 month ago

Makes me wonder if that's separate than what's been raised here or if it's the same bug.

Can you reproduce bug mentioned in OP with these steps?

  1. Open video file
  2. Pin window using the button (showontop=yes)
  3. Pause playback
  4. Click maximize button

Result: window does not maximize (i.e. all three window controls won't respond to clicks)

EDIT: Actually, it's only reproducible with my config file present. Just have to narrow down the cause I think

Keith94 commented 1 month ago

If you set bottomhover=no and try my steps above, I can get the bug to happen.

Samillion commented 1 month ago

Aha! Ok, let me try real quick, was about to post a video that I couldn't reproduce.

https://github.com/user-attachments/assets/896332f0-bd28-4622-82e9-95b3148a5a32

Will try now.

Side note: stupid cursor showing in the wrong place in my videos. Y u do dis cursor.

Samillion commented 1 month ago

If you set bottomhover=no and try my steps above, I can get the bug to happen.

Ok, this is great, now I can finally reproduce the reported bug accurately, thank you very much for your constant help.

Keith94 commented 1 month ago

No worries and happy to help. Such a weirdly specific bug so it took a while to track down lol.

Samillion commented 1 month ago

Hopefully this should fix it https://github.com/Samillion/ModernZ/blob/devel_wc_pin_rc/modernz.lua

@Keith94 @Xurdejl Could you try the new version please?

I've applied the other fixes as well: https://github.com/Samillion/ModernZ/commit/833340d3597935b6dd725a1e1bd4adb5c32a6823

Fix:

Xurdejl commented 1 month ago

Hopefully this should fix it https://github.com/Samillion/ModernZ/blob/devel_wc_pin_rc/modernz.lua

It seems that this version fixed the problem.

Samillion commented 1 month ago

Awesome! Once I was able to reproduce the steps exactly, it was easier to track down. I'll wait for Keith to confirm as well, then I will merge the fix to main and make a new release.

Keith94 commented 1 month ago

LGTM 👍

Keith94 commented 1 month ago

But I think you broke the alpha of the window title bar in fullscreen mode

Unpinned:

mpv_mJf4VCQSrF

Pinned/on top mode:

mpv_PfoOAJdEET

Samillion commented 1 month ago

Should be good in here: https://github.com/Samillion/ModernZ/blob/devel_wc_release/modernz.lua

Keith94 commented 1 month ago

Should be good in here: https://github.com/Samillion/ModernZ/blob/devel_wc_release/modernz.lua

Hmmm I still don't see any fade in fullscreen with this one...

Samillion commented 1 month ago

That is weird, ok, could you show me the options you have in modernz.conf that are different from default? I'll try to reproduce that.

Fade works fine for me:

https://github.com/user-attachments/assets/7b54267d-674b-4ab0-b746-bd5da72b8f01