v002 / v002-Camera-Live

Live Syphon Camera
Other
1.17k stars 105 forks source link

Throttle frame-rate #145

Open bangnoise opened 4 years ago

bangnoise commented 4 years ago

I was having the same problem with the Nikon Z6. I tried it out with this Simple Client, and it's showing 640x360 resolution, and hovering around 110-120 FPS...

Originally posted by @dcosson in https://github.com/v002/v002-Camera-Live/issues/143#issuecomment-632343092

scj643 commented 4 years ago

A side effect of the high polling rate causes high CPU using with libturbojpeg decompression. As shown here image

(From #165)

Using CFTimeInterval and having a check for passed time causes more CPU usage which isn't an option. Potentially NSTimers might be an option. One that fires on a set interval.

bangnoise commented 4 years ago

@scj643 I have significant changes locally which will effect the solution to this, I'll push when I get a chance. Yes (obviously) don't poll, check target time for next frame after finishing a frame and set a timer if it's in the future.