Files
piik/docs/project-memory.md
T
AAA da7218bf44 feat(voice): add room voice and secure local invitations
## Problem and outcome / 问题与结果

Planned release: **v2.3.0**, preserving the published 2.x sharing contracts.

Friends can now talk in a Piik room before, during or after screen sharing. Room
voice, media forwarding and the picture retain separate lifetimes under the
existing room authority and route controller. This phase also improves direct LAN
entry, native capture startup, interaction controls and first-use documentation.

Related: #484, #437, #486, #488, #485 and #489. These references do not declare
all reported hardware or distribution problems fixed.

## Release notes

**Less typing. More talking.**

Piik now supports room voice, with or without screen sharing.

**聊不够?开麦吧!**

Piik 现已支持房间语音,不开播也能聊。

### English

This update adds room voice alongside sharing, chat and reactions, with clearer
controls and direct HTTPS invitations for local and virtual networks.

#### Highlights

- Create a room before sharing. The Host opens or closes room voice; friends
  can join, control their own microphone and listening, or mute someone locally.
  Joining voice keeps the microphone off until you enable it.
- Choose your microphone, adjust microphone, master and individual listening
  volumes from 0% to 200%, and enable voice processing in the interaction window.
  Audio icons offer quick volume sliders. The microphone icon shows live input
  level. Voice continues when the picture stops.
- Use a local HTTPS invitation for microphone and remote-control features on a
  LAN or virtual LAN. A temporary local certificate requires a browser warning
  confirmation; a self-hosted Server can also use supplied certificate files.
- Rotate your local picture, optionally volunteer more relay capacity, and
  download a native Windows x64 Server package.

#### Fixes and polish

- Align Windows automatic encoder probes with the surfaces used during actual
  capture; keep video capture progressing while optional source audio starts.
- Correct Linux desktop pixel-aspect negotiation and accept fitted native
  source dimensions without forcing a different aspect ratio.
- Avoid retaining false media queue congestion when producer and consumer
  clocks disagree.
- Distinguish chat authors with identical names, clarify remote permissions,
  and keep floating tools, contextual hints and microphone indicators aligned.
- Separate first-use guides, room tools and troubleshooting so help is easier
  to find.

Use updated Server/Web pages for room voice and update the App for the native
capture and local HTTPS improvements. Established 2.x sharing remains supported.
macOS builds do not yet carry Developer ID signing or Apple notarization; see the first-launch instructions.
The macOS audio-startup changes still need confirmation on an affected Mac.

### 中文

本次更新为分享、聊天和表情互动加入房间语音,同时打磨操作控件,并为局域网和虚拟局域网提供直接 HTTPS 邀请。

#### 主要变化

- 不开播也能创建房间。房主开启或关闭房间语音;朋友可以加入、自行开关麦克风和收听,或仅在自己这边静音某人。加入语音时默认不开麦。
- 在互动窗口选择麦克风、分别调整 0%–200% 的麦克风、总收听与个人音量,并设置语音处理。音频图标可展开快捷音量条,麦克风图标显示实时输入音量。停止画面分享后,语音仍可继续。
- 局域网和虚拟局域网可使用本地 HTTPS 邀请,启用麦克风和远程控制;临时本地证书需要在浏览器确认警告。自部署服务端也可使用自行提供的证书文件。
- 可旋转本地观看画面、自愿增加转发容量,并提供 Windows x64 服务端下载包。

#### 修复与打磨

- Windows 自动编码探测使用与实际采集一致的输入;可选来源音频启动期间,画面采集继续运行。
- 修正 Linux 桌面采集的像素比例协商;原生来源保留实际画幅,不再要求固定比例的尺寸。
- 避免生产者和消费者时钟不一致时,错误保留媒体队列拥塞状态。
- 区分同名聊天作者,明确远控授权,并统一浮窗、上下文提示与麦克风指示器的细节。
- 分开首次使用、房间工具和故障排查文档,让帮助更容易查找。

房间语音需使用更新后的服务端和网页;原生采集与本地 HTTPS 改进需更新 App。既有 2.x 分享仍保持兼容。
macOS 构建仍未正式签名和公证,首次启动请参照文档;音频启动调整仍需在受影响的 Mac 上确认。

## Verification / 验证

Full Web checks, Go tests/vet/build/native probes, reachable vulnerability checks,
normal-page P2P/SFU voice and compatible sharing, LAN HTTPS, detached interaction
tools, responsive controls and tooltip/pure-visual checks provide acceptance
evidence. Physical macOS/Linux capture and acoustic behavior on arbitrary devices
are not established by these controls.

Scoped contributions from #488 (Linux pixel aspect) and #485 (Windows Server
packaging) are retained as their original authors' patch commits in this PR.
The remaining implementation and integration belong to the maintainer.

## Impact / 影响

Preserve the published 2.x sharing contract. New room-voice behavior is opt-in;
Host voice activation, capture and picture lifetimes remain distinct. Local
certificate material remains in memory; no system trust installation is performed.
2026-10-21 06:51:22 -04:00

136 lines
8.3 KiB
Markdown

# Project Memory
Last updated: 2026-10-21
Piik is private, low-latency screen sharing for one Host and up to 20
authenticated friends. The current product surface is Web Host, Web Viewer, and
Browser relay; desktop and mobile Browsers are Viewer targets, and camera-capable
mobile Browsers can also host. It is not a
public broadcast service. Hosted and App run one shared Go core
([ADR-0012](./adr/0012-shared-go-backend-core.md)); Node and Vite build the
Browser UI and are not a runtime. Source includes a cross-platform App that
runs that same core in a self-contained Local deployment or supplies native
capability to one approved Site through the system Browser. Its single Go
process starts the loopback capability service before room selection. The
persistent launcher offers Local and temporary public-link choices and manages
the Site's explicit local approval. Site use can remain on standby without a
Local room service; native media still belongs to the participant's Web UI.
Room source and media implementation are independent: a topology may mix
Browser and Native peers without changing participant, signaling, capacity, or
route identity. Local is LAN-first; explicit one-link mode exposes that same
authority through a temporary public control tunnel while media remains P2P.
Host authority belongs to a tab, with one separate persistent origin resume
hint. The App admits two independent native control sessions under its one
loopback service.
The current source embeds Binding-only STUN and optional SFU forwarding in
the Hosted Go process. Native and SFU use one shared Pion/LiveKit media adapter;
Native parents reuse suitable encoded outputs and derive a missing lower output
only for direct-child demand. Source-owned groups retain the highest needed
output and lower fallbacks, while each child receives its selected output.
Native Host SFU publication reuses the encoded source directly; its loopback
Browser stream supplies local preview and Browser quality candidates. Eligible
Browser capture and relay now share
independent local WebRTC producers for compatible direct children under ADR-0014;
unsupported APIs and failed pooling retain ordinary senders. Windows, macOS and
Linux producers share one encoded-frame
boundary and Host quality controls. Source replacement retains route and
connection identity; lower-output adaptation preserves the original and higher
sibling outputs. [Status](./status.md) owns candidate and release readiness;
runtime release descriptors own deployed identity.
The Local launcher keeps an optional user-chosen site-access password; leaving it
blank keeps the self-contained site open.
## Product Map
- [Rooms and access](./standards/rooms-access.md) owns room codes,
invitations, code entry, credentials, room interactions and lightweight/SQLite
persistence.
- [Routing and transport](./standards/routing-transport.md) owns P2P-first
distribution, endpoint capacity, SFU fallback, recovery, and privacy limits.
- [Capture and media quality](./standards/media-quality.md) owns Browser capture,
profiles, codec selection, audio, and framework adaptation.
- [Presentation and lifecycle](./standards/presentation-lifecycle.md) owns Host and
Viewer workflows, playback authority, roster, state, and Browser lifecycle.
Non-obvious decisions live in [ADRs](./adr/); reproducible evidence and platform
limits live in [research](./research/). Source code and tests own self-evident
implementation and routine UI detail.
## Core Invariants
- Rooms use random four-digit codes, exact Host ownership, room-scoped Viewer
invitations and independent `open | private` code entry. Room authority ends
through replacement/deletion, with separate invitation rotation or revocation.
Hosted operators may opt into empty-room expiry and capacity reclamation;
the default retains rooms indefinitely. Hosted defaults to SQLite, with explicit
process-memory opt-out; App Local remains process-only. Site access has a separate 24-hour idle
cookie lifetime within one service run. Production persists SQLite room
authority; live participants, routes, and media remain process-only.
- Media is automatic and distributed. Ordinary peers are STUN-only and prefer
direct/peer UDP. A deployment may enable same-host auxiliary STUN for bounded,
room-wide, connection-local NAT prediction; current pages use it automatically
when available, and anonymous provenance distinguishes ordinary from predicted
selected paths. The configuration default remains stock ICE. The only
application fallback is one bounded embedded SFU/UDP
publication; Piik configures no TURN or TCP media route. Hosted operators may
require SFU-only media through the same controller. On P2P-first sites, a
pre-share peer-only policy can exclude that SFU suffix for one share generation.
- Ordinary endpoints share one steady outbound-copy cap, default `2` and limited to
`1..3`; the candidate's explicit relay volunteer uses the
[capacity owner](./standards/routing-transport.md#endpoint-and-server-capacity).
One room controller owns one committed graph, one reconcile loop, and
one serial child operation. First decoded frame commits picture availability work;
accepted quality work adds native edge proof before commit in that operation.
- Browser WebRTC and the shared Pion/LiveKit media adapter own congestion control,
media adaptation, pacing and layer selection. Parent demand is local to direct
children and never a room-wide minimum or topology rebalance. Current source
defaults persistent native-edge local P2P convergence
on, with a pre-share Host opt-out. SFU quality work is limited to multi-root
Host fanout relief and each Viewer must prove its own candidate non-regression
before commit. A persistently limited edge with no different Peer parent may
use one same-parent connection regeneration through that same operation; its
exact post-commit sender identity damps only another same-edge regeneration.
No weighted score, all-pairs probe, general parent-wide prediction, or
periodic rebalance is accepted.
- Browser video uses `motion`; each share chooses H.264 with VP8 fallback through
an actual sender probe unless the Host explicitly selects VP8 or H264. Screen
audio retains its compact presets and 128 kbps default. The 2.0 contract
separates numeric bitrate requests from those UI shortcuts; implementation
limits and admission remain in the media-quality owner.
- Viewer playback uses one native video element. Presentation and recovery are
fenced by current route/media identity and current-frame proof; hidden-page
time alone is not media-failure evidence or a keepalive guarantee.
## Current Snapshot
Room voice integrates normal App/Server/Web rather than a
standalone demo. It keeps room authority and one route controller while picture
generations and explicitly joined voice publications have separate
lifetimes. [Status](./status.md#current-work)
indexes delivery and [room media](./standards/routing-transport.md#room-media)
owns the new behavior.
Optional attended keyboard/mouse control follows the committed media route back
to the native Host. One source-scoped grant admits one controller; source change,
stop and revocation retire it. It adds no separate connection planner or listener.
Viewer playback preferences and the combined interaction window remain local
presentation owners under the existing 2.x compatibility boundary.
The current contract tuple is owned by [status](./status.md#accepted-release-contract).
Embedded SFU SDP/ICE and demand travel over the
authenticated room WebSocket, without an external room service or media token.
Committed first-frame readiness, bounded candidate-relative progress, durable
room authority and the H.264/VP8 sender gate remain. [Status](./status.md)
indexes source and deployment evidence; protocol rollback requires
matching Browser and App artifacts, not only an application symlink.
Unfinished work is owned by the [TODO ledger](./todo.md).
[Verification status](./verification-status.md) summarizes material evidence
boundaries. Environment and initial
services are owned by [configuration](./standards/configuration.md) and
[self-hosting](./operations/self-hosting.md); application release is owned by
[deployment](./deployment.md), with exact deployed identity retained in the
release descriptor and deployment record.
Git history and pull requests own completed timelines.