Files
piik/native/capture/linux
T
AAA 6cb0ca1a34 fix: repair media startup and retire shared session resources (#483)
Early video retransmissions could be rejected before an SFU publication admitted its primary stream. The shared RTP reader now restores the associated primary identity before admission. A repository audit also found ownership omissions in Viewer input retirement, queued route work, partially constructed connections and sender-evidence cleanup; each is corrected at its existing owner without changing routing or adaptation policy.

The same phase fixes bounded Linux diagnostic encoding, picker/tooltip keyboard and touch behavior, and stale-language notices. Documentation now reflects current App, room and media lifecycles. Theme-role consolidation remains deferred.

Validation: complete Web check (1,685 tests, type-check and build); Windows Go core tests/vet/cross-builds; Linux CI race/vulnerability checks and all seven package targets; native Linux diagnostic fixtures on both architectures; actual Chromium/Pion SFU decode, live settings, reload/recovery and resource-retirement gate; documentation and website builds. Confirmed defects were compared against their baseline and independently reviewed. No protocol, configuration or persistence migration is required. Physical device limits and unmatched field reports remain open.

## Release notes

### 中文

这是一次分享稳定性与交互细节维护更新,兼容现有 2.x 客户端和站点。

- 修复部分服务器中转开播失败:较早到达的视频重传包不再被误判,导致媒体发布提前结束。
- 修复停播后快速重新分享时,旧任务可能拖延新线路准备的问题。
- 撤销邀请或替换观众会话时,同步清理对应的远控输入身份,保留其他观众的正常使用。
- 改善连接失败、观众反复加入退出后的资源回收;避免 Linux 单路输出的错误信息意外中断整个分享。
- 修正选源、互动和线路提示的键盘/触屏操作;切换语言后,当前校验与错误提示会同步更新。

### English

This maintenance update improves sharing reliability and interaction details. It remains compatible with existing 2.x Apps and Sites.

- Fix an SFU startup failure caused by video retransmissions arriving before the primary stream was admitted.
- Prevent retired sharing tasks from delaying route preparation after a quick stop and restart.
- Retire remote-input identities when invitations are revoked or Viewer sessions are replaced, while preserving other participants.
- Release resources correctly after connection failures and repeated Viewer churn; prevent Linux output diagnostics from unexpectedly ending the whole share.
- Improve keyboard and touch behavior in source selection, interactions and route help. Active validation and error messages now follow language changes.
6cb0ca1a34 · 2026-10-19 04:00:40 +08:00
History
..

Linux Capture Process

The Linux sidecar keeps the shared Native App contract while delegating desktop integration to the standard Linux media stack. XDG Desktop Portal owns the screen/window choice, PipeWire supplies the selected stream, and GStreamer selects an installed element classified as a hardware H.264 video encoder. Piik adds only the current product profile, Annex-B access-unit framing, key-frame requests, and the bounded SMED output protocol.

The Portal restore token remains in the active share process and lets a live quality change reacquire the same selected source without inventing a second source picker. System playback audio uses the PipeWire PulseAudio compatibility service when its GStreamer source is installed. Per-process audio is not advertised.

Build on a Linux desktop with development packages for libportal and GStreamer:

sh native/capture/linux/build.sh /outside/repository/build

Run npm run check:native on Linux to compile the sidecar, run the headless output-profile, source-geometry, segment-timestamp and retirement regressions, and validate its probe/source list. The same check runs when the Linux CI job packages an App candidate. For the native build and regression alone, add --check to the command above. The test uses synthetic input and GStreamer's core/base elements and needs no display, Portal session, capture device or hardware encoder; physical capture remains a separate check.

Input ticks, output activation and encoded frames use GStreamer running time, not raw buffer timestamps: encoders may offset PTS and the segment together. Keyframe events retain raw PTS for their timestamp field and normalized running time for their running-time field. The Portal stream uses the pipeline clock so unchanged content does not stop output keepalives.

GStreamer fits each source within the output's even-dimension ceilings while preserving presentation aspect. It renegotiates those dimensions on source resize; the encoded sample's caps supply the actual frame size. Requested profile dimensions remain configuration facts, not measured output.

Each output bin contains its downstream flow failures before they reach the shared tee. The main-context bus handler reports that output as unavailable and closes its valve before stopping the branch. Failed outputs remain retired for the source generation; healthy siblings continue. Shared source, decoder and protocol-output failures still end the capture run. Streaming callbacks report errors through the bus and never stop their own branch.

Runtime requirements are the desktop Portal/PipeWire services, a GStreamer PipeWire source, and an installed GStreamer hardware H.264 encoder. If any part is unavailable, the App reports no Linux Native path and the same Browser capture choice remains available. These system libraries and services are not bundled; their distribution-provided license notices remain applicable. Linux App packages repeat the dependency and source links in THIRD-PARTY-NOTICES.txt.

Primary references: