playerone: Fix 100% CPU usage during video streaming#1316
Conversation
Remove busy-wait polling loop in workerStreamVideo() that called POAImageReady() in a tight loop with no sleep, causing the driver process to consume 100% of a CPU core during streaming. POAGetImageData() already blocks internally until a frame is ready (up to waitMS timeout), making the POAImageReady() polling redundant. This matches how the ASI driver uses ASIGetVideoData() — a single blocking call with timeout. Tested with PlayerOne Xena 585M at various exposures (0.001s to 0.5s) in both 8-bit and 16-bit streaming modes. CPU usage drops from 100% to near-idle between frames.
|
@jctk Can you please take a look? |
|
Unfortunately, I don't have a Player One camera. |
|
Sorry that was by mistake! @hiro3110i can check :-) |
|
@cfuture81 Thank you for your suggestion. In actual operation, USB bus bandwidth is dominant, and I couldn't confirm that reducing CPU load had enough effect to improve the frame rate. However, generally speaking, lower load is better. |
|
@hiro3110i Great so no objections on merging this PR? |
|
@knro Yes, please. |
Problem
The PlayerOne driver consumes 100% of a CPU core during video streaming, regardless of exposure time. Even at 0.5s exposure (2 FPS), the
indi_playerone_ccdprocess pins a core at 100%.Root Cause
workerStreamVideo()contains a tight busy-wait polling loop:This spins with no sleep between calls, burning CPU cycles while waiting for a frame.
Fix
Remove the redundant
POAImageReady()polling loop.POAGetImageData()already blocks internally until a frame is ready (up towaitMStimeout), making the polling unnecessary. This matches how the ASI driver usesASIGetVideoData()— a single blocking call with timeout.Before / After
indi settings:



cpu before fix:
cpu after fix:
Testing
Tested with PlayerOne Xena 585M (IMX585) on Intel N150 (x64, Arch Linux):