Camera 5: fluxer-core camera ports: commands, events, settings, state skeleton (#957) #974

Closed
charles wants to merge 0 commits from camera-5-core-camera-ports-commands into camera
Owner

What this builds

Camera plan Task 5 (spec §5.3): the camera's ports and the voice.camera skeleton, interfaces first.

  • crates/fluxer-core/src/voice/camera/{mod.rs,ports.rs}: CameraCommand::{List, Watch, Start { device, target }, Stop}, CameraEvent::{Devices, Started { width, height, fps }, Stalled, Resumed, Ended { reason: CameraEnd::DeviceLost }, Failed(CameraFailure)}, CameraFailure::{NotFound, Busy, NotAllowed, Unsupported, Other(String)}, CameraDeviceInfo { id, name }, CameraTarget, CameraEncode { width, height, fps, max_bitrate, layers: CameraLayers::{Single, Simulcast, Svc(String)} }, CameraId(u64), LocalPublication::{Share(ShareId), Camera(CameraId)}, CameraAction (every variant of spec §5.3), device_hash; CameraState { own: OwnCamera::Off, devices, remote: RemoteCameras } as Voice::camera; Voice::reduce_camera, a stub called after the streams reducer.
  • Appended: Effect::Camera, CoreEvent::Camera, UserAction::Camera, VoiceCommand::{PublishCamera { id, codec, encode }, UnpublishCamera, UpdateCameraEncoding}, Chime::{CameraOn, CameraOff}, NotificationSound::{CameraOn, CameraOff} (camera-on / camera-off, labels "Camera on" / "Camera off" from SoundUtils.ts / SoundLabels.ts and CommonMessageDescriptors.ts:747).
  • The one reshape: VoiceEvent::LocalTrackPublished { share: ShareId } is now { publication: LocalPublication }. Go-live ignores camera publications; codec negotiation matches only Share; fluxer-voice's session wraps its share id.
  • Settings: VoiceSettingChange::{CameraResolution, MirrorCamera, VideoDevice, ShowMyOwnCamera, SkipHideOwnCameraConfirm} applied and stored; VideoSettings gains show_my_own_camera: true and skip_hide_own_camera_confirm: false, stored under their own keys (appended at the end of stored()), so an older file loads the defaults.
  • Privacy (spec §13.4): Debug of CameraDeviceInfo and CameraCommand::Start prints the device id as #xxxxxxxx (FNV-1a), never a by-id path or serial number.
  • Do-nothing arms: apps/fluxer/src/runtime.rs (Effect::Camera logged at debug, nothing opened), apps/fluxer/src/audio_rt.rs (engine_chime returns Option; the camera chimes play nothing until Task 12), crates/fluxer-voice/src/session.rs (camera commands dropped with a debug line until Task 9). voice_rt.rs and fluxer-ui/src/app.rs needed no arm (no exhaustive match on the new variants).

How it was tested

  • New crates/fluxer-core/tests/camera_ports.rs: settings_defaults_and_round_trip_every_new_key, older_file_loads_defaults, stub_reducers_change_nothing (every action and event, logged out, logged in and connected: no effect, state unchanged), device_id_debug_is_hashed, local_publication_distinguishes_share_and_camera, camera_commands_have_their_final_shapes. Written first and seen failing to compile, then passing.
  • The existing go-live, codec, preview, status and session tests pass with the reshaped event.
  • FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci green locally (fmt, clippy, deny, core isolation, parity, tests, screenshot tests). No camera, display or desktop test was run; nothing here opens a device. No FLUXER_DESKTOP_TESTS tests were run.

Deviations from the plan

  • Outside the plan's file list, needed to compile: NotificationSound::{CameraOn, CameraOff} in crates/fluxer-core/src/shell/notif_prefs.rs (its of_chime is exhaustive over Chime), with tests/shell_notif_prefs.rs updated (its exhaustiveness table, the page model rows, and a stored-table test that used camera-on as an unknown name); apps/fluxer/src/audio_rt.rs (the chime arm the plan describes). Since the sounds page lists NotificationSound::ALL, "Camera on" / "Camera off" now show under "Show more sound effects" (not common, so no golden changes); Task 15 only has to check them.
  • The test files of fluxer-core, fluxer-ui and fluxer-voice that build LocalTrackPublished were adapted mechanically (share → publication: LocalPublication::Share(..)); LocalPublication is also re-exported as fluxer_core::voice::LocalPublication.
  • The camera device id reuses DeviceId (so VoiceSettings::video_device keeps its type); CameraAction::SelectDevice(DeviceId) and VoiceSettingChange::VideoDevice(DeviceId) print the id plainly in Debug, as the audio devices' do. The runtime task should log camera devices through device_hash.
  • SetShown carries connection ids (Vec<String>), as the voice states name them.

Closes #957

🤖 Generated with Claude Code

https://claude.ai/code/session_0161qMQMsCyJhjYw4gqa6e4K

## What this builds Camera plan Task 5 (spec §5.3): the camera's ports and the `voice.camera` skeleton, interfaces first. - `crates/fluxer-core/src/voice/camera/{mod.rs,ports.rs}`: `CameraCommand::{List, Watch, Start { device, target }, Stop}`, `CameraEvent::{Devices, Started { width, height, fps }, Stalled, Resumed, Ended { reason: CameraEnd::DeviceLost }, Failed(CameraFailure)}`, `CameraFailure::{NotFound, Busy, NotAllowed, Unsupported, Other(String)}`, `CameraDeviceInfo { id, name }`, `CameraTarget`, `CameraEncode { width, height, fps, max_bitrate, layers: CameraLayers::{Single, Simulcast, Svc(String)} }`, `CameraId(u64)`, `LocalPublication::{Share(ShareId), Camera(CameraId)}`, `CameraAction` (every variant of spec §5.3), `device_hash`; `CameraState { own: OwnCamera::Off, devices, remote: RemoteCameras }` as `Voice::camera`; `Voice::reduce_camera`, a stub called after the streams reducer. - Appended: `Effect::Camera`, `CoreEvent::Camera`, `UserAction::Camera`, `VoiceCommand::{PublishCamera { id, codec, encode }, UnpublishCamera, UpdateCameraEncoding}`, `Chime::{CameraOn, CameraOff}`, `NotificationSound::{CameraOn, CameraOff}` (`camera-on` / `camera-off`, labels "Camera on" / "Camera off" from `SoundUtils.ts` / `SoundLabels.ts` and `CommonMessageDescriptors.ts:747`). - The one reshape: `VoiceEvent::LocalTrackPublished { share: ShareId }` is now `{ publication: LocalPublication }`. Go-live ignores camera publications; codec negotiation matches only `Share`; `fluxer-voice`'s session wraps its share id. - Settings: `VoiceSettingChange::{CameraResolution, MirrorCamera, VideoDevice, ShowMyOwnCamera, SkipHideOwnCameraConfirm}` applied and stored; `VideoSettings` gains `show_my_own_camera: true` and `skip_hide_own_camera_confirm: false`, stored under their own keys (appended at the end of `stored()`), so an older file loads the defaults. - Privacy (spec §13.4): `Debug` of `CameraDeviceInfo` and `CameraCommand::Start` prints the device id as `#xxxxxxxx` (FNV-1a), never a `by-id` path or serial number. - Do-nothing arms: `apps/fluxer/src/runtime.rs` (`Effect::Camera` logged at debug, nothing opened), `apps/fluxer/src/audio_rt.rs` (`engine_chime` returns `Option`; the camera chimes play nothing until Task 12), `crates/fluxer-voice/src/session.rs` (camera commands dropped with a debug line until Task 9). `voice_rt.rs` and `fluxer-ui/src/app.rs` needed no arm (no exhaustive match on the new variants). ## How it was tested - New `crates/fluxer-core/tests/camera_ports.rs`: `settings_defaults_and_round_trip_every_new_key`, `older_file_loads_defaults`, `stub_reducers_change_nothing` (every action and event, logged out, logged in and connected: no effect, state unchanged), `device_id_debug_is_hashed`, `local_publication_distinguishes_share_and_camera`, `camera_commands_have_their_final_shapes`. Written first and seen failing to compile, then passing. - The existing go-live, codec, preview, status and session tests pass with the reshaped event. - `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` green locally (fmt, clippy, deny, core isolation, parity, tests, screenshot tests). No camera, display or desktop test was run; nothing here opens a device. No `FLUXER_DESKTOP_TESTS` tests were run. ## Deviations from the plan - Outside the plan's file list, needed to compile: `NotificationSound::{CameraOn, CameraOff}` in `crates/fluxer-core/src/shell/notif_prefs.rs` (its `of_chime` is exhaustive over `Chime`), with `tests/shell_notif_prefs.rs` updated (its exhaustiveness table, the page model rows, and a stored-table test that used `camera-on` as an unknown name); `apps/fluxer/src/audio_rt.rs` (the chime arm the plan describes). Since the sounds page lists `NotificationSound::ALL`, "Camera on" / "Camera off" now show under "Show more sound effects" (not common, so no golden changes); Task 15 only has to check them. - The test files of `fluxer-core`, `fluxer-ui` and `fluxer-voice` that build `LocalTrackPublished` were adapted mechanically (`share` → `publication: LocalPublication::Share(..)`); `LocalPublication` is also re-exported as `fluxer_core::voice::LocalPublication`. - The camera device id reuses `DeviceId` (so `VoiceSettings::video_device` keeps its type); `CameraAction::SelectDevice(DeviceId)` and `VoiceSettingChange::VideoDevice(DeviceId)` print the id plainly in `Debug`, as the audio devices' do. The runtime task should log camera devices through `device_hash`. - `SetShown` carries connection ids (`Vec<String>`), as the voice states name them. Closes #957 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_0161qMQMsCyJhjYw4gqa6e4K
The camera's commands, events, actions and settings, and the
`voice.camera` skeleton (Camera spec §5.3). The reducer is a stub;
Tasks 7 and 8 give it its behaviour.

- `voice:📷:ports`: `CameraCommand`, `CameraEvent`, `CameraEnd`,
  `CameraFailure`, `CameraDeviceInfo` (id printed as a short hash),
  `CameraTarget`, `CameraEncode`, `CameraLayers`, `CameraId`,
  `LocalPublication`, `CameraAction`.
- `Effect::Camera`, `CoreEvent::Camera`, `UserAction::Camera`,
  `VoiceCommand::{PublishCamera, UnpublishCamera, UpdateCameraEncoding}`,
  `Chime::{CameraOn, CameraOff}`, `NotificationSound::{CameraOn,
  CameraOff}`, all appended.
- `VoiceEvent::LocalTrackPublished { share }` becomes
  `{ publication: LocalPublication }`; its users are adapted.
- `VoiceSettingChange::{CameraResolution, MirrorCamera, VideoDevice,
  ShowMyOwnCamera, SkipHideOwnCameraConfirm}`, applied and stored;
  `show_my_own_camera: true`, `skip_hide_own_camera_confirm: false`.
- Do-nothing arms in the runtime (`Effect::Camera`), the audio runtime
  (the camera chimes play nothing until Task 12) and the voice session
  (camera commands dropped until Task 9).

Refs #957

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-19 22:28:16 +00:00

Pull request closed

Sign in to join this conversation.
No description provided.