decodeQueueSize/encodeQueueSize is not updated on the task where dequeue event is fired
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 1.3k
- Forks
- 194
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 3
Description
The usual pattern is to update a read-only attribute value and synchronously fire the corresponding event.
This is not the case for decoders/encoders, I wonder why. Note this means that the timing where the control messages are run is somehow observable to JS.
Also, now that we execute the error callback synchronously as part of the close encoder/decoder algorithm, the corresponding dequeue event is fired in a task after the error callback execution. This might be a bit surprising to applications.
I wonder whether we could consider something along those lines:
- In case of reset/close with non AbortError, fire the dequeue event synchronously so that it happens just before the error callback execution.
- In case of AbortError reset/closure, do not fire the dequeue event (the app triggered reset/close so does not really need a dequeue event).
- In case of close being called by the web application between the time the dequeue event task is scheduled and the time the task runs, do not fire the dequeue event. The same approach could be useful for reset as well but might require introducing more states.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the WebCodecs encoder and decoder reset, close, and dequeue-event algorithms described by the issue. Trace when queue-size updates, error callbacks, and dequeue tasks are observable to JavaScript, then establish the intended behavior for AbortError and close/reset races. Done means the event timing and state transitions are specified consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, web-dev
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100