Commit Graph
9 Commits
  • refactor(watch): one owner of whether this browser can receive a format
    canReceivePeerWatch took "is hls.js supported" as a parameter, and
    three callers each found that answer for themselves: the page kept it
    in component state, the session probed afresh for every route, and
    HTMLVideoMedia probed twice in one load, once to choose the reader and
    once to choose the player. The answers could differ. watch-media now
    owns the probe: one in flight at a time, its last answer kept, a failed
    one retried by the next caller, and canReceivePeerWatch(format) reads
    it with no parameter. The identical MediaSource checks of the DASH and
    MP4 adapters, and their inverse in track selection, are one
    hasWatchMediaSource beside the worker check.
    
    What changes:
    
    - A player uses one answer for both its byte reader and its decoder,
      so the reader's address can no longer be paired with the other
      player.
    - A stage that mounts again shows what an earlier probe found at once,
      where it showed the hint to use the App or a secure page until its
      own probe returned.
    - A probe that throws in the page is no longer an unhandled rejection.
    
    Kept: a route chosen by hand and a newly arrived grant still try the
    player without waiting for the probe; the codec checks at track
    selection and at playback.
    
    Tests: a failed probe at a join and its retry shared with the stage,
    one decision for each peer player, and each format's outcome with the
    worker and MediaSource present or absent independently.
  • perf(wasm): transfer delivery bytes without JSON expansion
    Return FileDelivery and WatchDelivery effects in their existing order with owned Uint8Array payloads. Serialize only metadata through the original JSON path, retaining its integer semantics. Switch all attachment and watch consumers together, including failures and projection; no Cargo dependency or wire-format change.
    
    Validation: matched release-WASM controls measured 64 KiB Watch at 2.60 to 1.13 ms and 1 MiB File at 27.73 to 3.90 ms median local CPU. Actual Chrome production consumers verified OPFS/Watch hashes and a terminal outcome for a range beyond JS safe integers. The integrated 700 consumer tests and TypeScript passed. Compressed WASM grew 4146 bytes; no remote-throughput claim.
  • fix(delivery): release a runtime whose first projection fails
    Free the constructed WASM delivery before propagating an initial projection
    failure. Subsequent demand still uses the existing retry and lifetime owner.
    The regression fails without the release and passes alongside attachment tests.
  • fix(channel): retry a failed delivery runtime load on the next demand
    FileDelivery and WatchDelivery memoized the promise that loads the WASM
    runtime with `??=` and cleared it only on session reset. A rejected load
    therefore stayed cached for the whole session, and because the data paths
    swallow that rejection, file transfer and forwarded watch bytes stopped
    silently until the page reconnected.
    
    A failed load is not a runtime. Clear the cached promise when it rejects,
    checking that it is still the current one, so the next plan update, read
    or incoming message loads again. This is the rule initializeRuntime in
    room-host.ts already follows.
  • refactor(channel)!: separate connection and delivery lifetimes
    Build shared connections from authorized intent before preparing payloads. Select source paths independently for media, files and webpage bytes, retaining healthy leases through handoff and signaling recovery.
    
    Channel protocol 39 adds the required screen-helper intent projection. App control and persisted formats keep their existing identities.
  • fix(runtime): preserve resource ownership through cancellation
    Retain native pair cleanup through shutdown and cancel microphone acquisition when its last voice consumer leaves. Start webpage read-response deadlines after transmission and retire failed media setup.
    
    Share text-client shutdown completion, provide a small support-bot example, remove the unused input route and duplicate MF guard, and document safe Cargo cache handoff. Validated 413 focused Web tests, type checks, Windows capture compilation and six native lifecycle regressions.
  • feat(watch): forward original media over room peer paths
    Let sharers explicitly provide selected file and HLS resources through the existing reliable room routes. Keep direct viewing independent of peer demand, retain one playback authority, and cancel scoped reads when viewers, sources or routes retire. Domain/App private protocols advance to 20/11; stored room data is unchanged.