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
Jump / seek makes video to freeze for few seconds if playback speed is increased #24324
Comments
also noticed this in Omega on macOS |
This happens because of consecutive seeks that happen (after an actual seek) by https://github.com/xbmc/xbmc/blob/master/xbmc/cores/VideoPlayer/VideoPlayer.cpp#L2179-L2193
which might explain the issue |
The comment you quoted is from stone age (svn times) and misleading. Not sure why I didn't remove it 9 years ago. Also a long time :) @enen92 going 1.5 or >2x is a different story. 1.5 is tempo with working audio (implemented much later than this logic here) and ff/rw. First check it seek also fails with ff. |
@FernetMenta resetting m_SpeedState unfortunately does not work,
Would this be a proper fix or do you have any other suggestions? |
I think this is correct. Maybe some cosmetics: instead of memset m_SpeedState in some places you could add a reset method (with current pts) to this struct and call it FlushBuffers too. |
It improved seeking while fast forwarding but not with tempo play unfortunately. |
Hum I did not test seeks with tempo up/down, only the actual playback. Will try to take a look |
@CrystalP I think I've found the issue. Can you give a go to the following patch?
I think the issue is that since tempo gives non 1000ms multiplier playspeeds (e.g. 1100, 1500, etc) when correcting the overall error with the error window we are in fact dividing by 1 instead of 1.5/1.3, etc. I can't get into the seek a bit below all the time when seeking with tempo enabled but regardless, the few times I hit it (the source of picture freeze) the error is really small (and we can avoid the thresold if we correctly calculate the error window). |
@FernetMenta sorry to bother yet again. Made a few more tests with seeking with tempo enabled and the player in some conditions still freezes for a few seconds. It doesn't happen all the time but seems to depend on whether PLAYER_STARTED messages are received due to synchronisation or something similar. This does not happen when doing seeks with ff/rw.
I.e. the player seem to require the discard of the any |
I won't remove this condition
but just add the tempo condition. Something like
The logic is very simple here. If both stream players, audio and video, are active, you need to sync audio and video. This is not true for ff/rw where audio is muted. |
That was my first attempt actually. The issue is that in the case of tempo (if tempo is smaller than 1 - e.g. 0.8) this block of code below can stall the player completely:
We're left with a 100% buffer spinning wheel with no video or audio. It does not happen for tempo > 1 though (and also does not happen if we only allow it for speed normal or paused) |
If this is the case, you should investigate why this happens and what conditions keep player in this situation. |
I should have anticipated that answer :D All things combined, the patch below seems to fix it for all seek use cases (normal, tempo and ff/rw):
Moved the tempo range condition to the end to save clock cycles when paused (the other conditions should be faster since they don't have calculations involved). Would you consider this a proper fix for the issue @FernetMenta? |
Looks good to me. Good job! |
@enen92 thank you very much for the fix! |
Bug report
Describe the bug
Here is a clear and concise description of what the problem is:
(Note: this is about
tempoup
and not about "fast forward".)Video always freezes for few seconds even if I do "jump" just for 10 seconds ahead.
I tried to increase cache - it did not help. I mean for local video file, not even a network stream. I also tried to disable hardware decoding, switching other video related settings - no effect.
And I have this issue on all my devices / OSes: certified android tv box with Amlogic S905X4 and PC with Linux/Windows with i5-8259U. For Windows it was freshly installed kodi with default settings.
I tested on videos such: 720p h264, 1080p h264, 4k h265.
Just to be sure that this is not hardware issue: there is no freeze on Linux with vlc / mpv and Android TV with mx player / vimu.
Expected Behavior
Here is a clear and concise description of what was expected to happen:
Jump / seek should not make video to freeze if playback speed is increased.
Actual Behavior
Jump / seek makes video to freeze for few seconds if playback speed is increased.
Possible Fix
To Reproduce
Steps to reproduce the behavior:
tempoup
(not via "fast forward")Debuglog
The debuglog can be found here:
https://paste.kodi.tv/uyiyorisox.kodi
Screenshots
Here are some links or screenshots to help explain the problem:
Additional context or screenshots (if appropriate)
Here is some additional context or explanation that might help:
Your Environment
Used Operating system:
Android
iOS
tvOS
Linux
macOS
Windows
Windows UWP
Operating system version/name: Linux 6.5.0-14 (Ubuntu 23.10), Android (Google) TV 11, Windows 11
Kodi version: 20.2
note: Once the issue is made we require you to update it with new information or Kodi versions should that be required.
Team Kodi will consider your problem report however, we will not make any promises the problem will be solved.
The text was updated successfully, but these errors were encountered: