patches and low-level development discussion
 help / color / mirror / code / Atom feed
From: Alyssa Ross <hi@alyssa.is>
To: Demi Marie Obenour <demiobenour@gmail.com>, devel@spectrum-os.org
Subject: Re: Camera virtualization in Spectrum
Date: Thu, 05 Jun 2025 15:10:23 +0200	[thread overview]
Message-ID: <87bjr2cp1c.fsf@alyssa.is> (raw)
In-Reply-To: <d41c1c72-5cba-49a0-813a-fe0705b1be8e@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2294 bytes --]

Demi Marie Obenour <demiobenour@gmail.com> writes:

> Instead, I think it is necessary to add a media server.  This server
> would expose a virtio-media output device to the VM with the camera,
> and would expose a virtio-media capture device to all VMs on the system,
> not just those authorized to receive video.  This is because camera
> hotplug is not properly handled by at least Google Chrome, so I expect
> other applications to also mishandle it.  Instead, a VM that does not
> have camera permission can be given a camera that always records black,
> as if the user had covered the camera.  PipeWire is the only existing
> implementation of a media server I know of that allows custom media
> devices to be implemented out-of-process, so it is the best choice I
> know of.  PipeWire is also considered the future by the entire Linux
> desktop community.

I'm surprised that camera hotplug isn't handled properly, given things
like laptop camera switches and USB webcams.  How does it go wrong?

So you're proposing passing the camera through to a VM that runs a
PipeWire media server, and then exposes virtio-media outputs from that
media server to other VMs?

> One other factor that I did not consider at all during the discussion is
> the need to implement the XDG microphone and camera portals.  These
> portals are based on PipeWire, and PipeWire cannot be directly used
> across VMs.  This is partially because of security, but it is also
> because PipeWire relies on SCM_RIGHTS file descriptor passing, eventfds,
> and other Linux kernel APIs that do not work across the VM boundary.
> Therefore, it is necessary to either run PipeWire in the guest, or run
> a daemon in the guest that exposes the same interface PipeWire does.
> All portals supported in Spectrum that prompt the user require a
> Spectrum-specific implementation so that the prompt happens on the host.

It doesn't look like the Camera portal is something that
xdg-desktop-portal delegates to a backend either, so we don't have a
hook to do Spectrum-specific stuff like granting camera access in the
media server, unless we provide our own x-d-p implementation (not just a
backend)…  Would it be possible to hook into PipeWire in the guest
instead, perhaps, to do that?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

  reply	other threads:[~2025-06-05 13:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-04  3:38 Camera virtualization in Spectrum Demi Marie Obenour
2025-06-05 13:10 ` Alyssa Ross [this message]
2025-06-05 13:44 ` Alyssa Ross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bjr2cp1c.fsf@alyssa.is \
    --to=hi@alyssa.is \
    --cc=demiobenour@gmail.com \
    --cc=devel@spectrum-os.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).