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

Lag when scrolling horizontally to seek in build 1.3.0 and 1.3.1 #4153

Closed
AlejandroVolkova opened this issue Dec 29, 2022 · 16 comments · Fixed by #4276
Closed

Lag when scrolling horizontally to seek in build 1.3.0 and 1.3.1 #4153

AlejandroVolkova opened this issue Dec 29, 2022 · 16 comments · Fixed by #4276

Comments

@AlejandroVolkova
Copy link

IINA used to work so well when scrolling horizontally , with the latest build it doesn't work the same anymore.

  • Model Identifier: iMac19,2
  • macOS v12.6.1 (21G217)
  • IINA v1.3.1

Expected behavior: "scroll-to-seek" smooth scrolling as previous version (IINA 1.2.0)

Actual behavior: it looks super laggy now , it doesn't work well as before.

How often does this happen?
Every time

@trksa
Copy link

trksa commented Jan 7, 2023

facing same issue on M1 Max macOS 13.1

@low-batt
Copy link
Contributor

Did not reproduce for me.

I'm testing on a MacBookPro18,2 with the M1 Max chip running under macOS 13.1. I tried scrolling horizontally using the mouse scroll wheel while hovering over the OSC. I did not see speed difference between IINA 1.2.0 and IINA 1.3.1. Scrolling was fast. I was playing a downloaded copy of Big Buck Bunny 60fps 4K - Official Blender Foundation Short Film.

There must be another factor that is coming into play.

Any use of external devices? For example Bluetooth speakers?

Does the behavior change if hardware decoding is disabled?

Do all videos you play exhibit the problem?

Does the mpv player also lag when scrolling?

@trksa
Copy link

trksa commented Jan 17, 2023

I tried replicating it again using the same video you linked on IINA 1.3.1 and I discovered something.

Scrolling horizontally using the mouse scroll wheel while hovering over the OSC (while video is playing) is smooth. However using the trackpad or the side scroll wheel on MX Master mouse is not.

Pausing the video and using the mouse scroll wheel while hovering over the OSC is also not smooth.

IINA 1.2.0 is smooth in all the cases mentioned.

I'm using a wireless keyboard and mouse but no speakers.

Disabling hardware decoding does not help.

All videos do exhibit the problem.

mpv player does not lag when scrolling playing the same video.

Hope this helps, let me know if you want me to provide more information.

@low-batt
Copy link
Contributor

I too am using a MX Master mouse that has the side scroll wheel in addition to the normal scroll wheel. I'm using it through Bluetooth, not Logi Bolt USB receiver. I uninstalled Logitech Options after encountering a problem where the scroll wheel stopped working. It appears that application is being superseded by the new Logi Options+. I've not tried the new software.

I tried reproducing the problem using the trackpad and the mouse side scroll wheel, both with the video playing and with it paused. No luck,

I'm scratching my head on this one. Our systems are really similar.

Logs may or may not provide some information about the problem. Lets collect them and see if there is any clue to the problem in them.

Logging is disabled by default. To enabled logging follow these instructions:

  • Start IINA
  • Click on Settings… under the IINA menu
  • The settings panel appears
  • On the left side of the panel click on Advanced
  • Slide the Enable advanced settings toggle button to be on (blue)
  • Click on the checkbox Enable logging
  • Confirm the settings panel looks like the screenshot below
  • Restart IINA to activate logging

issue-4153

Once IINA has restarted, play the video and reproduce the problem. Then:

  • Click on Settings… under the IINA menu
  • The settings panel appears
  • On the left side of the panel click on Advanced
  • Click on Open log directory
  • A new Finder window appears containing the logs for this session
  • Quit IINA to complete the log files

The Finder window contains two files, iina.log and mpv.log. To attach the log files to this issue, drag-n-drop them from the Finder window to the Leave a comment section below. Include both the iina.log and the mpv.log

The log files can also be accessed using Terminal as shown here:

low-batt@gag com.colliderli.iina$ pwd
/Users/low-batt/Library/Logs/com.colliderli.iina
low-batt@gag com.colliderli.iina$ ls
2022-10-04-17-57-15_jVrbWy
low-batt@gag com.colliderli.iina$ cd 2022-10-04-17-57-15_jVrbWy
low-batt@gag 2022-10-04-17-57-15_jVrbWy$ ls
iina.log	mpv.log
low-batt@gag 2022-10-04-17-57-15_jVrbWy$ 

With logging enabled IINA creates a new log directory each time it is started. If accessing the logs using Terminal be sure to obtain them from the latest log directory.

DO NOT FORGET to disable logging once you have obtained log files for the problem being investigated. IINA does not restrict the size of log files or delete old logs. If you leave logging enabled the logs will continue to accumulate.

@trksa
Copy link

trksa commented Jan 17, 2023

That is indeed strange, I too am using the mouse through bluetooth. I am using the Logi Options+ app and I do face some issues often where the settings I have selected for the mouse (system-wide) are not applied for a few seconds after wake up from sleep.

I followed the instructions, here are the files for iina.log and mpv.log

I started by recreating the problem then I used the middle scroll wheel to scroll smoothly

@low-batt
Copy link
Contributor

The issue author, @AlejandroVolkova, indicates IINA 1.3.0 also exhibits the problem, not just 1.3.1. Is that true for you as well? Does IINA 1.3.0 also lag when scrolling?

@trksa
Copy link

trksa commented Jan 18, 2023

Yes, in fact I have encountered this same issue in every version post 1.2.0 including IINA+ versions that have the HDR function implemented

@low-batt
Copy link
Contributor

The evidence you have been providing is very helpful.

To bring my system closer to yours I have allowed it to be infested with Logi Options+. I am now experiencing lagging when scrolling with the mouse side scroll wheel under IINA 1.3.1. This lagging does not occur under IINA 1.2.0. I think I have now reproduced the offending behavior being reported in this issue.

I consider this an important regression that must be explained. Next step is for me to debug this and identify the code change that is causing the difference in behavior between IINA 1.2.0 and 1.3.*.

I'm juggling multiple issues at the moment but will definitely be digging into this one.

@AlejandroVolkova
Copy link
Author

AlejandroVolkova commented Jan 18, 2023

Hey guys, sorry for the late reply, I want to mention that I am using the Magic Mouse, and the only bluetooth devices I am currently using are my Magic Mouse and my Magic Keyboard. I do not have nor have I used other mouse like the one you have. I also did all the tests you requested with all the IINA versions in question.

Logs IINA 1.2.0 :
IINA_1.2.0_iina.log
IINA_1.2.0_mpv.log

Logs IINA 1.3.0 :
IINA_1.3.0_iina.log
IINA_1.3.0_mpv.log

Logs IINA 1.3.1 :
IINA_1.3.1_iina.log
IINA_1.3.1_mpv.log

Note 1 : The issue persists when the hardware decoder option is disabled. In both 1.3.0 and 1.3.1

Note 2 : Tested MPV.app (nightly build 20200928) when scrolling forward or backward the video also jumps, it does not look smooth as in IINA 1.2.0.

Note 3 : (off-topic) I would also like to mention that there is a difference between the colors in the videos from IINA 1.3.0 onwards, they look more saturated for some reason.

Bluetooth devices:

Magic Mouse | Model ID : A1657
Magic Keyboard | Model ID : A1644

I hope this information is helpful , if there’s anything you need to test just let me know.

@low-batt
Copy link
Contributor

Thanks for posting the logs and the other information. The logs match up with what I'm seeing in logs on my machine when I trigger the problem.

The report that mpv might be exhibiting some lagging is concerning. The version of the mpv library used in IINA was updated for 1.3.0.

The next step is for me to try and track down what is causing the lagging I'm experiencing and see what that tells us.

low-batt added a commit that referenced this issue Mar 19, 2023
This commit will:
- Add methods displayActive and displayIdle to VideoView
- Add use of a Timer to delay stopping the display link
- Change MPVController to ensure display link is running while seeking
- Change PlayerCore to ensure display link is running while stepping
- Change MainWindowController to ensure display link is running when
  entering and leaving full screen mode
@low-batt
Copy link
Contributor

Analysis

Performance of seeking is a complex topic. There may be other issues in play, but I'm pretty sure the primary cause of the regression in seeking performance in 1.3.0 and 1.3.1 is this code in MPVController:

// Follow energy efficiency best practices and ensure IINA is absolutely idle when the
// video is paused to avoid wasting energy with needless processing. If paused shutdown
// the timer that synchronizes the UI and the high priority display link thread.
if paused {
  player.invalidateTimer()
  player.mainWindow.videoView.stopDisplayLink()
} else {
  player.mainWindow.videoView.startDisplayLink()
  player.createSyncUITimer()
}

The trouble is the display link needs to be running for more than playback. If you pause playback and then seek mpv waits for IINA to call mpv_render_report_swap as can be seen in this message from the mpv.log:

[   7.347][v][vo/libmpv] mpv_render_report_swap() not being called.

These messages are also seen in the logs supplied by @AlejandroVolkova.

On the question of Logi Options+. Adding some debug logging, this is what macOS scroll events look like to IINA without Options+. The false indicates the scrolling deltas are not precise:

18:08:05.345 [iina][d] seekAmount 2.0 1.0 false
18:08:05.391 [iina][d] seekAmount 2.0 1.0 false
18:08:05.424 [iina][d] seekAmount 2.0 1.0 false

With Options+ installed precise scrolling deltas are provided:

15:21:02.133 [iina][d] seekAmount 2.25 9.0 true
15:21:02.342 [iina][d] seekAmount 12.0 48.0 true
15:21:02.345 [iina][d] seekAmount 9.0 36.0 true

I did not find anything wrong with these scroll events.

Fixing

The commit in the pull request will:

  • Add methods displayActive and displayIdle to VideoView
  • Add use of a Timer to delay stopping the display link
  • Change MPVController to ensure display link is running while seeking
  • Change PlayerCore to ensure display link is running while stepping
  • Change MainWindowController to ensure display link is running when entering and leaving full screen mode

@low-batt low-batt linked a pull request Mar 20, 2023 that will close this issue
2 tasks
svobs pushed a commit to svobs/iina-advance that referenced this issue Mar 25, 2023
This commit will:
- Add methods displayActive and displayIdle to VideoView
- Add use of a Timer to delay stopping the display link
- Change MPVController to ensure display link is running while seeking
- Change PlayerCore to ensure display link is running while stepping
- Change MainWindowController to ensure display link is running when
  entering and leaving full screen mode
low-batt added a commit that referenced this issue Mar 25, 2023
This commit will:
- Add methods displayActive and displayIdle to VideoView
- Add use of a Timer to delay stopping the display link
- Change MPVController to ensure display link is running while seeking
- Change PlayerCore to ensure display link is running while stepping
- Change MainWindowController to ensure display link is running when
  entering and leaving full screen mode

Rebased with develop and corrected merge conflicts.
low-batt added a commit that referenced this issue Mar 27, 2023
This commit will:
- Add methods displayActive and displayIdle to VideoView
- Add use of a Timer to delay stopping the display link
- Change MPVController to ensure display link is running while seeking
- Change PlayerCore to ensure display link is running while stepping
- Change MainWindowController to ensure display link is running when
  entering and leaving full screen mode

Rebased with develop and corrected merge conflicts.
Corrected PlayerCore.frameStep as per review comment.
svobs pushed a commit to svobs/iina-advance that referenced this issue Mar 27, 2023
This commit will:
- Add methods displayActive and displayIdle to VideoView
- Add use of a Timer to delay stopping the display link
- Change MPVController to ensure display link is running while seeking
- Change PlayerCore to ensure display link is running while stepping
- Change MainWindowController to ensure display link is running when
  entering and leaving full screen mode

Rebased with develop and corrected merge conflicts.
Corrected PlayerCore.frameStep as per review comment.
uiryuu pushed a commit that referenced this issue Mar 28, 2023
This commit will:
- Add methods displayActive and displayIdle to VideoView
- Add use of a Timer to delay stopping the display link
- Change MPVController to ensure display link is running while seeking
- Change PlayerCore to ensure display link is running while stepping
- Change MainWindowController to ensure display link is running when
  entering and leaving full screen mode

Rebased with develop and corrected merge conflicts.
uiryuu pushed a commit that referenced this issue Mar 28, 2023
This commit will:
- Add methods displayActive and displayIdle to VideoView
- Add use of a Timer to delay stopping the display link
- Change MPVController to ensure display link is running while seeking
- Change PlayerCore to ensure display link is running while stepping
- Change MainWindowController to ensure display link is running when
  entering and leaving full screen mode

Rebased with develop and corrected merge conflicts.
Corrected PlayerCore.frameStep as per review comment.
@uiryuu uiryuu reopened this Mar 28, 2023
@low-batt
Copy link
Contributor

IINA 1.3.2 contains the fix for this issue.

@YU0211
Copy link

YU0211 commented Jul 20, 2023

1.3.2 does not work for this on my M2 MacBook

@low-batt
Copy link
Contributor

@YU0211 I noticed your comment and just finished running a test trying to trigger a problem with IINA 1.3.2. I tried scrolling while the audio was playing through a Bluetooth speaker. Using a mouse over the OSC and scrolling IINA 1.3.2 was very responsive. Using the arrow keys to seek ahead was also responsive.

Please enter a new issue with more details about what is going wrong for you on the M2.

@YU0211
Copy link

YU0211 commented Jul 21, 2023

thank you for your notice , my version is also 1.3.2 with bluetooth device, and i tried to play youtube video by pasting link to IINA , in that circumstance I have to wait about 3 seconds every time i press left or right or scrolling .The internet speed is about 300M , so I think the issue may not comes from the internet. Also I'm not sure this relates to the bluetooth problem. sorry for causing misunderstanding. willing to see this problem fixed

@low-batt
Copy link
Contributor

@YU0211 I've entered issue #4522 for your report. We should continue the discussion in that issue.

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

Successfully merging a pull request may close this issue.

5 participants