letmaik / pyvirtualcam

🎥 Send frames to a virtual camera from Python
GNU General Public License v2.0
455 stars 49 forks source link

macOS: reduce latency #22

Closed letmaik closed 3 years ago

letmaik commented 3 years ago

Resolves a left-over task from #16.

@JayFoxRox Could you do me one last favour for the mac variant? I changed the run loop message processing to process exactly one message each time without blocking. I think this is fine, but it would be good to check it didn't break anything.

You can download the wheel from the CI artifacts: https://github.com/letmaik/pyvirtualcam/actions/runs/627620668

letmaik commented 3 years ago

@JayFoxRox I merged the setup.py part of this PR in another PR, so it now only contains the change to the loop message processing.

letmaik commented 3 years ago

I've verified the fix as I had access to a mac. It does reduce the latency quite a bit, the webcam filter sample benefits a lot from it. There seems to be minor stuttering (frame drops?) every now and then which seems better now as well, but I have a feeling for it to be fully gone the implementation has to be changed somehow, maybe using threading. I only noticed this with the video sample when I played a smoothly rotating globe, otherwise you wouldn't notice it.