Nacre/docs/S027-handoff.md

3.3 KiB

S027 hand-over (MSE DOM to spec) — 2026-11-12

Branch s022-mse-proto, worktree ~/Projects/Nacre-s022 (own target/). Plan: Plans/05 Engine/S027-mse-dom-spec.md (on main).

Done (committed on the branch)

  • DOM rewrite: vendor/servo-script/dom/media/{mediasource,sourcebuffer,sourcebufferlist}.rs. DOM owns spec state; all events queued as media element tasks; attach/detach (htmlmediaelement.rs step 7.3, resource_fetch_algorithm), duration change (element duration from the MediaSource), HTMLMediaElement.buffered/seekable from MediaSource (pure fns + 5 tests in vendor/servo-media-player/mse.rs), activeSourceBuffers from gst active list, removeSourceBuffer, abort, changeType (same container only), sequence mode, live seekable range, endOfStream(error) -> element error steps.
  • Object URLs: per-global map GlobalScope::media_source_urls, revoke removes one task later, cleared on unload.
  • Weak event sink: thread-local id -> WeakRef (MediaSource weakReferenceable). Debug counter: nacre.log "MSE: MediaSource created/freed".
  • Pref: [Func="MediaSource::enabled"] reads NACRE_DOM_MEDIA_SOURCE_ENABLED (D-017 on main explains why not servo-config).
  • isTypeSupported: servo_media_player::mse::is_type_well_formed (registry rules) before gst + decoder check.
  • gst_mse patches 5-9 (vendor/gst-mse, nacre.patch regenerated, docs/engine/gst-mse-patches.md): remove() real, abort() resets parser, reset drops old appsinks (crash), track_feeds keyed by id, appendWindowStart check inverted. C tests tests/gst-mse/mse-fixes.c 5/5 (tools/gst-mse.sh test).
  • Smoke: tests/smoke/mse.txt (+ pages/mse-spec.html, 11 cases) green; tests/smoke/mse-leak-check.sh ok (MS freed in run); tests/smoke/mse-off.txt green with NACRE_DOM_MEDIA_SOURCE_ENABLED=0. Run mse.txt with SMOKE_TIMEOUT=400.
  • WPT runner: tools/wpt-mse.sh (+ tests/wpt-mse/), pinned WPT in target/wpt.

WPT

  • Run 1 (before validator/endOfStream error): 246/407 subtests in 60 files.
  • Run 2 (current build) was running at hand-over; output: /tmp/claude-1000/-home-astar76-Projects-Nacre/9e6752f4-4824-467b-b5b7-80b90b1ca98b/scratchpad/wpt4.out, results /tmp/claude-1000/-home-astar76-Projects-Nacre/9e6752f4-4824-467b-b5b7-80b90b1ca98b/scratchpad/wpt4/wpt/results.json. If gone, rerun: tools/wpt-mse.sh (~45 min). Target in plan: >= 293.

Not done / next steps

  1. Get run-2 count; record in PROGRESS (main). Tick plan box 7 (smoke) and 8 (PROGRESS, INDEX, push) + tracker S027.
  2. Biggest remaining WPT gaps are player integration (S028): loadedmetadata/HAVE_METADATA after init segment only (duration-boundaryconditions 0/13 time out, play/seek tests 0/1), changetype across containers (gst can't, 1/19 x3), errors before init segment, buffered after removeSourceBuffer should throw ([Throws] attr), same TimeRanges object.
  3. Opus/fLaC in mp4 unsupported (gst/decoder), 4 WPT subtests.

Gotchas

  • weakReferenceable structs can't impl Drop (codegen does); counter lives in a LiveCount field.
  • Servo runs no FinalizationRegistry callbacks / WeakRef clearing: leak check must use the log.
  • WPT tests call alert() on 404s: tests/wpt-mse/testharnessreport.js stubs it; WPT media/ dir needed.
  • After abort/changeType the next append must start with an init segment (gst reset forgets it).
  • Negative timestampOffset clamps to 0 (GstClockTime).