Keep the two source-star controls in their research owner and require source-to-flow mapping before a delivered-share comparison. Reply with the public observer outcomes without exporting mappings or removing endpoints from one sample. Record the integrated lifecycle corrections and their verification scope, close completed configuration/deadline/decoding audits, and retain physical frame acceptance. Search placement and production automatic-capacity policy remain proposed.
533 lines
34 KiB
Markdown
533 lines
34 KiB
Markdown
# Capture, Audio, And Media Quality
|
||
|
||
This file owns the 3.0 Browser and App media contract; published 2.x follows
|
||
its [media standard on main](https://github.com/TNTcraftHIM/Piik/blob/main/docs/standards/media-quality.md).
|
||
Detailed measurements and platform limits live in
|
||
[realtime quality research](../research/realtime-quality-adaptation.md) and
|
||
[screen-audio research](../research/browser-screen-audio-quality.md).
|
||
[ADR-0008](../adr/0008-window-scoped-audio-capture.md) owns screen-audio scope,
|
||
and [ADR-0013](../adr/0013-embedded-node-local-media.md) owns sharing one
|
||
encoding among children. This file describes that product
|
||
contract. [Status](../status.md) indexes delivery and remaining acceptance.
|
||
|
||
## Capture And Controls
|
||
|
||
The [screen-delivery model](../research/channel-network-design.md#screen-demand-uses-reachable-paths)
|
||
owns the Viewer's playback buffer target, and
|
||
[fidelity evidence](../research/media-fidelity.md#playback-buffering) its
|
||
measured smoothness and delay.
|
||
|
||
Room voice handles Host and Viewer conversation microphones, separate
|
||
from source sound and optional Host source commentary. Its Browser capture owner supplies device selection, input
|
||
gain and optional speech processing, including on App-backed pages. Settings
|
||
remain local to the Browser origin; joining and microphone activation are never
|
||
remembered. Stopping picture capture does not stop room voice. Source audio stays
|
||
with the picture; room voice prioritizes interactive latency and is not promised
|
||
to remain synchronized with a delayed picture.
|
||
Microphone gain, master voice listening volume and each person's local volume
|
||
range from 0% to 200%, defaulting to 100%. Master and per-person listening gains
|
||
multiply. Per-person levels belong to the current participant identity and retire
|
||
with it. Listening gain, deafen and per-person mute affect only local playback,
|
||
never forwarding or the picture's source audio.
|
||
|
||
3.0 room voice keeps a 64 kbps default ceiling. That ceiling is room policy:
|
||
someone who can manage the room sets it from 6 to 320 kbps in the voice
|
||
settings. Changing it does not open voice, activate microphones or replace
|
||
routes. With voice processing off it
|
||
requests stereo input; actual device channels remain platform-owned.
|
||
[Microphone fidelity](../research/media-fidelity.md#30-room-microphone) owns the
|
||
measured platform scope. Its local microphone modes are open, push to talk and
|
||
voice activation. Open mode adds no gate; the optional gate acts after processing
|
||
and gain on the audio thread. Mute overrides every mode. A held talk action ends
|
||
on key release, window inactivity or owner disposal, even if its binding changes.
|
||
Threshold and mode preferences do not join voice or open a microphone.
|
||
|
||
The Host may enable **Sharing settings → Sound → Include my microphone** to mix
|
||
commentary into the picture's audio. It starts off for each new share and retires
|
||
with that share. Source replacement within the Browser or Native capture path
|
||
retains the enabled commentary input and gain. Browser capture reuses the stable
|
||
HostAudio source/microphone output; Native capture reuses its mixer and microphone
|
||
API. Room voice has its own room lifetime. Both microphones may be enabled intentionally; the UI warns
|
||
that listeners may hear the same speech twice through the separate deliveries.
|
||
Piik does not automatically mute either microphone or switch between them.
|
||
|
||
- The Web Host may share a display, application window, Browser tab or camera and may
|
||
stop, synchronously pause/resume audio and video, or switch source.
|
||
- An App-launched Host explicitly chooses either that Browser capture path or
|
||
one native screen/window enumerated by the packaged platform capture boundary. The
|
||
latter uses one supported native codec path and never infers a target from
|
||
a title. An ordinary Web Host does not probe localhost.
|
||
- Camera is a peer source choice in the same picker, including on phones. Only
|
||
the chosen source requests permission. Camera input and thumbnails request
|
||
an uncropped device format; sender constraints own later scaling.
|
||
Camera capture does not implicitly open a microphone. Source commentary and
|
||
room voice require their own explicit activation. A microphone device/processing change keeps the previous input
|
||
on failure and does not replace picture media. Browser processing preferences
|
||
do not bypass device/system effects.
|
||
- Source-audio availability belongs to the Host capture owner. A live source
|
||
input makes source audio available; a retained Native output track alone does
|
||
not. This describes input presence, not measured
|
||
loudness; quiet content, share pause and Viewer-local mute remain separate facts.
|
||
Source replacement and source-audio changes update this fact without rebuilding
|
||
the output or media route. An opted-in room session carries it for the current
|
||
publication, including late joins and signaling reconnects.
|
||
- An audio-only update with the same capture video preserves the Browser video
|
||
sender, encoding state and startup evidence.
|
||
A new video source owns a new startup baseline; audio changes do not.
|
||
On Browser direct edges, source/audio renegotiation waits for the current
|
||
answer and coalesces newer intent into the next offer. A local operation queue
|
||
alone does not serialize the remote offer/answer exchange.
|
||
- Windows native capture follows an explicitly stretched active display path
|
||
for an entire display or a window covering that display, when the captured
|
||
frame matches its desktop source dimensions. Other frames retain their own
|
||
aspect ratio. This changes only the encoded presentation, never the game or
|
||
display settings; vendor-private scaling is not inferred.
|
||
- Windows and Linux outputs preserve source presentation aspect within the
|
||
selected ceiling, rounded to even dimensions. Small sources are not enlarged
|
||
to a fixed landscape canvas. Windows uses its existing converter; Linux uses
|
||
GStreamer's size negotiation. Source resizing does not create a new room or
|
||
route, and frame envelopes carry actual output dimensions. Network adaptation
|
||
remains owned by the existing media framework.
|
||
- Windows SDR conversion owns one output color contract: limited-range BT.601
|
||
NV12 with matching H.264 metadata. RGB capture and decoded video retain their
|
||
input range/matrix through conversion and relay scaling; dimensions do not
|
||
determine color space. Unspecified SDR follows the WebRTC convention.
|
||
- Windows native HDR sources retain scRGB FP16 until platform tone mapping,
|
||
source-display white-level adjustment and sRGB conversion produce SDR. Live
|
||
capture and source thumbnails share this owner; conversion precedes output
|
||
fanout and does not add a media route or per-encoder tone curve. Ordinary SDR
|
||
keeps its copy path. Source-display color changes refresh capture input,
|
||
not room authority or transport. [Fidelity evidence](../research/media-fidelity.md)
|
||
owns platform checks; this is HDR-to-SDR, not end-to-end HDR delivery.
|
||
- Where Windows supports border control, the native source picker offers
|
||
**Show capture border**, off by default. The choice stays in the Host page and
|
||
follows native source and quality changes. Source previews request borderless
|
||
capture independently. Windows owns consent and final border visibility;
|
||
unsupported, pending, denied or failed access must leave ordinary capture and
|
||
stop controls usable. Other capture sessions can keep the border visible.
|
||
Browser indicators remain browser-owned.
|
||
- Display/window/tab capture requests ask the Browser for available audio by
|
||
default. Missing audio is reported clearly but does not block video-only
|
||
sharing. Native screen capture can include system playback audio and native
|
||
window capture can include selected-process audio when the platform exposes it.
|
||
- Shared Browser encoders normalize capture orientation into pixels before
|
||
reusing encoded frames across receivers: the producer's local negotiation
|
||
omits the RTP video-orientation extension, which pooled outputs do not copy.
|
||
Ordinary senders keep Browser-owned orientation handling.
|
||
- Authoritative Browser pause disables the current source and sender-owned tracks
|
||
while retaining the room and established routes. The connection owns its
|
||
encoded-output pause even when shared encoding is unavailable; the pool pauses
|
||
a shared producer only when all its members pause. Native pause keeps capture
|
||
alive but stops session output through the same owner. Black frames, track
|
||
mute, or network failure are not interpreted as a user pause.
|
||
- The Host preview displays the capture stream directly and creates no Viewer or
|
||
media route. Hiding the page may pause only that local video element; it must
|
||
not intentionally stop capture, encoding, or upload.
|
||
- Live quality changes update the current capture and Host sender-track
|
||
constraints plus sender ceilings without reopening source selection or
|
||
replacing a healthy route. Shared Browser capture constraints express size
|
||
ceilings, not ideal dimensions or a fixed aspect ratio: lowering a ceiling
|
||
must not request a crop, and source orientation remains Browser-owned.
|
||
- Native quality changes use the same room settings. The App prepares a new
|
||
platform capture/encoder generation, then replaces the old generation behind
|
||
the same encoded source and PeerConnections; audio-only changes update the
|
||
current Opus encoder directly. A live profile update may remain pending while
|
||
the selected source produces no frames. Setup and encoding failures remain
|
||
bounded; quiet-source waiting must not block pause, stop or connection control.
|
||
Applied settings change only after the replacement is ready and installed;
|
||
required-output failure preserves the previous capture and profile. Failed lower
|
||
outputs stay unavailable across preparation and installation without rejecting
|
||
a healthy original output. Platform quality preference uses the hardware
|
||
encoder's standard quality-versus-speed hint.
|
||
Windows VP8 uses libvpx's realtime mode; it does not claim the same hardware
|
||
quality-versus-speed control or per-edge Browser adaptation.
|
||
|
||
## Video Profiles
|
||
|
||
The Host remembers explicitly applied picture and source-audio quality settings
|
||
for the Browser origin. These preferences seed a new page, never an active share.
|
||
Failed or superseded changes and server snapshots do not replace the preference.
|
||
Storage failure never fails capture or startup. This does not retain capture
|
||
permission, device/session identity, routing policy or microphone activation.
|
||
|
||
The three recommended profiles are ceilings, not delivery guarantees:
|
||
|
||
| Profile | Target | Video bitrate ceiling |
|
||
| --- | --- | ---: |
|
||
| `720p30` | 1280x720 at 30 fps | 3 Mbps |
|
||
| `1080p30` | 1920x1080 at 30 fps | 5 Mbps |
|
||
| `1080p60` | 1920x1080 at 60 fps | 8 Mbps |
|
||
|
||
`1080p30` is the default. Quality settings carry numeric width/height ceilings;
|
||
480p, 720p, 1080p, 1440p and 4K are UI shortcuts. Advanced picture settings also
|
||
accept custom even dimensions within the combined implementation bounds below.
|
||
Width and height form one applied edit. A size change caps the requested frame
|
||
rate in the same quality operation when the larger size requires a lower limit.
|
||
Larger wire-valid requests do not
|
||
authorize an adapter to exceed its local capture, codec or allocation limits.
|
||
Numeric requests use representational bounds rather than the current control
|
||
ranges. Current capture admits integer 1..240 fps and 0.1..240 Mbps, further
|
||
limited by picture size. Advanced controls accept typed values alongside sliders;
|
||
the three recommended profiles and default remain unchanged. These are useful
|
||
product controls, not universal codec
|
||
limits or a minimum for framework-driven output. Codec and resource budgets
|
||
apply separately. App descriptions may advertise stronger capabilities;
|
||
controls use their intersection with local support. An unsupported request is
|
||
an operation failure, not malformed signaling. An unsupported saved preference
|
||
does not seed capture or overwrite its stored value with a fallback.
|
||
Derived outputs must stay within their source bitrate ceiling, including when
|
||
that ceiling is below a usual lower-output floor. Codec preflight must observe
|
||
real encoded progress; cadence tolerance alone cannot make zero output pass.
|
||
Frame rate, bitrate, and `maintain-resolution | balanced |
|
||
maintain-framerate` retain their controls. A Browser display sender's
|
||
`contentHint` follows the stored preference: `detail` for `maintain-resolution`,
|
||
`motion` otherwise, because Chromium turns an explicit `balanced` into
|
||
`maintain-resolution` for screen content. Browser relays use the publication's source kind, and
|
||
camera senders use `motion`. Startup protection changes only the sender preference, the
|
||
automatic codec preflight encodes with the share's mapped hint, and the
|
||
encoding pool's carrier keeps its own transport hint.
|
||
Native H264 retains Constrained Baseline. Capture validates the coding-tool subset under
|
||
RFC 6184, including equivalent Constrained Baseline constraint bytes, and reports
|
||
the actual SPS profile/level; one vendor's byte spelling is not the contract.
|
||
The platform encoder selects its level from the requested format. Validate the
|
||
actual supported level instead of forcing a calculated minimum into the encoder.
|
||
Native ingress and relay accept only a negotiated profile/packetization compatible
|
||
with their unchanged encoded downstream source. A codec name alone is not enough;
|
||
same-source renegotiation must preserve that boundary before altering the live peer.
|
||
Received picture summaries are not decoder allocation limits. Before Native
|
||
derivation, validate every H.264 sequence parameter set's supported format,
|
||
coded storage and visible crop; a later small descriptor cannot authorize earlier
|
||
large input.
|
||
|
||
Candidate capture admits even dimensions up to 8192 per axis and 36,864
|
||
16x16 macroblocks per picture, including alignment. Its shared codec budget
|
||
follows H.264 Level 5.2: 2,073,600 macroblocks per second and a 240 Mbps video
|
||
bitrate ceiling; capture scheduling is separately bounded at 240 fps.
|
||
This admits 1080p240, 1440p144, 5120x1440 at 60 fps and landscape/portrait
|
||
4K60. It does not admit a full 8K picture. Decoder alignment has a
|
||
separate coded-storage bound; reference-picture storage is bounded before
|
||
Native derivation. These are admission limits, not a device performance promise.
|
||
App discovery reports size, pixel-count, frame-rate and bitrate limits through the
|
||
existing native health description. Controls use the intersection with local
|
||
implementation limits; a remote claim cannot raise those limits. Whole-route
|
||
and physical-device acceptance remain separate from available controls.
|
||
Use platform decoder defaults for internal provisioning, rather than turning
|
||
independent axis ceilings into a maximum-square preallocation. Encoded input
|
||
and actual output storage remain bounded before use.
|
||
|
||
Quality observations have independent numeric bounds. A valid capacity estimate
|
||
above the requested send rate remains evidence; invalid optional measurements
|
||
become unavailable. Invalid Native quality samples are discarded without closing
|
||
media control. Required identity, generation and state evidence must still pass
|
||
before a sample can influence route decisions.
|
||
|
||
Framework-driven downscaling under bandwidth or device pressure is valid within
|
||
the selected degradation preference. A low decoded resolution alone is not a
|
||
defect and does not justify a new quality floor. Review avoidable disruption,
|
||
recovery and healthy-child isolation instead of requiring a minimum observed size.
|
||
|
||
Current acceptance targets are:
|
||
|
||
- on a controlled P2P path with RTT at most 40 ms and loss at most 1%, glass-
|
||
to-glass latency p50 at most 150 ms and p95 at most 250 ms; and
|
||
- when the 60 fps profile is selected, no silent run of five seconds below 50
|
||
decoded fps without an explicit adaptation or user-visible limitation.
|
||
|
||
These are targets pending the physical matrices in verification status, not
|
||
claims that every Browser, game, or network already meets them.
|
||
|
||
## Codec Decision
|
||
|
||
The pre-share Browser selector is `VP8 | Auto | H264`, defaults to Auto, and is
|
||
locked while sharing. It is local UI state and is not persisted or carried as a
|
||
room quality setting.
|
||
|
||
Auto uses one bounded actual-sender probe rather than a capability or device
|
||
allowlist. A proved sender prefers H.264 with VP8 fallback; unsupported, failed,
|
||
or inconclusive probes use VP8. Manual VP8 or H264 strictly selects that codec.
|
||
The probe deadline covers setup, negotiation and statistics; cancellation retires
|
||
its resources even when a Browser operation remains pending. The result stays
|
||
fixed for the current share and is reconsidered for a new share. The
|
||
[codec preflight](../../src/client/webrtc/video-codec-preflight.ts) owns probe
|
||
mechanics.
|
||
|
||
Codec selection preserves the negotiated repair stream associated with the
|
||
selected primary codec. Codec restrictions must not strip recovery or disable
|
||
SRTP replay protection.
|
||
|
||
The Browser chooses the concrete encoder implementation. A reported H.264 codec
|
||
does not by itself prove hardware acceleration, and Web content cannot select a
|
||
specific MFT, NVENC, AMF, or QSV implementation.
|
||
|
||
Windows native capture uses the same VP8/Auto/H264 controls. H264 selects the
|
||
hardware path and VP8 the bundled libvpx encoder. Hardware enumeration is only
|
||
a candidate list: startup tries the preferred encoder first, then remaining
|
||
adapter/encoder candidates within the shared selection budget. Manual H264
|
||
requires actual H264 output and never changes codec on failure. The selected
|
||
device owns capture and output workers; its identity is retained as the first
|
||
choice for quality/source replacement. Native relay encoding uses the same
|
||
selection owner. Auto paces synthetic NV12 frames at the selected dimensions and
|
||
frame rate through the live encoder pipeline, including its rate control and frame
|
||
dropper, with the Browser probe's warmup, one-second sample and 100 ms lag
|
||
allowance. Cold-start lag is excluded from the measured window; the selection
|
||
deadline still bounds warmup and hardware input/output waits. A candidate whose
|
||
measured delivery falls outside that allowance is rejected and the next candidate
|
||
is tried within the four-second budget. A measured frame deficit beyond that
|
||
allowance ends the probe immediately: remaining frames cannot change its result.
|
||
Do not start another candidate unless the remaining budget can cover its
|
||
measurement. A successful probe hands the same hardware encoder to live output;
|
||
only its synthetic adaptation history is retired, so selection needs one hardware
|
||
session and does not repeat unproven activation.
|
||
Without a sustaining candidate, Auto starts the ordinary VP8 path directly, as manual VP8 does. A
|
||
faster software encode never replaces a sustaining H264 encoder. Encoder readiness
|
||
uses Media Foundation events rather than timer-based polling.
|
||
Actual encoding and failure reporting remain owned by the capture worker. This
|
||
is a cadence check, not a perceptual-quality score or a promise under future
|
||
GPU load.
|
||
The returned actual codec owns the shared source, preview, and relay; live
|
||
quality/source changes retain it. Other native platform encoders remain H264.
|
||
|
||
## Framework-Owned Adaptation
|
||
|
||
Requested ceilings, committed network allocation and actual encoded output are
|
||
separate facts. Congestion must not turn a temporary reduced output into a new
|
||
requested ceiling. Recovery demand must survive lower-layer selection and reach
|
||
the existing encoder or dormant-output owner without recreating the connection.
|
||
|
||
Native outputs share one source presentation timeline across encoder groups,
|
||
dormancy and capture replacement. Capture and refresh timestamps express elapsed
|
||
source time; encoder completion and pipe arrival do not establish another clock.
|
||
Raw capture time still owns frame admission and cadence. A local refresh uses
|
||
the capture clock; a subsequently published capture update keeps its new pixels
|
||
and advances presentation only as far as the next distinct RTP tick when needed.
|
||
Decoded-source frames retain their original source time.
|
||
Internal RTP copies reuse the original ingress's accepted remote-to-local clock
|
||
mapping. Only that ingress estimates network delay; outgoing sender reports
|
||
project the source timeline onto the media core's local clock at emission.
|
||
|
||
Each Browser direct or relay video sender owns a separate track. The original
|
||
track remains a source and local presentation track; it is never attached directly
|
||
to an outbound sender. Display capture with raw-frame stream support forwards a
|
||
bounded input clone into a generated sender track, without resizing or encoding.
|
||
This prevents encoder feedback from shrinking its own capture recovery input;
|
||
[the Chromium capture lock](../research/browser-local-encoding-pool.md#sustained-h264-recovery)
|
||
owns the evidence. Camera/received tracks and unsupported Browsers retain ordinary
|
||
clones. Capture constraints and capture metadata belong to the input. Its native
|
||
idle refresh is retained through a 1 fps capture constraint; sender adaptation has
|
||
no new FPS or resolution floor. Pause gates the outgoing track. Replacement and
|
||
retirement cancel the frame pipe and stop both owned ends; an unexpected input
|
||
end belongs to the current sending operation, never the shared source or siblings.
|
||
Connection retirement also settles its pending sender and negotiation waits;
|
||
closing a Browser PeerConnection alone does not guarantee that its promises
|
||
settle. Cancellation starts before joining work that depends on it, while a
|
||
replacement still waits for the retired owner's cleanup.
|
||
|
||
Browser and Native encoder-group admission uses current native demand, not the
|
||
previously applied rate. A new or pending join must not displace an existing
|
||
rate owner by raising or retaining its budget against that owner's demand.
|
||
Revalidate pending admission before planning other memberships.
|
||
|
||
Eligible Browser P2P parents use the source-owned pool in
|
||
[ADR-0014](../adr/0014-browser-node-local-encoding-pool.md). Compatible direct
|
||
children share one independent local WebRTC producer; incompatible demands
|
||
remain separate. Joining another producer must fit the child's native allocation;
|
||
a quiet scene's low byte rate does not prove that producer's rate budget fits.
|
||
Pending separation remains necessary while another compatible member needs a
|
||
higher native budget; quiet output alone cannot cancel it. When that demand
|
||
leaves or the child's budget recovers, the current producer can adapt in place.
|
||
Optional reuse also preserves the healthy current output's rate budget and
|
||
observed quality within Host ceilings through recovery-frame commitment, using
|
||
the actual candidate frame and current output rather than preparation alone.
|
||
Rejected membership retains current delivery and its recovery requests.
|
||
A recovery frame already being written retains its owner until completion,
|
||
including across pause/resume; cancellation belongs to the output that knows
|
||
whether writing has started.
|
||
Each outgoing connection keeps native transport, allocation and recovery, with
|
||
a tiny carrier supplying its RTP clock. Producers use the existing native video
|
||
target under Host ceilings. A new producer seeds its
|
||
local WebRTC start rate from that allocation, without a minimum or a change to
|
||
the outgoing connection's estimate. Subsequent budgets use the existing sender
|
||
parameters; initialization does not add a recovery controller. Actual forwarded-frame
|
||
and producer observations remain distinct from the tiny carrier's statistics.
|
||
Producer startup protection begins at actual outgoing publication, excluding
|
||
local warmup and paused frames. The synthetic carrier uses screen-content
|
||
transport probing; the real producer keeps the Host's picture adaptation.
|
||
Capture constraints and the picture's sender FPS ceiling belong to the real
|
||
source and producer, not the producer-driven carrier clock. The carrier
|
||
preserves its frame rate instead of adapting picture cadence a second time.
|
||
The producer retains the Host's degradation preference. Outgoing transport
|
||
bitrate still follows the Host ceiling; ordinary fallback restores its picture
|
||
sender limits. Preparation and applied-budget completion re-evaluate pending
|
||
membership immediately; accepting a recovery frame still commits the handoff.
|
||
The first eligible consumer follows the same path; unsupported APIs or failed
|
||
pooling use ordinary senders. Negotiated codec incompatibility retires only
|
||
that connection's pool membership; healthy siblings keep their producers.
|
||
Prepared ordinary quality candidates remain an independent composition.
|
||
|
||
Each ordinary Browser PeerConnection owns stock WebRTC congestion control and
|
||
sender adaptation. Ordinary clones share one underlying media source and therefore
|
||
do not provide complete simultaneous isolation: framework source-wants aggregation
|
||
may still partially reduce frames available to sibling clones. Sibling outputs may differ;
|
||
Piik does not impose a room-wide minimum. A Browser screen sender toward a peer
|
||
that accepts video layers uses the share-generation codec and selected
|
||
ceilings. Its outputs follow pinned LiveKit screen-share construction: original
|
||
and half size at the same frame rate, with a quarter-bitrate lower ceiling and
|
||
its 150 kbps floor. There is no backup codec or third product preset. Browser
|
||
WebRTC budgets the aggregate connection. Viewport size does not choose a layer,
|
||
because a Viewer may relay its received media.
|
||
|
||
Tracks received from a PeerConnection do not own capture constraints, so Native
|
||
capture keeps source resolution and frame-rate ownership while the sharing page
|
||
previews it.
|
||
|
||
Each Native parent considers only its direct children.
|
||
A Native source with one rendition shares that encoding across its consumers.
|
||
Its encoder budget follows the largest active remote allocation within the source
|
||
ceiling. Local preview alone can use the ceiling, but cannot mask remote demand.
|
||
One shared rendition cannot provide different encoded qualities to its children.
|
||
Recovery-probe traffic is exploration, not a reduction of committed media
|
||
capacity. Allocation and encoder consumers retain the same budget through probe
|
||
settling. A locally rate-controlled output has unmet demand within its current
|
||
layer as well as demand for larger outputs; raw forwarding cannot synthesize it.
|
||
Compatible children reuse an available encoded output; a missing lower output
|
||
starts one shared decode/scale/encode group, while healthy forwarding retains
|
||
the original input without starting a decoder. The group produces the highest
|
||
needed output and its lower fallbacks and stops unused upper outputs. Each child
|
||
receives only its selected output.
|
||
Downstream attachment or sending failure and retirement belong to that edge,
|
||
never its shared video/audio source or healthy siblings.
|
||
Native keyframe requests retain their output scope through coalescing; a relay
|
||
requests its single upstream stream once per batch while keeping local output
|
||
recovery separate.
|
||
Only actual independent output fulfills an encoder recovery request. A delayed
|
||
keyframe leaves the request pending while usable delta frames continue; it does
|
||
not itself fail a healthy output. Initial encoder admission still requires a
|
||
decodable starting point, and real encoding failures retain their existing owner.
|
||
Native relay assembly bounds both packet storage and stalled media progress.
|
||
An incomplete frame must not wait for a memory-sized packet window to fill before
|
||
requesting recovery; quiet input and ordinary reordering remain valid.
|
||
|
||
Native capture uses the same screen-share output construction within Host
|
||
ceilings. Its source, source clock and higher outputs remain independent of
|
||
lowest-output bitrate adaptation. Multiple outputs
|
||
have real encode and upload costs; this is not a one-encode guarantee.
|
||
|
||
Packet identity and delivered counters belong to each outbound edge. Unused
|
||
outputs do not inflate that edge's FPS or bitrate. Bounded codec workers and
|
||
packet queues isolate slow children and retire with the source generation.
|
||
Windows shared local outputs use one complete stock WebRTC encoding/adaptation
|
||
pipeline each, including source restrictions, rate correction and resource
|
||
feedback. Resolution/FPS adaptation keeps the capture and transport identities;
|
||
actual output dimensions update forwarding metadata without resetting sibling
|
||
stream trackers. H264 uses native NV12/MFT and WebRTC's parsed-QP adaptation;
|
||
VP8 uses the library encoder. Windows tunes the stock QP history and sampling
|
||
for brief interruptions and low-frame-rate recovery; codec thresholds and the
|
||
adaptation controller remain WebRTC-owned. Other platform producers retain their
|
||
current fixed-output implementation pending equivalent physical acceptance.
|
||
Android shares one Projection and captured texture across demand-driven
|
||
MediaCodec outputs. Each output uses the pinned WebRTC FrameDropper before
|
||
encoder submission, with encoded-byte feedback and the current allocation;
|
||
each fresh admitted input advances the drop schedule even when a keyframe
|
||
request bypasses dropping. Reusing a retained frame for a refresh does not
|
||
advance the capture cadence. Dropping an output frame never stops the shared
|
||
capture clock. Unsupported
|
||
optional encoders leave the original usable. Its fixed spatial outputs and
|
||
platform codec still bound extremely low-bandwidth delivery.
|
||
Each source groups compatible effective direct-child requests and keeps
|
||
incompatible weak budgets independent. Per-group rates change in place; joining
|
||
another group's output waits for accepted recovery and keeps the existing
|
||
PeerConnection, pacer and bandwidth estimator. Original received media stays
|
||
encoded, while a relay uses one decoder process for its independently activated
|
||
missing outputs. Source-generation retirement rejects old frames before they
|
||
can change attachment. Private physical slots are bounded by admitted consumers,
|
||
not fixed spatial presets, and unused codec workers retire independently.
|
||
This does not establish full Browser parity, hardware-overload acceptance or
|
||
seamless adaptation at extremely low bandwidth.
|
||
|
||
Native sender edges normally reuse the shared encoded source. A Native Viewer
|
||
forwards suitable H.264/VP8 and Opus payload unchanged and derives only a missing
|
||
lower video output; each outbound PeerConnection owns its RTP identity and
|
||
transport feedback.
|
||
|
||
Piik does not maintain an application bitrate/resolution ladder, scene
|
||
detector, periodic quality controller, manual layer selector, or
|
||
application-defined whole-room lowest-common-denominator target.
|
||
|
||
## Screen Audio
|
||
|
||
The Host's playback volume adjusts the share's mixed source sound and optional
|
||
commentary from 0% to 200%, starting at 100% for each share. Browser gain precedes
|
||
outgoing fanout; native gain precedes the shared Opus encoder. Source replacement
|
||
preserves the level, and room voice remains independent. Viewer volume adds only
|
||
local listening gain.
|
||
|
||
Viewer volume starts on native audio output. An explicit setting away from 100%
|
||
switches to a local Web Audio stream source and gain, from silence to 200%
|
||
amplitude; this also avoids iPhone's system-owned `video.volume`. That output
|
||
owns the sound while it runs, follows video pause and user mute, and rebinds
|
||
when the audio track changes. It never modifies the received track or the
|
||
stream relayed downstream, and unmounting closes the graph. Browsers without
|
||
gain support keep 0–100%, and video-only system fullscreen hands sound back to
|
||
the native controls at no more than 100% rather than running two outputs. The
|
||
[Web Audio stream-source and gain nodes](https://www.w3.org/TR/webaudio/) scale
|
||
amplitude, so loud source peaks can clip above 100%.
|
||
|
||
Piik supports mono and stereo Opus content through the existing audio
|
||
track. Mono inputs remain valid; Browser and Native mixing use a stereo output.
|
||
A stereo receive preference or two-channel declaration does not prove distinct
|
||
source channels. [Fidelity evidence](../research/media-fidelity.md#stereo) owns
|
||
decoded-channel checks. Surround delivery is outside the current scope; it needs
|
||
capture, channel-layout, mixing, codec and playback support, not only a channel
|
||
count setting.
|
||
|
||
Display audio uses `contentHint = "music"`. Source audio offers 64/128/192 kbps
|
||
shortcuts and the 128 kbps default, with a custom numeric ceiling in the same
|
||
sound settings. Current Browser/native senders support 6..320 kbps; the numeric
|
||
wire format uses Opus's 6..510 kbps bounds independently of those shortcuts.
|
||
The native 20 ms encoder runs at constant bitrate: an average ceiling alone
|
||
would not bound VBR peaks, and Opus RTP keeps each encoded frame intact.
|
||
A request above the current sender's bitrate ceiling fails that operation
|
||
without retiring native control.
|
||
An audio-only update retains capture, media connections and video startup state.
|
||
|
||
Browser and Native receive answers request Opus stereo and the full Opus
|
||
receive range, including renegotiation. Browser senders enforce a smaller
|
||
negotiated receive limit on their own encoding, falling back to libwebrtc's
|
||
mode-dependent default when no valid limit is declared. An omitted preference
|
||
does not mean unrestricted reception. These receive preferences are independent
|
||
of the offer's receive preferences. The Browser and source still decide whether
|
||
an audio track exists and what is actually delivered.
|
||
|
||
A Native audio-process failure does not end healthy video. A later explicit
|
||
source replacement resumes audio through the existing track and encoder owner;
|
||
it does not trigger an automatic capture retry or change room audio topology.
|
||
|
||
Optional Windows screen-audio exclusion binds one selected process tree to its
|
||
PID and creation time under [ADR-0008](../adr/0008-window-scoped-audio-capture.md).
|
||
The selection lasts for the share, survives source-audio off/on and refresh,
|
||
and is never saved across App runs or rebound by executable name. Changing to a
|
||
window source or explicitly selecting no exclusion clears it. A requested
|
||
exclusion retires previous source audio before replacement preparation; failure
|
||
or target exit leaves source audio silent while healthy video and the Host
|
||
microphone continue. Only an explicit audio/source selection resumes it. Live
|
||
sound controls reuse source replacement and its serialization owner; when the
|
||
video target and capture options are unchanged, update only the audio input.
|
||
Keep the video generation, encoder, media connections and quality evidence.
|
||
A missing
|
||
capability must reject the request, never discard the exclusion.
|
||
|
||
## Observable Truth
|
||
|
||
Requested resolution, frame rate, bitrate, content intent, codec, and audio
|
||
quality are inputs or ceilings. Sender parameter readback and current RTCStats
|
||
are the observable result. Connection detail may show actual path, codec,
|
||
resolution, FPS, bitrate, loss, jitter, RTT, and encode/decode behavior when the
|
||
Browser exposes them; missing or reset counters remain unknown.
|
||
|
||
Browser WebRTC, the Native RTC SDK and accepted encoder policies own media
|
||
adaptation.
|
||
|
||
Web pages cannot guarantee Host background capture, mobile background playback,
|
||
or relay execution after Browser/OS suspension. Those remain physical lifecycle
|
||
boundaries, not keepalive features.
|