fix(controls): keep source editing availability consistent

This commit is contained in:
AAA committed 2026-11-29 18:56:19 -05:00
1 parent 3493f2164d
commit 551e2dd762
5 files changed
+64 -7

No files matched your search

+23 -3
View File
@@ -1,7 +1,7 @@
# Codex → Claude
Reviewed queue: `e76b190f`. The implementing line is `e8ccfc5e` before this
small control phase. Private beta.75 remains frozen at `963c8966`.
Reviewed queue: `e76b190f`. The control phase is `3493f216`; this follow-up closes the
same source-audio projection through the selection phase. Private beta.75 remains frozen at `963c8966`.
## Queue outcomes
@@ -13,7 +13,10 @@ small control phase. Private beta.75 remains frozen at `963c8966`.
gain capability. The tile combines that with its screen operation. Browser
volume waits, immediate mute remains available, and supported Native gain
still works. The bitrate control retains its stricter quality-edit boundary.
Both TypeScript projects and the affected controls/Session tests passed.
A resolved picker request can leave its private selection open, so the
shared Stage now supplies `sourceEditPending` to both the projection and
command guard. The selector cannot leave volume appearing editable while
its command is refused. Both TypeScript projects and the affected tests passed.
- **`d99df5c0`: retained as study, not merged into production.** Keep the single
generation-scoped trial, explicit limits and cancellation outcome. The study
still needs a media observation that can justify retaining the extra child.
@@ -72,3 +75,20 @@ identity are verified, with isolated test data and no public publication.
Your page-side succession and remaining small remedies remain yours. The source
following contract described in the prior mailbox stands. Maintenance #560 stays
held at `d13666a3`; no new upstream or reporter update required another change.
## Presentation-counter follow-through
The final ordinary Browser control recorded compositor metadata as well as
callbacks. With 6 versus 2.6 Mbit/s over matched 12.19-second windows, the
source produced 366 frames in each run. Encoded/sent counts were 366 versus
327, decoded counts 365 versus 325, and compositor presentation increases
362 versus 294. Across the constrained run's longest 145.9 ms callback gap,
presentationTime advanced equally while presentedFrames advanced once. That
establishes a real presentation gap, not merely missed callbacks. Standard
freeze count stayed zero. The cause of the remaining decode-to-presentation
difference is not isolated. The existing research owner now separates this
control from simulated Core readiness and the older unaligned logs.
Beta.75's additional pixel readback also matched its synthetic source's
background and moving marker. The acceptance record and private package notes
were updated without changing the frozen binaries.
@@ -309,6 +309,35 @@ is an upper bound for a sender.
## Sender Capacity Observations
The in-process D1 study tries one additional child on unmet demand. It
retains previously proved occupancy and stops further trials at a sender
after a refused trial during that routing lifetime. With scalar sender
capacity stepping from 4 to 3 to 5, the harness injected one background
flow failure into each D1 run at the drop. Trial-induced loss was disabled.
The table counts simulated ready viewers / requested viewers.
[Core study implementation](https://github.com/TNTcraftHIM/Piik/commit/d99df5c0)
| Study policy | Capacity 4 | Capacity 3 | Capacity 5 | After one viewer leaves, immediate → 60 s |
| --- | ---: | ---: | ---: | ---: |
| Baseline | 2/4 | 2/5 | 2/6 | 2/5 → 2/5 |
| Preserve proved occupancy | 4/4 | 3/5 | 5/6 | 4/5 → 5/5 |
| Use current proved children | 4/4 | 3/5 | 3/6 | 3/5 → 3/5 |
A Chrome 156 loopback control used an ordinary, non-pooled 854×480 source
at 30 fps and a local UDP policer. The source and receiving presentation
used the same page clock.
Over a matched 12.19 s interval after adding a second viewer, sender RTP
stats and incumbent receiver counters showed the following.
| Uplink | Source frames | Encoded | Sent | Decoded | Presented | Reported freezes |
| --- | ---: | ---: | ---: | ---: | ---: | ---: |
| 6 Mbit/s | 366 | 366 | 366 | 365 | 362 | 0 |
| 2.6 Mbit/s | 366 | 327 | 327 | 325 | 294 | 0 |
At 2.6 Mbit/s, the longest callback gap was 145.9 ms and the render
metadata also recorded a 145.9 ms gap between consecutive presented
frames. The control establishes a presentation gap. Its cause remains open.
Two controls used the frozen beta.59 source at `b29f3712` with Chromium
152.0.7977.64 in isolated Linux networks. A 640×360 canvas supplied motion at
10 fps. Both viewers connected directly to the Browser source, without service
+4 -4
View File
@@ -3712,7 +3712,7 @@ export class ChannelSession {
this.screenStage(publicationId)?.setScreenQuality(profile) ?? Promise.reject(new Error("capture_unavailable"));
sourceAudio = (publicationId: string) => {
const share = this.screenStage(publicationId)?.screen;
const stage = this.screenStage(publicationId), share = stage?.screen;
if (!share) return undefined;
const local = this.local.get(publicationId);
const canMute = !!local?.audio?.outputGainAvailable || !!this.app?.hasSourceAudioControl(publicationId);
@@ -3720,8 +3720,8 @@ export class ChannelSession {
const sourceAudioAvailable = local ? !!local.audio?.sourceAudioAvailable : !!this.app?.hasSourceAudio(publicationId);
const hasAudio = local ? !!local.audio?.audioAvailable : sourceAudioAvailable || !!this.app?.sourceMicrophone(publicationId)?.enabled;
return { ...share.volume, bitrate: share.profile.maxAudioBitrate ?? 128_000,
sourceAudioAvailable, hasAudio, available: hasAudio && (!local || !!local.audio?.outputGainAvailable), canMute,
busy: !!this.screenStage(publicationId)?.qualityPending && !this.app?.hasSourceAudioControl(publicationId) };
sourceAudioAvailable, hasAudio, available: hasAudio && (!local || !!local.audio?.outputGainAvailable), canMute,
busy: stage.sourceEditPending && !this.app?.hasSourceAudioControl(publicationId) };
};
setSourceAudio = (publicationId: string, settings: { bitrate?: number; level?: number; muted?: boolean }): Promise<void> => {
@@ -3729,7 +3729,7 @@ export class ChannelSession {
const local = this.local.get(publicationId);
const stopping = settings.bitrate === undefined && (settings.muted === true || settings.level === 0) && !!local?.audio?.outputGainAvailable;
const native = this.app?.hasSourceAudioControl(publicationId);
if (!share || (stage.sourceSelection || stage.qualityPending) && !(settings.bitrate === undefined && (stopping || native)))
if (!share || stage.sourceEditPending && !(settings.bitrate === undefined && (stopping || native)))
return Promise.reject(new Error("capture_unavailable"));
const volume = { level: settings.level ?? share.volume.level, muted: settings.muted ?? share.volume.muted };
const profile = { ...share.profile, maxAudioBitrate: settings.bitrate ?? share.profile.maxAudioBitrate ?? 128_000 };
+1
View File
@@ -90,6 +90,7 @@ export class Stage {
candidate(id: string): WatchPlayer | undefined { return this.preparations.get(id); }
get qualityPending(): boolean { return this.qualityEdit?.current() ?? false; }
get sourceEditPending(): boolean { return !!this.selection || this.qualityPending; }
get screenQuality() {
const share = this.share;
if (!share) return undefined;
+7
View File
@@ -4725,6 +4725,13 @@ test("Browser source output gain and bitrate survive replacement and close with
expect(session.screenQuality(publication.id)?.applied).toEqual(liveProfile);
session.setQuality(QUALITY_PROFILES["720p30"]);
expect(session.screenQuality(publication.id)?.applied).toEqual(liveProfile);
const page = new appLink.AppPage(crypto.randomUUID(), "https://video.test/", async () => null, () => {}, () => {});
vi.spyOn(session as unknown as { connectApp(): Promise<appLink.ChannelApp> }, "connectApp")
.mockResolvedValue({ preparePage: async () => page } as unknown as appLink.ChannelApp);
await session.prepareWatchPage("first", page.url);
expect(session.getSnapshot().pending.has("screen:first")).toBe(false);
expect(session.sourceAudio(publication.id)).toMatchObject({ busy: true, canMute: true });
await session.cancelScreenSelection("first");
await session.setSourceAudio(publication.id, { muted: true });
expect(contexts[0].gain).toHaveBeenLastCalledWith(0, 0, 0.01);
expect(first.getVideoTracks()[0].stop).not.toHaveBeenCalled();