diff --git a/quest/m0/3326-moq-audio-forward-gap-stamps-resampled-output.md b/quest/m0/3326-moq-audio-forward-gap-stamps-resampled-output.md deleted file mode 100644 index 4194bc3f063..00000000000 --- a/quest/m0/3326-moq-audio-forward-gap-stamps-resampled-output.md +++ /dev/null @@ -1,32 +0,0 @@ -# [S] moq-audio: a forward timestamp gap stamps resampled output correctly - -## Goal - -Resampled audio that spans a forward gap in the source timeline is stamped -where its first sample actually belongs. Today a 10 ms packet at `t = 0` -followed by a packet at `t = 1s` produces a chunk stamped near `990 ms` whose -first samples come from `t = 0`, placing that audio almost a second late and, -since `Frame::activity` is picked by the frame's stamp, labelling active audio -as withheld. - -## Plan - -`decode::Consumer::starts_at` derives the chunk's start by subtracting the -samples the resampler still holds from the new packet's timestamp, which -assumes the held samples immediately precede it. A forward gap breaks that -and does not bump the container discontinuity counter, so nothing resets the -state. Only reachable when `decode::Config::sample_rate` differs from the -codec rate, since there is no resampler otherwise. - -Track the source timestamp of the samples fed to the resampler alongside the -samples, so `starts_at` reads the held samples' real origin instead of -deriving it. A gap larger than the resampler's hold then produces two -correctly stamped chunks with a hole between them, which is the shape the -`dev` gap quest for the decode path (#2981) defines for gaps. - -Tests: the 10 ms then 1 s case stamps the first chunk at `0`; contiguous -packets are unchanged; the activity label follows the corrected stamp. - -## Closes - -- [#3326](https://github.com/moq-dev/moq/issues/3326) - close this issue when the quest finishes diff --git a/quest/m0/3360-js-watch-broadcast-is-undefined-at-initialization.md b/quest/m0/3360-js-watch-broadcast-is-undefined-at-initialization.md index 17cf2fe0e9f..8602b010909 100644 --- a/quest/m0/3360-js-watch-broadcast-is-undefined-at-initialization.md +++ b/quest/m0/3360-js-watch-broadcast-is-undefined-at-initialization.md @@ -1,29 +1,42 @@ -# [S] js/watch: MoqWatch.broadcast exists from construction +# [S] js/watch: MoqWatch.broadcast is undefined when a framework binds the element ## Goal -`moqWatch.broadcast` is usable the moment the element exists, as its -declared type `broadcast: Broadcast` promises. On 0.5.2 a framework effect -that reads `moqWatch.broadcast.catalog` right after binding the element hits -`broadcast is undefined`; it worked on 0.3.2. +A framework that binds `` and reads `moqWatch.broadcast` in its +first effect gets the `Broadcast` the type promises, or a documented reason +it cannot yet. On 0.5.2 the read returns `undefined`; it worked on 0.3.2. ## Plan -Either the field is created in the constructor, so it is never undefined, -or the type stops lying. Prefer the first: `connection` and `backend` are -constructed eagerly, and a `Broadcast` whose inputs are signals can exist -before any URL is set, so make `broadcast` the same. If some part of it -genuinely cannot exist before `connectedCallback`, split that part out and -keep the field itself eager. - -The issue's side question is a real gap too: `catalog` is a getter, not a -signal, and `observedAttributes` carries `catalog-format` but not `catalog`, -so a framework cannot react to catalog changes. Expose the catalog as a -`Getter` on the element and document in `doc/lib/js` how to read a custom -catalog section from it. - -Regression: construct the element, read `broadcast.catalog` before connecting -it, and subscribe to the catalog signal across a catalog update. +The obvious fix is already the implementation: `js/watch/src/element.ts` +constructs `this.broadcast = new Broadcast({..})` synchronously in the +constructor, so the field is never undefined on an upgraded element. What the +report shows is therefore a read before upgrade: Svelte's `bind:this` hands +the framework the raw `HTMLElement` as soon as it is in the DOM, and the +constructor only runs once `customElements.define` has registered the tag. If +the definition lands after the framework's first effect (a module-order +difference between 0.3.2 and 0.5.2 would explain the regression), every field +the class sets is absent until the upgrade. + +- Reproduce with the issue's Svelte page and confirm the timing by logging + `customElements.whenDefined("moq-watch")` against the effect. +- Fix whichever side owns it: if the entrypoint defers registration, register + synchronously on import as 0.3.2 did; if the framework simply reads early, + document `await customElements.whenDefined("moq-watch")` in `doc/lib/js` + and make the element's own `connectedCallback` tolerate late upgrade. +- Regression on the ordering itself, not on the upgrade: the browser + upgrades an existing node when the definition is registered, so a test + that waits on `whenDefined` before reading passes either way. Assert + instead that importing the entrypoint has defined `moq-watch` before the + import resolves (`customElements.get("moq-watch")` is set synchronously + after `import "@moq/watch/element"`), so a framework that mounts after the + import can never observe a pre-upgrade node. + +The issue's side question, reacting to catalog changes from a framework, +needs no new API: `broadcast.out.catalog` is already a read-only `Getter`, +which `demo/web` reacts to with `effect.get(watch.broadcast.out.catalog)`. +Document that in `doc/lib/js` as part of this quest, with a custom section +read through it. ## Closes diff --git a/quest/m0/README.md b/quest/m0/README.md index 767e96647de..337b6ecf732 100644 --- a/quest/m0/README.md +++ b/quest/m0/README.md @@ -17,12 +17,11 @@ regression test per Root Cause First. - [#2405](/quest/m0/2405-js-net-connect-logs-on-every-connection-at-the-wrong.md) - js/net: connect logs print the JWT in the relay URL - [#3361](/quest/m0/3361-js-watch-fails-on-firefox-esr.md) - js/watch: `` throws from an effect on Firefox ESR, a regression since 0.3.2 -- [#3360](/quest/m0/3360-js-watch-broadcast-is-undefined-at-initialization.md) - js/watch: `MoqWatch.broadcast` is undefined at construction although its type says otherwise +- [#3360](/quest/m0/3360-js-watch-broadcast-is-undefined-at-initialization.md) - js/watch: a framework binding the element reads `broadcast` before the custom element is upgraded - [#3363](/quest/m0/3363-js-watch-audio-only-stream-does-not-resume.md) - js/watch: an audio-only stream resumes only the first time the publisher unmutes - [#3359](/quest/m0/3359-moq-net-subscribe-error-sends-hardcoded-404.md) - moq-net: SUBSCRIBE_ERROR sends a literal 404 instead of the draft's registered code - [Adapter namespace map](/quest/m0/rs-adapter-namespace-map.md) - moq-net: a duplicate PUBLISH_NAMESPACE on draft-14/15 strands the first request, and the map never shrinks - [#3080](/quest/m0/3080-fix-watch-audio-ring-truncate-can-race-the-worklet-reader.md) - watch: an audio ring truncate can race the worklet reader for one quantum -- [#3326](/quest/m0/3326-moq-audio-forward-gap-stamps-resampled-output.md) - moq-audio: a forward timestamp gap stamps resampled output almost a second late - [#3291](/quest/m0/3291-moq-net-zero-budget-shedding-drops-discontinuity-markers.md) - moq-net (dev): zero-budget shedding drops the empty group that marks a codec reset - [#2833](/quest/m0/2833-moq-export-ts-a-rewound-timeline-stalls-the-si-table.md) - moq export ts: a rewound timeline stalls SI tables, PCR, and pacing until the media clock catches up - [#2799](/quest/m0/2799-moq-video-capture-negotiates-twice-so-a-window-resize.md) - moq-transcode: the ladder follows a source resolution change instead of keeping the one it started with diff --git a/quest/m2/3247-moq-audio-cpal-allocates-on-the-audio-thread.md b/quest/m2/3247-moq-audio-cpal-allocates-on-the-audio-thread.md index c7387e1364e..f9342e05fad 100644 --- a/quest/m2/3247-moq-audio-cpal-allocates-on-the-audio-thread.md +++ b/quest/m2/3247-moq-audio-cpal-allocates-on-the-audio-thread.md @@ -15,10 +15,9 @@ a dropout, exactly when playback is already degraded. allocation-free (atomics and `Thread::unpark`). What remains is upstream and the hand-off: -- Raise it with cpal: allocation-free error emission on the RT paths (a - `&'static str` message, or deferring the `format!` to a non-RT thread), - which is where the dominant allocation lives. Carry the upstream PR as - part of this quest and pin the release that includes it. +- The dominant allocation is upstream; the + [cpal release](/quest/m2/cpal-release.md) gate quest carries that proposal + and the pin bump, and this quest waits on it. - Pre-check in `moq-audio` what can be checked before `stream.play()`, so fewer errors are raised from the render path at all. - Document the residual constraint beside the driver: the callback owns the @@ -29,6 +28,10 @@ Test: an allocation-counting harness around the error callback, the same shape the capture-callback quest used, proving no allocation or free after construction on the paths this repo controls. +## Required + +- [cpal release](/quest/m2/cpal-release.md) - the upstream fix has to ship before the audio thread can be allocation-free + ## Closes - [#3247](https://github.com/moq-dev/moq/issues/3247) - close this issue when the quest finishes diff --git a/quest/m2/README.md b/quest/m2/README.md index 66aa6d3e1f4..5d66c60ef77 100644 --- a/quest/m2/README.md +++ b/quest/m2/README.md @@ -67,6 +67,7 @@ can act on. Each still carries its own plan and regression test. - [Cluster flags](/quest/m2/cluster-flags.md) - a discovery mechanism carries its own prerequisites, so an incomplete cluster config cannot be expressed - [Plan: revalidation updates](/quest/m2/plan-revalidation-updates.md) - settle which fields an auth re-check may update on a live session and which force a reconnect - [#3137](/quest/m2/3137-moqsrc-bound-the-pending-rendition-subscriptions-a.md) - moqsrc: bound the pending rendition subscriptions a catalog can open +- [cpal release](/quest/m2/cpal-release.md) - a cpal release that emits errors from its real-time paths without allocating - [#3247](/quest/m2/3247-moq-audio-cpal-allocates-on-the-audio-thread.md) - moq-audio: cpal allocates and frees on the audio thread when it reports a stream error - [#3115](/quest/m2/3115-moqsink-the-publication-has-no-generation-so-a-flush.md) - moqsink: a flushing restart after EOS opens a new publication generation - [#709](/quest/m2/709-automatic-letsencrypt-support.md) - the relay provisions and renews its own ACME certificate over HTTP-01, persisted on disk diff --git a/quest/m2/cpal-release.md b/quest/m2/cpal-release.md new file mode 100644 index 00000000000..d883d62c011 --- /dev/null +++ b/quest/m2/cpal-release.md @@ -0,0 +1,23 @@ +# [XS] cpal release with allocation-free error emission + +## Goal + +A published cpal release emits stream errors from its real-time paths without +allocating, so `moq-audio` can pin it and stop paying an allocator call on +the audio thread when a device fails. + +## Plan + +Propose the change upstream: a `&'static str` message on the RT emission +paths, or deferring the `format!` in `From` (and the other +hosts' equivalents) to a non-RT thread. Record the maintainers' answer here. +When a release carries it, remove the bullet below, bump the pin, and +complete this quest; that unblocks the dependent one. + +## Required + +- A cpal release that emits errors from its real-time paths without allocating + +## Related + +- [#3247](/quest/m2/3247-moq-audio-cpal-allocates-on-the-audio-thread.md) - the moq-audio work that waits on this release