## Problem and outcome / 问题与结果 Add camera sharing and Host microphone commentary to the existing Host workflow, with shared source cards, device selection, input gain and grouped sharing settings. Browser and native capture keep one outgoing audio track and the existing room/media owners. Include optional password-free invitations, public-tunnel protocol fallback, capture retirement and App-discovery feedback fixes. This is the complete capture maintenance phase; interaction, x86 capture and 4K experiments are excluded. ## Release notes ### 中文 这次更新让分享多了两种表达方式:用摄像头展示现场,用麦克风边分享边讲解。 分享设置也重新整理,并修复了公网邀请、音视频切换和采集退出中的一些问题。 #### 新功能与使用改进 - **摄像头分享**:在原有选源器中选择摄像头,支持设备选择和画面预览;支持摄像头访问的手机浏览器也可使用。 - **房主麦克风**:浏览器分享和 App 原生采集均可混入房主声音,支持选择麦克风、静音和输入音量调节。观众仍使用原有音量控件收听。 - **更集中的分享设置**:画质、声音和详细连接选项集中在画面下方,常用操作保持直接可用,并调整了窄屏播控与等待提示的布局。 - **邀请链接可选择是否免密加入**:关闭后,链接不再附带免密邀请;接收者按当前站点和房间的准入设置加入。 - **更清晰的启动设置**:可选站点口令默认收起,已有站点地址提供 `demo.piik.tv` 建议,并澄清 NAT 增强选项的含义。 #### 修复 - 公网邀请在 UDP 受限但 TCP 可用的网络中,可使用隧道组件原有的协议回退,减少这类启动失败。 - 调整音频时保留健康的视频发送;修复旧采集事件干扰当前分享的情况。 - 停止或取消原生采集时,先正常释放采集会话,超时才强制退出;修复本地复现的强制终止后 Windows 黄框残留问题。 - 从 App 打开的页面无法连接 App 时,选源器保留明确提示,不再只剩浏览器和摄像头选项而缺少原因说明。 #### 使用说明 摄像头和音频能力取决于系统、浏览器与设备。Windows 仍可能因权限或其他采集要求显示边框。 使用新增的 App 麦克风功能,请更新 App;连接自部署站点时,也请更新站点以获得对应页面功能。 ### English This update adds camera sharing and Host microphone commentary, alongside a clearer sharing-settings layout. It also fixes several public-invitation, audio/video transition and capture-shutdown issues. #### Features and usability - **Camera sharing:** choose a camera in the existing source picker, with device selection and thumbnail previews. Phone browsers with camera access can share too. - **Host microphone:** add commentary to Browser sharing or App-native capture, with device selection, mute and input gain. Viewers listen through their existing volume controls. - **Grouped sharing settings:** picture quality, sound and detailed connection options sit below the picture, while frequent actions remain directly available. Narrow-screen playback and waiting layouts are refined. - **Optional password-free invitations:** turn this off to copy a link without an invitation credential. Recipients then follow the site's and room's current admission settings. - **Clearer startup settings:** optional site-password settings are collapsed, the existing-site field suggests `demo.piik.tv`, and the NAT enhancement option has a clearer description. #### Fixes - Public invitations can use the tunnel component's existing protocol fallback when UDP is blocked but TCP is available, reducing startup failures on those networks. - Audio changes preserve healthy video sending. Retired capture events no longer affect an active share. - Stopping or cancelling native capture releases the capture session before enforcing the shutdown deadline. This fixes a locally reproduced case where forced termination left a Windows capture border behind. - Pages opened from the App keep a clear connection warning in the source picker when the App cannot be reached, instead of showing only Browser and Camera without an explanation. #### Usage notes Camera and audio support depend on the OS, browser and device. Windows may still require a border because of permissions or another active capture. Update the App to use its new microphone feature; update self-hosted sites as well to receive the matching page controls. ## Verification / 验证 - npm run check: 74 files / 1054 tests passed, TypeScript and production Web build passed. - npm run check:go: Go tests, vet, target builds and Windows native compile/regressions passed. - npm run gate:app-native-host: actual Windows H264 Host/Viewer, live/paused profile changes, quiet-source recovery, source replacement/failure, subsequent share and cleanup passed. - Windows 11 capture-border check: parent cancellation retires the actual WGC session and clears its border; subprocess tests verify normal, concurrent and timed-out retirement. - Website build, scripts typecheck, documentation and repository hygiene passed. - Native macOS/Linux packaging and Linux race checks run in CI before publication. Physical phone camera and real audio-level/echo/multiple-device coverage remain recorded limits; the owner authorized release with those limits. No universal NAT/border fix is claimed. ## Impact / 影响 Compatible feature release **v1.6.0**, explicitly approved by the owner. Browser/Server v23, Native control v9 and capture v7 stay unchanged; new App microphone commands use capability negotiation. No new dependency, port, media route, room lifecycle or storage migration. Published Server cutover retains configuration and room storage and uses bounded health checks with the previous executable available for rollback. Source, tests and owned documentation ship together; exact artifact/deployment identities remain outside the repo.
76 lines
4.6 KiB
Markdown
76 lines
4.6 KiB
Markdown
# Windows Capture Process
|
|
|
|
This isolated Windows process provides native capture for Piik App. It
|
|
enumerates local displays and visible top-level windows, binds each window to
|
|
its PID and process creation time, and has independent modes for:
|
|
|
|
- capability discovery (`--probe`);
|
|
- process-tree or default-device loopback PCM (`--capture-audio`); or
|
|
- WGC/D3D11 screen/window video with adapter-bound Media Foundation H.264 or
|
|
libvpx VP8 output (`--capture-video --codec auto|h264|vp8`).
|
|
- bounded 320x180 BMP source previews (`--preview`), delivered once per target
|
|
over the local control connection rather than the media route.
|
|
|
|
The video command receives the current product resolution, frame-rate, bitrate,
|
|
and quality preference. A replacement process applies live changes while the Go
|
|
session retains its Pion source and connections.
|
|
|
|
Sharing and source previews request borderless access by default when Windows
|
|
exposes `IsBorderRequired` and `GraphicsCaptureAccess` (build 20348+, including
|
|
Windows 11). The probe advertises API availability; the source-picker preference
|
|
passes `--show-capture-border` when the Host wants the sharing border visible.
|
|
One capture-local owner applies completed access without waiting
|
|
for consent, and cancels pending access on retirement. Unsupported APIs, denial
|
|
or failure retain ordinary capture; another capture session may still require a
|
|
border. The property value is a preference, not proof that the border is invisible.
|
|
Consumer Windows 10 through build 19045 lacks this API; the current WGC capture
|
|
path keeps its system border there.
|
|
|
|
Video and audio run as separate bounded child processes. A source whose audio
|
|
loopback cannot be initialized keeps video available and reports audio
|
|
unavailable instead of failing the whole source. Process loopback is probed by
|
|
activation rather than inferred from a Windows build number; display sources
|
|
use the standard render-device loopback available on Windows 10 and later.
|
|
|
|
Auto compares target-profile encoding work within a four-second selection
|
|
budget; H.264 that meets the target needs no software comparison. The selected
|
|
codec remains fixed across profile and source changes. VP8 reads the existing
|
|
NV12 surface through one staging texture and uses the same encoded-frame
|
|
boundary. The process has no network fallback. The App
|
|
consumes the selected process or system-audio stream through its native media
|
|
edge when the capability probe reports support. Build to the stable project
|
|
`build/go-check` directory for a bounded capability run:
|
|
|
|
```powershell
|
|
npm run check:native
|
|
```
|
|
|
|
The checks include synthetic output-worker replacement and failure cases using
|
|
WARP and a test codec, plus preview cleanup when WGC rejects a hidden test window.
|
|
They do not capture a user screen or validate a physical encoder.
|
|
|
|
The implementation follows Microsoft's MIT-licensed reference samples and
|
|
official API contracts without copying their WIL framework. The retained MF
|
|
fixture compiles the same encoder source with `PIIK_H264_FIXTURE`; there is
|
|
not a second product MFT implementation.
|
|
Shared local outputs use stock WebRTC source/encoder adaptation. H264 keeps
|
|
native NV12 surfaces, while WebRTC VP8 reads back into I420. The existing capture
|
|
and output mailboxes retain source/generation ownership; adapted sizes and
|
|
timestamps cross the same media envelope. Hardware low-latency mode stays on;
|
|
the old fixed one-frame VBV override is removed so later bitrate increases are
|
|
not trapped by the original buffer limit.
|
|
|
|
The build caches the pinned WebRTC SDK and matching official MSVC linker/runtime
|
|
libraries under `build/encoder-pool`. The SDK supplies libvpx, replacing the
|
|
separate source build. Only statically linked code and required notices enter
|
|
the package, not the SDK/toolchain or another runtime service.
|
|
|
|
- <https://github.com/microsoft/Windows-classic-samples/tree/main/Samples/ApplicationLoopback>
|
|
- <https://github.com/microsoft/Windows.UI.Composition-Win32-Samples/tree/master/cpp/ScreenCaptureforHWND>
|
|
- <https://learn.microsoft.com/en-us/windows/win32/api/audioclientactivationparams/ns-audioclientactivationparams-audioclient_activation_params>
|
|
- <https://learn.microsoft.com/en-us/windows/uwp/audio-video-camera/screen-capture>
|
|
- <https://learn.microsoft.com/en-us/windows/win32/api/windows.graphics.capture.interop/nf-windows-graphics-capture-interop-igraphicscaptureiteminterop-createforwindow>
|
|
- <https://learn.microsoft.com/en-us/uwp/api/windows.graphics.capture.direct3d11captureframepool.createfreethreaded>
|
|
- <https://learn.microsoft.com/en-us/uwp/api/windows.graphics.capture.graphicscapturesession.isborderrequired>
|
|
- <https://github.com/microsoft/Windows.UI.Composition-Win32-Samples/issues/97#issuecomment-1015962518>
|