Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
--- a/third_party/libwebrtc/modules/video_capture/linux/device_info_v4l2.cc
+++ b/third_party/libwebrtc/modules/video_capture/linux/device_info_v4l2.cc
@@ -170,6 +170,33 @@

close(_fd_v4l);
close(_fd_dev);
+ } else {
+ // No inotify, as in a sandbox that refuses it: look for /dev/video<n> once a second
+ // instead, and say the devices changed whenever the set of them does.
+ if (_fd_v4l >= 0) {
+ close(_fd_v4l);
+ }
+ if (_fd_dev >= 0) {
+ close(_fd_dev);
+ }
+ uint64_t seen = 0;
+ for (int tick = 0; !_isShutdown; tick++) {
+ if (tick % 10 == 0) {
+ uint64_t now = 0;
+ for (int n = 0; n < 64; n++) {
+ char path[32];
+ snprintf(path, sizeof(path), "/dev/video%d", n);
+ if (access(path, F_OK) == 0) {
+ now |= uint64_t(1) << n;
+ }
+ }
+ if (tick > 0 && now != seen) {
+ DeviceChange();
+ }
+ seen = now;
+ }
+ usleep(100 * 1000);
+ }
}
}
#endif
--- a/third_party/libwebrtc/modules/video_capture/linux/video_capture_v4l2.cc
+++ b/third_party/libwebrtc/modules/video_capture/linux/video_capture_v4l2.cc
@@ -451,6 +451,9 @@
} else if (retVal == 0) {
// poll timed out
return true;
+ } else if (rSet.revents & (POLLERR | POLLHUP | POLLNVAL)) {
+ // the device is gone, or its queue failed: polling again would spin
+ return false;
} else if (!(rSet.revents & POLLIN)) {
// not event on camera handle
return true;
14 changes: 13 additions & 1 deletion build/patches/firefox-153.6.0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Applied by `s_browser_firefox` in the browser image through `apply_repo_patches`

Mozilla builds Firefox with clang; Kryptik builds it with stage 04's GCC 14, as
every other program is built. The first three are the changes Gentoo's Firefox
153 patch set carries for a GCC build, each a few lines; the fourth is Kryptik's:
153 patch set carries for a GCC build, each a few lines; the fourth and fifth
are Kryptik's:

- `0001`: `features.h` leaves the list of system headers Firefox wraps. Wrapped,
glibc's `_FORTIFY_SOURCE` checks do not take effect, which stage 06's audit
Expand All @@ -21,6 +22,17 @@ every other program is built. The first three are the changes Gentoo's Firefox
build with neither gets no remote at all, as on a platform without one: a
second `firefox` with the same profile is not handed to the first, and says
that Firefox is already running.
- `0005`: the camera in a zone, which refuses inotify (a watch on the `/usr`
it shares with zone 0 would see every program started). WebRTC's V4L2 code
learned of cameras only by inotify, so a camera granted after a page loaded
was never listed and pages got no `devicechange`. Without inotify it now
looks for `/dev/video<n>` once a second and reports a change, and the
zone's `/dev/video0` link, dangling with no grant, reads as absent. Its
capture thread also polled a camera that was taken away in a busy loop,
since the node answers `POLLERR` and never `POLLIN`; it now stops there.
Told the camera is gone, Firefox can end the track and close the node,
which the next grant waits for (`camera.rs`); whether it does is for the
tests on physical hardware.

The flag stage 04 adds that this build cannot take, `-fno-delete-null-pointer-checks`,
is dropped for Firefox alone in `build/config/hardening-exceptions.txt`.
1 change: 1 addition & 0 deletions build/patches/firefox-153.6.0/SHA256SUMS
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
b9bc94714ef801b3450dddfba1a35a7139ed48c9a958378dbda9016a4403ee14 0002-ffvpx-gcc-incompatible-pointer-types.patch
692345659a387cda546bf9aa2a8b19cefce60f3545634607e6a35d526145fd90 0003-cstdint-includes.patch
d68bb973e17677582d8988053518549d8261fe20934b732c12a4138bf9ec8dfb 0004-remote-needs-dbus-or-x11.patch
a844c745485cbe462bfeab8dbce837594a8f883ee4de5164ed1e5a872aca52db 0005-v4l2-camera-changes-without-inotify.patch
16 changes: 9 additions & 7 deletions docs/user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -471,14 +471,16 @@ processing in userspace (MIPI cameras behind the IPU6), those behind the
image processor of AMD's Ryzen AI Max (HP's ZBook Ultra G1a), and infrared
face-login cameras do not. `vault` and the net zone never get the camera.

Firefox in a zone is not told when the camera is given or taken back.
- Give the camera before opening the call. A page that looked for a camera
before goes on hearing there is none, even after a reload. Turning the
camera on in the call finds it, and so does starting Firefox again.
Firefox in a zone is not told when the camera is given or taken back, so it
looks once a second.
- Give the camera before opening the call where you can. A page that looked
for a camera before hears of it within a second if it listens for that;
otherwise turning the camera on in the call finds it, and so does a
reload.
- Turn the camera off in the call, or leave the call, before `k` takes the
camera back or the screen locks, or as soon as you can after. A call still
showing a camera that was taken back keeps a processor core busy and
keeps hold of the camera, and until then `k` cannot give it to any zone.
camera back or the screen locks, or as soon as you can after. Until the
call lets go of a camera that was taken back, `k` cannot give it to any
zone.

For administration, Ctrl+Alt+F2 gives a text login: log in as the user, and
`su` becomes root, where passwords change: `passwd NAME` for the user,
Expand Down
Loading