-
Notifications
You must be signed in to change notification settings - Fork 34
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
Throttle seeking #40
Throttle seeking #40
Conversation
This problem is because the hardware cannot handle the pressure of decoding, Easy to reproduce with high bitrate video. |
This is needlessly complex, I had that feature implemented without timers in a single line guard in thumb(). |
Decoding is not the problem, I use a 1 second buffer of decoded frames. But I'm sure better hardware would have less of a problem with it. |
I doubt it can be implemented much simpler then this without missing out on the last seek. This is the same as rendering is throttled in osc.lua and uosc. |
You're right, I've left my solution below. diff --git a/thumbfast.lua b/thumbfast.lua
index d164ca8fc8..452007c01e 100644
--- a/thumbfast.lua
+++ b/thumbfast.lua
@@ -62,6 +62,7 @@ local last_x = x
local last_y = y
local last_seek_time = nil
+local last_request = 0
local effective_w = options.max_width
local effective_h = options.max_height
@@ -408,6 +409,16 @@ local function thumb(time, r_x, r_y, script)
end
if seek_time == last_seek_time then return end
+
+ local cur_request = mp.get_time()
+
+ if cur_request - last_request < 0.1 then
+ last_seek_time = nil
+ return
+ end
+
+ last_request = cur_request
+
last_seek_time = seek_time
if not spawned then spawn(seek_time) end
run("async seek "..seek_time.." absolute+keyframes") The seek interval of 0.1 seems fine. |
616f323
to
0e7ce95
Compare
Done |
I don't know why this is such a problem, but sending commands causes the player to stutter for me. Throttling seeking commands doesn't solve the problem but it certainly helps. The last sent seek will be sent up to 100ms later then without, but in practice that doesn't really make a difference. If the last seek was long enough ago, it will send the command immediately without a timer.
before.mp4
after.mp4