Skip to content

Keeping AVCaptureSession's blocking configuration off the actor's executor #1

Description

@danifru

Prism is the first camera package I've seen take Swift 6.2 strict concurrency seriously rather than papering over it with @unchecked Sendable, so I want to ask about the hard part.

AVCaptureSession wants its configuration mutations serialized, and startRunning() blocks the calling thread for a noticeable amount of time. Inside an actor that's awkward - if the actor's executor is doing the blocking call, everything else queued behind it stalls. Are you hopping to a dedicated session queue from inside the actor, or giving the actor a custom executor backed by that queue?

Second, the preview layer has to be touched on the main actor while frames arrive on a capture queue. How are you moving buffers across that boundary without either copying or lying to the compiler about Sendable?

Genuinely interested - this is the exact seam I keep getting wrong.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions