Camera 8: fluxer-core remote cameras, tile states, layout rules (#960) #979

Closed
charles wants to merge 0 commits from camera-8-core-remote-cameras-tile into camera
Owner

What this builds (Camera plan, Task 8; spec §8.2, §9, §10.2, §10.3)

fluxer-core::voice::camera::remote:

  • What is shown decides what is received. CameraAction::SetShown(connections) subscribes a shown camera at once (VoiceCommand::SetSubscribed { source: Camera }) and unsubscribes it CAMERA_UNSUBSCRIBE_GRACE (2000 ms, row 34) after it left the set, unless it comes back first (a stale grace timer is ignored, so nothing flaps). The own connection is never in the set. A camera nobody shows gets one subscribed: false when published, as before. The room is told only what changed, and asked again after Reconnected.
  • Disable video locally (SetDisabledLocally, in memory, per connection, row 36): never subscribed; disabling a received camera unsubscribes it at once (no grace).
  • Leaving the call (or another call/connection beginning) drops everything: the shown set, the grace timers, the disabled connections, the pin, the frame states.
  • Tile states: tile_camera(&app, connection_id) -> TileCamera::{None, Loading, Video { key: CameraVideoKey::{LocalCamera, Remote { sid }}, mirrored }, Hidden, DisabledLocally, Unavailable}. The own tile is mirrored with "Mirror camera" and Hidden with "Show my own camera" off. A remote camera is Loading until VideoFrameInfo, and Unavailable once CAMERA_FRAME_TIMEOUT (5 s) has passed after subscribing with no frame, or on SubscriptionFailed.
  • has_live_camera(&app, connection_id) (row 28): the room's camera publication if not muted, else the voice state's self_video. non_video_filter(&app, &connections) (row 40): the connections with a camera, or all of them when none has one.
  • focus_default(&app) -> Option<FocusDefault::{Stream(StreamKey), Camera(ConnectionRef)}> (row 39): the first watched stream. Otherwise, in the Focus layout only, the camera of whoever is speaking now, then whoever spoke most recently, then the first in the participants' order. Otherwise None.
  • pinned: Option<ConnectionRef> with CameraAction::Focus(ConnectionRef) / CameraAction::Unfocus (both appended at the end of the registry).
  • selectors::guild_voice_badge(&app, guild_id) -> Option<VoiceBadge::{Voice, ScreenShare, Video}>. It follows the original's resolveVoiceBadgeActivity: a screen share wins, then a camera.
  • camera_keeps_display_awake also counts a remote camera that is received and in the shown set, unless it is disabled locally. A camera still in its grace period after leaving the set does not count.
  • voice::live no longer refuses cameras itself. It keeps them (LiveParticipant::camera()), and camera::remote decides what is received and tells the room.

How it was tested

  • New tests, written first and seen failing: tests/camera_remote.rs (11) and tests/camera_tiles.rs (4). They cover every test the plan lists, plus reconnect_subscribes_again and undecodable_camera_is_unavailable_after_five_seconds. Timers are fired by hand (no real time).
  • FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci passes locally. No desktop, camera or device tests were run, and none are needed: this is pure core.
  • No camera, display or server was touched.

Deviations and notes for the reviewer

  • ConnectionRef { user_id, connection_id } did not exist. It is defined in camera/ports.rs, next to the two appended CameraAction variants.
  • TileCamera::Video's key is a core type, CameraVideoKey, because fluxer-core does not depend on fluxer-video. Task 13 maps it to VideoKey::{LocalCamera, Remote { sid }}.
  • The own tile and the own has_live_camera read the own voice state's self_video (the server's echo), not the own camera's machine, so this task does not depend on Task 7. Task 7 can switch them to Live if it wants the tile to show before the echo arrives.
  • camera_ports.rs::stub_reducers_change_nothing (Task 5) no longer lists the remote actions, and in a call it compares only the own camera and the devices. The remote state now follows the call.
  • reduce_camera (camera/mod.rs, a registration file) calls reduce_remote_cameras. Task 7 adds its own camera reducer next to that call; when merging, keep both.
  • keep_awake.rs is touched by both this task and Task 7 (only camera_keeps_display_awake and its doc changed here).

Closes #960

🤖 Generated with Claude Code

https://claude.ai/code/session_0161qMQMsCyJhjYw4gqa6e4K

## What this builds (Camera plan, Task 8; spec §8.2, §9, §10.2, §10.3) `fluxer-core::voice::camera::remote`: - **What is shown decides what is received.** `CameraAction::SetShown(connections)` subscribes a shown camera at once (`VoiceCommand::SetSubscribed { source: Camera }`) and unsubscribes it `CAMERA_UNSUBSCRIBE_GRACE` (2000 ms, row 34) after it left the set, unless it comes back first (a stale grace timer is ignored, so nothing flaps). The own connection is never in the set. A camera nobody shows gets one `subscribed: false` when published, as before. The room is told only what changed, and asked again after `Reconnected`. - **Disable video locally** (`SetDisabledLocally`, in memory, per connection, row 36): never subscribed; disabling a received camera unsubscribes it at once (no grace). - **Leaving the call** (or another call/connection beginning) drops everything: the shown set, the grace timers, the disabled connections, the pin, the frame states. - **Tile states**: `tile_camera(&app, connection_id) -> TileCamera::{None, Loading, Video { key: CameraVideoKey::{LocalCamera, Remote { sid }}, mirrored }, Hidden, DisabledLocally, Unavailable}`. The own tile is mirrored with "Mirror camera" and `Hidden` with "Show my own camera" off. A remote camera is `Loading` until `VideoFrameInfo`, and `Unavailable` once `CAMERA_FRAME_TIMEOUT` (5 s) has passed after subscribing with no frame, or on `SubscriptionFailed`. - `has_live_camera(&app, connection_id)` (row 28): the room's camera publication if not muted, else the voice state's `self_video`. `non_video_filter(&app, &connections)` (row 40): the connections with a camera, or all of them when none has one. - `focus_default(&app) -> Option<FocusDefault::{Stream(StreamKey), Camera(ConnectionRef)}>` (row 39): the first watched stream. Otherwise, in the Focus layout only, the camera of whoever is speaking now, then whoever spoke most recently, then the first in the participants' order. Otherwise `None`. - `pinned: Option<ConnectionRef>` with `CameraAction::Focus(ConnectionRef)` / `CameraAction::Unfocus` (both appended at the end of the registry). - `selectors::guild_voice_badge(&app, guild_id) -> Option<VoiceBadge::{Voice, ScreenShare, Video}>`. It follows the original's `resolveVoiceBadgeActivity`: a screen share wins, then a camera. - `camera_keeps_display_awake` also counts a remote camera that is received and in the shown set, unless it is disabled locally. A camera still in its grace period after leaving the set does not count. - `voice::live` no longer refuses cameras itself. It keeps them (`LiveParticipant::camera()`), and `camera::remote` decides what is received and tells the room. ## How it was tested - New tests, written first and seen failing: `tests/camera_remote.rs` (11) and `tests/camera_tiles.rs` (4). They cover every test the plan lists, plus `reconnect_subscribes_again` and `undecodable_camera_is_unavailable_after_five_seconds`. Timers are fired by hand (no real time). - `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` passes locally. No desktop, camera or device tests were run, and none are needed: this is pure core. - No camera, display or server was touched. ## Deviations and notes for the reviewer - `ConnectionRef { user_id, connection_id }` did not exist. It is defined in `camera/ports.rs`, next to the two appended `CameraAction` variants. - `TileCamera::Video`'s key is a core type, `CameraVideoKey`, because `fluxer-core` does not depend on `fluxer-video`. Task 13 maps it to `VideoKey::{LocalCamera, Remote { sid }}`. - The own tile and the own `has_live_camera` read the own voice state's `self_video` (the server's echo), not the own camera's machine, so this task does not depend on Task 7. Task 7 can switch them to `Live` if it wants the tile to show before the echo arrives. - `camera_ports.rs::stub_reducers_change_nothing` (Task 5) no longer lists the remote actions, and in a call it compares only the own camera and the devices. The remote state now follows the call. - `reduce_camera` (`camera/mod.rs`, a registration file) calls `reduce_remote_cameras`. Task 7 adds its own camera reducer next to that call; when merging, keep both. - `keep_awake.rs` is touched by both this task and Task 7 (only `camera_keeps_display_awake` and its doc changed here). Closes #960 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_0161qMQMsCyJhjYw4gqa6e4K
camera_remote: subscription by what is shown (2000 ms grace), "Disable
video locally", leaving, reconnect, pin and unpin, the default focus,
the guild's voice badge, the display kept awake by a shown camera.
camera_tiles: the tile states, the 5 s frame timeout, the non-video
filter from the publication then the voice state.

Refs #960

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0161qMQMsCyJhjYw4gqa6e4K
camera::remote: CameraAction::SetShown subscribes a shown camera at once
and unsubscribes it 2000 ms after it left the set (row 34), never one
disabled locally (row 36), which stops at once; all dropped when the call
ends; re-asked after a reconnect. voice::live no longer refuses cameras
itself and keeps them (LiveParticipant::camera). tile_camera (spec
§10.2) with the 5 s frame timeout, has_live_camera (row 28),
non_video_filter (row 40), focus_default (row 39), the pinned
participant (CameraAction::Focus / Unfocus with ConnectionRef, appended),
selectors::guild_voice_badge (VoiceBadge::Video when a camera is on and
nobody shares), and camera_keeps_display_awake for a shown remote camera.
camera_ports' stub test no longer lists the remote actions.

Refs #960

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0161qMQMsCyJhjYw4gqa6e4K
Author
Owner

Merged into camera by hand (the merge API returns 405); the commits are in the branch.

Merged into `camera` by hand (the merge API returns 405); the commits are in the branch.
charles closed this pull request 2026-11-20 00:02:24 +00:00

Pull request closed

Sign in to join this conversation.
No description provided.