diff --git a/CLAUDE.md b/CLAUDE.md index b8577c0..fb2bd69 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -72,8 +72,9 @@ Never modify: `~/Documents/Apps/Nacre` (the original Python Nacre, reference onl | `tools/smoke.sh tests/smoke/settings.txt` (+ `SMOKE_SIZE=1280x1100`) | every settings section and sub-page dark and light, search results (`nacre://settings/?search=…`), narrow width; `settings-write.txt` (hidden, `SMOKE_SIZE=1280x1100`, fresh outdir) taps controls with selftest `tap x y`, then check `home/.config/nacre-servo/Default/settings.json` (expected values in its header) | now (S019) | | `SMOKE_SIZE=1280x1600 tools/smoke.sh tests/smoke/sliders.txt` | controls hold still (R1-21): Interface size drag (value label while held, applied on release), Contrast live, Style chip pick; `SMOKE_VISIBLE=1 tools/smoke.sh tests/smoke/sliders-visible.txt` the same plus scrolling for the user's window (~772 px). Selftest `press`/`drag`/`release`, `scroll x y dy`; read the PNGs | now (R1-21) | | `python3 tests/smoke/net/server.py &` + `tools/smoke.sh tests/smoke/net-{privacy,adblock,downloads}.txt` | network pass, offline: secure DNS through a local DoH stub (`*.nacre.test` → 127.0.0.1), HTTPS-only + certificate warning, tracking params, ad blocker with a local list, downloads + download manager stubs; the server's `/log` has requests, DNS names, Range headers, manager calls. `cache-restart.txt` with `SMOKE_HOME=/home`: disk cache. `net-real.txt` needs internet. `@HOME@` in scripts = the throwaway home | now (S007) | -| `tools/smoke.sh tests/smoke/mse.txt` | MSE: MediaSource + one SourceBuffer plays chunk-appended fMP4 and WebM (offline); passes only on a build with the MSE patches (branch `s022-mse-proto`, see docs/engine/mse-spike.md) | S022 prototype | +| `SMOKE_TIMEOUT=400 tools/smoke.sh tests/smoke/mse.txt` + `tests/smoke/mse-leak-check.sh ` | MSE: chunk-appended fMP4, WebM and split A/V play; `mse-spec.html` spec cases (attach/detach, duration, buffered/seekable, remove, removeSourceBuffer, changeType, abort, reopen, sequence, leak); the leak check reads nacre.log (offline). `NACRE_DOM_MEDIA_SOURCE_ENABLED=0 tools/smoke.sh tests/smoke/mse-off.txt`: the switch. Branch `s022-mse-proto` only (docs/engine/mse-spike.md) | S022, S027 | | `tools/gst-mse.sh [test]` | builds Nacre's patched gst_mse library and `mse` plugin (vendor/gst-mse) into `target/gst-mse/` (needed before running a build that uses MSE); `test` also runs the C tests in `tests/gst-mse/` | now (S026, branch s022-mse-proto) | +| `tools/wpt-mse.sh [outdir] [file ...]` | WPT media-source subset (60 files) in a hidden run; first run sparse-clones WPT at a pinned commit into `target/wpt` (needs internet once); prints subtest pass counts, results in `/wpt/results.json`; ~45 min | S027 | | `python tools/icons.py` | rebuilds the icon font subset and `src/ui/icons.rs` from `tools/icons.txt` (needs fontTools and Arch's ttf-material-symbols-variable) | now (S015) | | appimagetool, wine + Inno Setup, VM "Windows 10" | packaging and Windows checks | see the user's global CLAUDE.md "Building" | diff --git a/docs/S027-handoff.md b/docs/S027-handoff.md new file mode 100644 index 0000000..a98a242 --- /dev/null +++ b/docs/S027-handoff.md @@ -0,0 +1,40 @@ +# 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). diff --git a/tests/wpt-mse/testharnessreport.js b/tests/wpt-mse/testharnessreport.js index 9d90740..0f4e856 100644 --- a/tests/wpt-mse/testharnessreport.js +++ b/tests/wpt-mse/testharnessreport.js @@ -1,6 +1,7 @@ // Nacre's WPT report hook (tools/wpt-mse.sh): replaces resources/testharnessreport.js and keeps the results on // window.__wpt for the driver page (tests/wpt-mse/driver.html), which runs each test in an iframe. -setup({ explicit_timeout: true }); +// A test's alert() would block the driver; log it instead. +window.alert = function (message) { console.log('alert: ' + message); }; add_completion_callback(function (tests, status) { window.__wpt = { done: true, diff --git a/tools/wpt-mse.sh b/tools/wpt-mse.sh index 29c63ba..e7c9242 100755 --- a/tools/wpt-mse.sh +++ b/tools/wpt-mse.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # Runs a subset of WPT media-source/ in Nacre and prints pass counts (S027). Offline after the first run. -# - fetches web-platform-tests at $WPT_REV (sparse: media-source, resources, common) into target/wpt once +# - fetches web-platform-tests at $WPT_REV (sparse: media-source, media, resources, common) into target/wpt once # - serves it on 127.0.0.1:$WPT_PORT (tests/wpt-mse/server.py) with our testharnessreport.js # - runs tests/wpt-mse/driver.html in a hidden smoke run (tools/smoke.sh): every test in an iframe, $WPT_TIMEOUT s each # - writes /wpt/results.json and prints per-file and total subtest pass counts @@ -17,9 +17,9 @@ out=${1:-$root/target/smoke/wpt-mse-$(date +%H%M%S)} shift || true mkdir -p "$out/wpt" -if [ ! -d "$wpt/media-source" ]; then - git clone --filter=blob:none --no-checkout https://github.com/web-platform-tests/wpt.git "$wpt" - git -C "$wpt" sparse-checkout set media-source resources common +if [ ! -d "$wpt/media" ]; then + [ -d "$wpt/.git" ] || git clone --filter=blob:none --no-checkout https://github.com/web-platform-tests/wpt.git "$wpt" + git -C "$wpt" sparse-checkout set media-source media resources common git -C "$wpt" fetch --depth 1 origin "$rev" git -C "$wpt" checkout -q "$rev" fi @@ -37,7 +37,7 @@ server=$! trap 'kill $server 2>/dev/null' EXIT rm -f "$out/wpt/results.json" -timeout_each=${WPT_TIMEOUT:-40} +timeout_each=${WPT_TIMEOUT:-75} cat >"$out/wpt/wpt.txt" <