Skip to content

playerone: Fix 100% CPU usage during video streaming#1316

Merged
knro merged 1 commit into
indilib:masterfrom
cfuture81:fix-playerone-streaming-cpu
May 11, 2026
Merged

playerone: Fix 100% CPU usage during video streaming#1316
knro merged 1 commit into
indilib:masterfrom
cfuture81:fix-playerone-streaming-cpu

Conversation

@cfuture81
Copy link
Copy Markdown
Contributor

@cfuture81 cfuture81 commented May 7, 2026

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_ccd process pins a core at 100%.

Root Cause

workerStreamVideo() contains a tight busy-wait polling loop:

while (pIsReady == POA_FALSE)
{
    POAImageReady(mCameraInfo.cameraID, &pIsReady);
}

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 to waitMS timeout), making the polling unnecessary. This matches how the ASI driver uses ASIGetVideoData() — a single blocking call with timeout.

Before / After

Before After
CPU usage during streaming ~100% on one core Near-idle between frames

indi settings:
Screenshot From 2026-05-07 12-49-53
cpu before fix:
Screenshot From 2026-05-07 12-49-39
cpu after fix:
Screenshot From 2026-05-07 12-58-15

Testing

Tested with PlayerOne Xena 585M (IMX585) on Intel N150 (x64, Arch Linux):

  • 8-bit and 16-bit streaming modes
  • Exposures from 0.001s to 0.5s
  • Hardware binning 1x1 and 2x2
  • No frame drops or streaming issues observed after the fix

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.
@knro
Copy link
Copy Markdown
Collaborator

knro commented May 10, 2026

@jctk Can you please take a look?

@jctk
Copy link
Copy Markdown
Contributor

jctk commented May 10, 2026

Unfortunately, I don't have a Player One camera.

@knro knro requested a review from hiro3110i May 10, 2026 11:50
@knro
Copy link
Copy Markdown
Collaborator

knro commented May 10, 2026

Sorry that was by mistake! @hiro3110i can check :-)

@hiro3110i
Copy link
Copy Markdown
Contributor

@cfuture81 Thank you for your suggestion.
I actually tried your suggestion and confirmed that it reduces CPU load. The PlayerOne sample code uses POAImageReady() to wait for the next frame and then POAGetImageData() to retrieve the frame image.
However, if POAGetImageData() can internally wait for the next frame, then the extra polling loop is unnecessary.

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.

@knro
Copy link
Copy Markdown
Collaborator

knro commented May 11, 2026

@hiro3110i Great so no objections on merging this PR?

@hiro3110i
Copy link
Copy Markdown
Contributor

@knro Yes, please.

@knro knro merged commit c199805 into indilib:master May 11, 2026
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants