Screen share 8: fluxer-core stream state, ports and selectors (#155) #194
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "screenshare-8-core-stream-ports"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Stacked on: screenshare-7-proto-api-streams
What this builds (Screen share plan, Task 8; spec §6.1, §6.2, §6.4)
fluxer-core::voice::port):VoiceCommand::{PublishScreenShare, UpdateScreenShareEncoding, RepublishScreenShare, UnpublishScreenShare, SetScreenShareAudioMuted};VoiceEvent::{LocalTrackPublished, LocalTrackUnpublished, CodecCapabilities, VideoFrameInfo, EncoderStats};CaptureCommand::{ListSources, Start, Switch, Update, Stop}in the newEffect::Capture;CaptureEvent::{Sources, Started, Stalled, Resumed, Ended { reason }, Error}in the newCoreEvent::Capture;PlaybackSource::Stream(identity);Chime::{ScreenShareStart, ScreenShareStop}. Types:VideoCodec(Av1, H265, H264, Vp9, Vp8;ALL,codec_name(),from_codec_name()),CodecCap,EncodeParams { width, height, fps, max_bitrate, degradation, scalability_mode, backend },Degradation,EncoderBackend, and mirrors offluxer-capture'sSourceChoice,CaptureTarget,AudioRule/AudioMode/AppMatch(same defaults),SourceKind,EndReason,CaptureCapabilities, plusCaptureSources { sources: Vec<CaptureSourceInfo>, capabilities }(no thumbnails: those stay in the frame bus).Voice.streams: Streams { watching: Vec<StreamKey>, capture_sources: Option<CaptureSources> }invoice/stream/{mod,state}.rs;CaptureEvent::Sourcesis kept, logout clears it. Later tasks addoutgoing,negotiation,previews,remote,audio_prefsasDefaultfields.selectors::streams):streams_in_channel(&App, channel) -> Vec<StreamRow { key, user_id, connection_id, display_name, own, watching, viewers, has_audio, video_sid }>(sidebar order);spectators(&App, &StreamKey) -> Vec<Spectator>(port ofuseStreamSpectators: excludes this client's connection and the sharer's devices, absentviewer_stream_keyswatch nothing, keys compared parsed so@me:reads asdm:);is_streaming(&App, user_id);stream_of(&App, user_id, connection_id) -> Option<StreamKey>.LiveParticipant::{screen_share, screen_share_audio}and docs. They still get oneSetSubscribed { subscribed: false }and are never subscribed (Task 9 subscribes while watched).Tests
crates/fluxer-core/tests/streams.rs:self_stream_state_lists_stream_in_channel,viewers_counted_from_viewer_keys_excluding_owner,absent_viewer_keys_are_not_listed_as_watching,screen_tracks_recorded_but_not_subscribed,dm_stream_keys,new_ports_have_debug_without_secrets, plusstream_fixture_lists_its_stream(Task 7's fixture) andcapture_sources_are_kept_until_logout. Seen failing (compile errors) before the implementation, passing after.FLUXER_SCREENSHOT_TESTS=1 cargo xtask cigreen locally. No real-device tests in this task.Deviations / outside the Files list
fluxer-voice/src/session.rsdrops the screen-share commands with a debug log (Screen share 16/17 implement them);apps/fluxer/src/runtime.rslogs and dropsEffect::Capture(Screen share 21);apps/fluxer/src/audio_rt.rsmapsPlaybackSource::Streamand the two new chimes to nothing (the mixer has no stream source yet, andfluxer-audiodoes not bundlestream-start.mp3/stream-stop.mp3: follow-up #193).messages.rs/session.rsin core got theCoreEvent::Capture(_)arm.StreamRowhas nostate/preview_versionyet (they belong to Tasks 9 and 13); it hasownandvideo_sidin addition, for the tile and theVideoKey::Remote { sid }.CaptureSourcescarriesCaptureCapabilities(spec §6.4 has no separate capabilities event); Task 10 may want the capabilities before the first listing and can add them where it needs.display_namefallback); the original drops viewers whose user it does not have loaded.selectors::voice::collatebecamepub(crate)to sort spectators like the participant list.Closes #155
🤖 Generated with Claude Code
Independent review: Screen share 8 (core-stream-ports), commit
0d406ebScope:
git diff 6ac431d..origin/screenshare-8-core-stream-ports.Tests (plan Step 1). All six named tests exist in
crates/fluxer-core/tests/streams.rsand assert what the plan asks for:self_stream_state_lists_stream_in_channel,viewers_counted_from_viewer_keys_excluding_owner,absent_viewer_keys_are_not_listed_as_watching(absent,nulland[]cases),screen_tracks_recorded_but_not_subscribed(oneSetSubscribed{false}per screen source, publications kept, sid and audio shown in the row, audio unpublish handled),dm_stream_keys(dm:<channel>:<conn>), andnew_ports_have_debug_without_secrets. There are two extra tests:stream_fixture_lists_its_streamandcapture_sources_are_kept_until_logout.Interfaces (spec §6.4 and the Task 8 block). Every listed name is present with the signature written in the plan:
VoiceCommandvariants and the 5 newVoiceEventvariantsCaptureCommandandCaptureEvent, with the exact variantsEffect::CaptureandCoreEvent::CaptureVideoCodec { Av1, H265, H264, Vp9, Vp8 },CodecCap { codec, hardware }EncodeParams { width, height, fps, max_bitrate, degradation, scalability_mode: Option<String>, backend }SourceChoice,CaptureTarget,AudioRule,CaptureSources,PlaybackSource::Stream(String),Chime::{ScreenShareStart, ScreenShareStop}Voice.streams: Streamsstreams_in_channel,spectators,is_streaming(&App, user_id),stream_of(&App, user_id, &str) -> Option<StreamKey>Invariants. No
Cargo.tomlchange, andfluxer-coregains no dependency. The only new import isfluxer_proto::rtc::CodecName, from a crate it already depends on. No pixel or sample type is added, and no LiveKit or libwebrtc type appears in a public signature. Key building and parsing cannot panic: unparseable keys simply watch nothing. No secrets or tokens appear in code or tests. The extra arms influxer-voice/session.rs,apps/fluxer/runtime.rsandaudio_rt.rsare minimal no-ops, and each one logs at debug level.Review Focus 2 (input to Task 9). I checked
spectatorsagainst the fork'suseStreamSpectators.ts. Both exclude only the local connection (not the local user's other devices) and every connection of the sharer, de-duplicate by connection, and treat an absent list as watching nothing. The sharer is found from the key's connection. This build compares keys after parsing them, a harmless improvement. Including users that are not in the cache is a documented deviation; their display name falls back to the default.Findings
StreamRowhas nostateorpreview_versionyet (spec §6.2). The PR documents this deviation: Tasks 9 and 13 must add these fields. The extraownandvideo_sidfields are additive.CaptureSourcesalso carriesCaptureCapabilities. This is additive. Task 10 should readin_app_pickerfrom it, or from a runtime advert if it needs the value before the first listing.streams_in_channelcallsspectatorsonce per row, andspectatorsscans every voice state. That is O(rows × states). It is fine at today's sizes; I note it only in case the UI calls it every frame.Local CI:
FLUXER_SCREENSHOT_TESTS=1 cargo xtask ciin a fresh worktree passed every step (livekit-interop is skipped as designed).Verdict: APPROVE (0 blocking, 3 minor).