Commit Graph
6 Commits
  • feat!: expand media controls and simplify App connections
    ## Problem and outcome / 问题与结果
    
    Piik's media settings were coupled to a small preset list, and using native App capture on a Site required a separate launcher mode. This release separates numeric media requests from presets and bounded runtime admission, remembers successfully applied settings, and lets a running App serve an explicitly approved Site independently of Local/public room startup.
    
    The same phase repairs confirmed capture-retirement, ICE discovery, media-recovery and storage failures. P2P-first routing, one room authority and the existing Browser/Native media owners remain. This phase targets **v2.0.0** with incompatible Web/App contracts. The owner authorized publication after final acceptance; the verified package and deployment records own delivery completion.
    
    ## Release notes
    
    ### 中文
    
    Piik 2.0 扩展了画质设置,简化了 App 与站点的连接,并集中修复采集和断线恢复问题。**本次升级调整了通信协议,App 与所用站点需要一起升级。**
    
    #### 新功能与改进
    
    - **自定义画面设置:** 保留三档推荐预设,支持填写分辨率上限、1–240 帧的帧率上限和 0.1–240 Mbps 的视频码率上限。滑动条沿用常用范围,更高数值可直接填写并显示为“自定义”。帧率范围随画幅变化,可请求 1080p240、1440p144、4K60 和超宽画面;输出保留来源比例。
    - **自定义音频质量:** 在原有三档音频预设之外,可填写 6–320 kbps 的来源音频码率上限。
    - **双端 App 协同连接:** 启用增强 NAT 穿透后,适用的重试可协调双方 App 准备 UDP 连接;首次连接仍走普通 ICE,不适用时继续现有流程。已通过受控网络验证,实际连通性仍取决于双方网络。
    - **记住分享设置:** 下次打开时恢复已应用的画面与音频质量。仅用浏览器时按站点保存;通过新版 App 使用时,更换临时公网邀请网址也能保留设置。
    - **更直接地连接 App:** 启动页提供本地房间和公网邀请,首次默认选择公网邀请。使用已有站点时,保持 App 运行,在站点点击 **App** 并确认授权即可。App 打开的本地房主页自动获得授权,站点按钮会显示 App 就绪状态。启动页可查看或取消授权;从另一个站点连接并批准,会替换原授权。
    - **置顶聊天窗口:** 支持的桌面浏览器可将聊天移入独立置顶窗口,保留当前消息、草稿和阅读位置;关闭窗口后回到原页面。
    
    #### 修复
    
    - **连接与恢复:** 完善备用 STUN 与 NAT 采样信息的处理;重新收集 ICE 候选时刷新网卡地址。修正观众重连的机会计数、本机媒体连接恢复,以及恢复后遗留的发送队列和带宽统计问题。保留视频编码对应的标准重传能力,改善网络地址变化后的画面恢复。
    - **采集稳定性:** 修正 Windows 停止采集或预览时的异步资源释放问题,保留采集边框偏好,更快跳过无法正常输出的编码器。采集与应用音频能力按实际接口探测,不再按 Windows 版本号排除;修正 Linux Portal 来源识别和早期采集失败通知,改善摄像头与原生采集的画面比例处理。
    - **状态与清理:** 房间失效时及时释放 App 连接和待完成的选源请求;本地或公网房间启动失败时,App 保持待机并保留其他已授权站点的连接;公网邀请启动失败保留底层错误。修正启动页旧查询覆盖新设置的问题,并限制原生连接准备的待完成任务。SFU 诊断区分房主发布和观众接收状态。
    - **其他维护:** 收到尚不支持的表情时跳过该效果;修正 SQLite 写入失败后的事务恢复。Gitee 镜像可独立重试,官网交互、指南和依赖同步更新。App 连接失败时提供重试与下载入口;统一选源设置与自定义数值的反馈。减少重复的随机短语,仅在持续等待时定时轮换。
    
    #### 升级须知
    
    **2.0 与 1.x 不能混用。** 自建站点请更新 Server 和连接该站点的 App,并刷新所有分享与观看页面。本地房间或公网邀请用户请停止分享、关闭旧 App,完整解压新版程序包后重新发送邀请链接。
    
    本次不变更房间数据库结构。重启会中断正在进行的分享;麦克风、采集权限和设备选择不会自动恢复。4K60 等设置是输出上限,实际清晰度与帧率取决于来源、设备和网络。macOS/Linux 采集及部分移动设备仍需更多实机反馈。
    
    ### English
    
    Piik 2.0 adds more control over sharing quality, simplifies connecting the App to a Site, and fixes capture and connection-recovery failures. **The communication contracts change in this release: update the App and its Site together.**
    
    #### Highlights
    
    - **Custom picture settings:** Keep the three recommended presets or enter a resolution ceiling, a 1–240 fps limit and a 0.1–240 Mbps video bitrate limit. Sliders retain their familiar ranges; higher entered values are clearly marked as custom. Frame-rate limits depend on picture size, admitting requests such as 1080p240, 1440p144, 4K60 and ultrawide pictures while preserving source proportions.
    - **Custom audio quality:** Enter a 6–320 kbps source-audio bitrate limit alongside the three existing audio presets.
    - **Coordinated App connections:** With enhanced NAT traversal enabled, eligible retries can coordinate UDP preparation between two Apps. The first attempt remains ordinary ICE, and ineligible preparation continues through the existing path. Controlled network checks pass; real-world connectivity still depends on both networks.
    - **Remember sharing settings:** Restore successfully applied picture and audio quality next time. Browser-only use saves settings per site; an updated App can retain them across changing temporary public-invitation addresses.
    - **Connect the App from a Site:** The launcher offers Local room and Public invite, with Public invite selected on first use. For an existing Site, keep the App running, click **App** on the Site and confirm its authorization. Host pages opened locally by App are authorized automatically, and the Site button reflects verified App readiness. View or revoke approval in the launcher. Connecting and approving another Site replaces the previous approval.
    - **Always-on-top chat:** Supported desktop browsers can move chat into a separate always-on-top window while retaining messages, drafts and reading position. Closing the window returns chat to the page.
    
    #### Fixes
    
    - **Connections and recovery:** Improve fallback STUN discovery and NAT survey handling, and refresh interface addresses during ICE gathering. Fix Viewer recovery-opportunity accounting, local media-connection recovery, stale send queues and bandwidth accounting after recovery. Preserve standard video retransmission when selecting a codec to improve picture recovery after network-address changes.
    - **Capture stability:** Fix asynchronous Windows resource retirement after capture or preview ends, retain the capture-border preference, and reject non-performing encoder candidates earlier. Detect capture and process-audio support through actual APIs rather than Windows-version gates. Correct Linux Portal target identification and early capture-failure delivery; improve source-aspect handling for camera and native capture.
    - **State and cleanup:** Release App connections and pending source selection when room authority ends. Keep the App on standby and preserve other authorized Site connections when interactive Local/public room startup fails. Retain underlying public-invitation startup errors. Prevent stale launcher reads from replacing newer settings, bound pending native connection-preparation work, and distinguish Host publication from Viewer reception in SFU diagnostics.
    - **Maintenance:** Skip unsupported incoming reaction effects, recover SQLite transactions after write failures, and retry Gitee mirroring independently. Update website interactions, guides and dependencies; clarify App connection recovery, source-selection settings and custom-value feedback. Reduce repeated playful captions, with timed rotation reserved for ongoing waits.
    
    #### Upgrading
    
    **2.0 and 1.x cannot be mixed.** For a hosted Site, update its Server and connected Apps, then refresh every Host and Viewer page. For Local rooms or Public invites, stop sharing, close the old App, extract the complete new package and send a fresh invitation.
    
    The room database schema is unchanged. Restarting interrupts active shares; microphone activation, capture permission and device selection are not restored automatically. Settings such as 4K60 are output ceilings: actual resolution and frame rate depend on the source, device and network. macOS/Linux capture and some mobile devices still need more physical-device feedback.
    
    ## Verification / 验证
    
    - Product candidate: `24a28738241b9012c0476386356a515aab21f1a5`, built as `v2.0.0`. [Final full candidate CI](https://github.com/TNTcraftHIM/Piik/actions/runs/38555494851) covers core validation, vulnerabilities, races, five App packages and both Server/container targets without publishing. Later commits extend race coverage, correct the capture test fixture's inherited Go race-exit delay, and update documentation/staged website screenshots; shipped product code is unchanged. [Additional control/loopback race checks](https://github.com/TNTcraftHIM/Piik/actions/runs/38561191343) use that updated collector. Product shutdown deadlines and test assertions are unchanged.
    - Local Web acceptance passes **91 files / 1,612 tests**, type checking and production build. Full Go/native checks, Windows capture compilation, five-repeat control regressions, website/documentation build and repository checks pass. Existing documentation-size and bundle-size warnings remain visible.
    - The Windows candidate's original descriptor, revision and SHA-256 are checked before extraction and packaged Local/control acceptance. All candidate packages pass the release publisher's read-only identity/checksum verification.
    - Serial Windows native H.264 Host acceptance passes live/paused/custom/4K settings, background/source recovery and stop/re-share. VP8 two-room SFU and H.264 SFU-only checks pass live quality/audio changes, subscription/page-reload recovery and retirement; stopping one room preserves the other room's media. Browser-to-App fanout and App-exit fallback also pass. Gates clean their processes, profiles and listeners. These checks do not establish sustained game/4K performance.
    - The final network run passes **37 cases and six negative controls**, with **32 actual media outcomes and five unavailable observations**. It covers all Browser/App pairings, IPv6, remapping, STUN backup, outages, quality recovery, healthy siblings and SFU policies. Sequential-NAT App/App preparation delivers media; a mixed sequential case also connects in this run, without a claim of deterministic benefit. Fault controls reject absent faults/frozen video and verify cancellation/cleanup. No public success percentage is inferred.
    - Twenty Viewer topology acceptance delivers increasing decoded frames to all Viewers, preserves the two-copy bound and recovers from relay loss. Invitation privacy checks find no grant leakage in requests, cookies, persistent storage or logs. Both are bounded synthetic-source checks, not public-network endurance.
    - Current UI checks cover Chinese/English/visual, both themes and 320/360/768/1366-pixel layouts, numeric limits, source selection, App approval/revocation, architecture downloads and reader navigation. Chat/PiP retains draft/history/scroll and returns to the page on close; retirement and refused opening clean up. Real Host/Viewer UI chat continues after capture stops and while the Host is absent. Film controls, mute/seek/end/replay, mobile containment and pointer-close unloading pass. README stills and the staged launcher now use current navigation. Scoped axe checks report no violations; contrast and physical assistive-technology coverage are not certified.
    - Physical macOS/Linux capture, limited decoders, mixed HDR displays, mobile permissions and sustained game/4K use retain their [evidence limits](https://github.com/TNTcraftHIM/Piik/blob/ci/gitee-mirror/docs/verification-status.md). Unmatched field reports remain open. Gitee activation and public-domain checks are publication postflight; original v1.9.2 artifact/mirror recovery already passed without remote writes.
    
    ## Boundaries and contributor credit / 边界与贡献
    
    The candidate uses Browser/server v24 and Native control v10; capture v7 and SQLite schema 2 are unchanged. Numeric wire values remain separate from codec/allocation admission. H.264/VP8, framework-owned adaptation and automatic P2P-first routing remain; this candidate adds neither codecs, room voice, end-to-end HDR, surround audio nor Magicsock.
    
    Local controls confirm specific repairs, not the causes of unmatched user reports or a measured increase in NAT success rate. The STUN report in #471 remains subject to paired endpoint/network evidence. Gitee's separate workflow activation still needs post-merge verification; its original-artifact and anonymous-download path has passed against v1.9.2.
    
    The Linux Portal fix from @AkazaAkali in #470 is incorporated with original commit authorship and the co-author trailer below. #462 and #469 propose higher audio rates and 4K; neither patch is merged. Their preset-expansion implementation is superseded by the independently established numeric-media contract, so overlapping functionality alone does not warrant merging or co-authorship. #475 identifies the Linux desktop entry’s missing terminal controls; that defect is independently corrected without accepting tray or Browser-owned process-exit additions. The settings request in #460 is implemented; issue/PR closure remains part of release follow-up.
    
    Co-authored-by: AkazaAkalin <478080766@qq.com>
  • feat(app): improve sharing controls, recovery and troubleshooting
    Sharing failures were often reduced to a generic message, and changing Windows audio exclusion required reopening source selection. This phase keeps actionable failure context at the TV status indicator, adds live source-audio controls, and integrates independent capture, codec and ICE-lifetime repairs against the published contract.
    
    The audio controls reuse source replacement and the existing mixer; audio-only changes preserve video capture, encoded sources and connections. Source enumeration is bounded by the serialized control response. Codec preflight and H.264 decoder input enforce the existing native format. Gateway mappings are revalidated only for actual ICE gatherings. Website scripts and styles now share content-addressed build output.
    
    Browser/server v23, Native control v9, capture v7 and the 1440p ceiling stay unchanged. The held 4K/capability candidate and Magicsock transport are excluded. Documentation changes belong to the existing guides, standards and evidence owners.
    
    ## Validation
    
    - `npm run check`: type checking, 81 test files / 1,370 tests and the production Web build passed.
    - `npm run check:go`: Go tests, formatting, vet, cross-builds and Windows native capture regressions passed. A first run hit Windows temporary-directory cleanup after an unchanged SQLite test; five focused repetitions and the full rerun passed.
    - Native Host gates passed separately with H.264 and VP8: live/paused quality changes, minimized-window recovery, source replacement, Viewer decoding and complete process/port cleanup. The App Local entry/authentication/invitation gate passed.
    - Website/documentation build, documentation links and repository hygiene passed. Browser review covered Chinese/English, dark/light controls, 320px/360px and desktop layouts, audio selection/off state, troubleshooting dialog/ESC focus return, matching GitHub/Gitee architecture links and the embedded film.
    - macOS/Linux physical capture, Windows 10 exclusion and representative network/device coverage remain explicit evidence limits. CI must pass Linux race checks and native packaging before publication.
    
    ## Release notes
    
    ### 中文
    
    这是一次分享体验与兼容性更新。Windows App 支持在开播后调整排除的应用声音;遇到分享失败时,也有更清楚的提示和排查入口。
    
    #### 使用改进
    
    - 在「分享设置 → 声音」中调整系统声音和排除的应用,无需停止分享。支持的 Windows 10 系统也会按实际能力显示排除选项。
    - 分享失败提示保留具体原因。点击电视下方状态,可查看处理建议、诊断入口及对应的故障排查文档。
    - 补全中英文常见问题说明,涵盖 App 连接、选源与编码、站点地址配置、严格网络和浏览器 HDR 限制。
    
    #### 修复
    
    - 修复窗口较多或名称较长时选源列表可能加载失败,以及部分独立窗口未列出的情况。
    - 改善 Windows 窗口最小化、恢复后的采集衔接。
    - 修复部分 Firefox 编码属性影响连接的问题,并使原生接收的格式预判与实际支持范围一致。
    - 重连时刷新网关端口映射,避免沿用已失效的映射结果;加强原生 H.264 输入校验。
    - 官网下载架构切换增加统一动效,脚本与样式使用带内容标识的地址,减少更新后的缓存混用。
    
    更新 App 并刷新页面即可使用相应改进,无需迁移配置或房间数据。Windows 10 音频排除是否可用取决于系统能力。
    
    ### English
    
    This update improves sharing controls and compatibility. Windows App users can change audio exclusion during a share, and sharing failures now provide clearer guidance and a direct troubleshooting entry.
    
    #### Improvements
    
    - Change system sound and the excluded application under **Sharing settings → Sound** without stopping the share. Supported Windows 10 installations can also expose exclusion after the capability check.
    - Sharing failures retain their specific cause. Select the status below the TV for recovery suggestions, diagnostics and the relevant troubleshooting guide.
    - Updated English and Chinese guides cover App connectivity, source selection and encoding, site-address configuration, restricted networks and Browser HDR limitations.
    
    #### Fixes
    
    - Fixed source lists failing with many windows or long titles, and certain independent application windows being omitted.
    - Improved Windows capture transitions when a window is minimized and restored.
    - Fixed stale Firefox codec attributes disrupting connections and aligned native receiver preflight with its supported formats.
    - Refresh gateway port mappings for new ICE gatherings instead of reusing stale results, and validate H.264 input before native decoding.
    - Added consistent motion to website architecture selection and content-hashed script/style URLs to prevent mixed cached versions.
    
    Update the App and reload the page to use the relevant improvements. No configuration or room-data migration is required. Windows 10 audio exclusion depends on actual system capability.
  • fix(app): improve capture selection and media recovery (#433)
    ## Problem and outcome / 问题与结果
    
    This maintenance phase fixes failures around native capture startup, room reconnection and media handoffs. Capture mutations stay cancellable, relayed-content failures remain request-scoped, and failed media connections return to the existing route controller. Windows Auto codec selection measures delivered cadence instead of timer-sensitive per-frame work estimates.
    
    The phase preserves P2P-first routing, one committed graph and one route operation. It adds no signaling replay mechanism, changes no wire/schema version, and includes no interaction prototype or 4K feature work.
    
    ## Release notes
    
    ### 中文
    
    Piik v1.6.8 是一次稳定性修复,重点改善 Windows 原生采集、断线恢复和分享过程中的控制响应。
    
    #### 修复与改善
    
    - **更准确地选择编码器。** Windows 的自动模式按实际出帧表现评估 H.264,并正确区分启动预热和持续性能不足,减少计时误差导致的不必要 VP8 回退。硬件编码事件改为异步等待。
    - **改善断线与线路切换。** 房间信令短暂断开后保留观众成员身份 20 秒;修复线路切换、SFU 订阅恢复及声音重协商卡住的问题。失效连接及时交回现有路由控制器处理,原生 SFU 发送端不再把短暂断连直接判为终止。
    - **保持 App 控制响应。** 开始分享和更换来源时仍可取消操作;合法消息突发不再直接关闭控制连接。中继信令的单条内容错误不会连带结束整场原生分享。
    - **修正设备列表与配置保存。** 来源或麦克风数量达到上限时保留可用列表;配置替换失败时保留原有设置。
    - **改善紧凑布局和辅助功能。** 调整手机横屏下的画面与播控布局、画质预设标签和长邀请链接显示,修正部分提示与辅助功能语义。
    - **加强站点访问保护。** 站点登录 Cookie 使用独立随机签名密钥,应用自身阻止被其他页面嵌套。发布说明也会在合并前检查。
    
    #### 升级说明
    
    通信协议和持久化格式保持不变。设置了站点密码时,App 或 Server 重启后需要重新输入站点密码;持久化房间和邀请授权不受这项 Cookie 调整影响。Piik 操作页面不再支持嵌入 iframe。
    
    ### English
    
    Piik v1.6.8 is a stability update focused on Windows native capture, connection recovery and responsive sharing controls.
    
    #### Fixes and improvements
    
    - **More accurate codec selection.** Windows Auto mode evaluates H.264 using delivered frames and distinguishes startup warmup from sustained performance limits, reducing unnecessary VP8 fallback caused by timing noise. Hardware encoder events now use asynchronous waiting.
    - **Improved reconnection and route handoffs.** Viewer membership survives brief signaling outages for 20 seconds. Fixes cover route activation, SFU subscription recovery and stalled audio renegotiation. Failed connections return to the existing route controller, and the native SFU publisher no longer treats a transient disconnect as immediate termination.
    - **Responsive App controls.** Starting a share and replacing its source remain cancellable. Valid message bursts no longer close the control connection, and an invalid relayed payload cannot terminate the entire native sharing session.
    - **Device lists and saved settings.** Source and microphone enumeration retain a usable list at their limits. Failed configuration replacement preserves the previous settings.
    - **Compact layouts and accessibility.** Improved picture and playback-control layout on landscape phones, quality preset labels and long invitation links, with corrected tooltip and accessibility semantics.
    - **Stronger site-access protection.** Login cookies use an independent random signing key, and the application prevents embedding by other pages. Release notes are also checked before merge.
    
    #### Upgrade notes
    
    Wire protocols and persistent formats are unchanged. If a site password is configured, restarting the App or Server requires entering it again; this cookie change does not revoke persisted rooms or invitation grants. Piik operation pages can no longer be embedded in an iframe.
    
    ## Verification / 验证
    
    - `npm run check`: passed, 76 test files / 1,171 tests, TypeScript and production Web build.
    - `npm run check:go-core`: passed; full Go/native checks also passed during integration of the capture changes. macOS cgo builds remain native-runner checks.
    - Windows native Host gates: Auto, H.264 and VP8 passed during the phase; final control changes rechecked with Auto, including live/paused quality, source replacement, failure retirement and subsequent sharing.
    - Embedded SFU browser VP8 recovery: passed with production Host/Viewer route owners.
    - Embedded SFU native H.264, two rooms: passed, including recovered decoded video/audio, independent room retirement and resource cleanup.
    - Documentation, repository hygiene and diff checks: passed. Final follow-up changes only align operations documentation with the PR note check.
    - Go race checks could not run locally because no cgo/GCC toolchain is available; the existing Linux CI race job remains required. AMD/Intel hardware, broader device combinations, public-NAT field reports and long endurance are not established by these local checks.
    
    ## Impact / 影响
    
    Compatible patch release after v1.6.7. The cookie and frame-protection effects are disclosed in the public upgrade notes. No automatic retry budget, room-code admission policy, room lifetime or media topology is replaced. Reports without matched diagnostics and unmeasured native performance costs remain in the TODO ledger.
  • feat: rename product and runtime to Piik
    Rename the active product, Go module, binaries, configuration, protocols and documentation to Piik while retaining the TV mascot and existing media/room behavior.
    
    Use one current private contract without old-name aliases. Preserve SQLite authority and copy compatible local settings once; other settings start fresh. Git-message cleanup and the infrastructure name cutover are coordinated with this phase, with original history and deployment data archived externally.
    
    Validated locally with Web and Go checks, Windows capture compilation, matched Client/Server builds, packaged Client control handshake and history-rewrite integrity checks. Skip duplicate hosted CI for this owner-authorized local release.
    
    [skip ci]
  • feat(media): share Browser encoding and complete local diagnostics
    * fix: allow Linux interface discovery in embedded media service
    
    * feat: expand local diagnostic reports
    
    * research: validate independent Browser encoding producers
    
    * feat: prototype Browser pool ownership and record remaining media gates
    
    * feat: refine Browser shared encoders and native output reuse
    
    * Refine carrier costs and simplify release entry points
    
    * Close media phase and prepare piik design handoff
  • feat(media): integrate embedded media services and shared native encoding
    Embed STUN and SFU in the shared Go process, reuse native encoding pipelines with independent adaptation, and complete Client lifecycle, settings, diagnostics and packaging fixes. Retain standard Browser senders after measured encoded-reuse limitations.