Skip to content

Abort pending output callbacks and flushes on reset() - #969

Open
Djuffin wants to merge 1 commit into
w3c:mainfrom
Djuffin:reset
Open

Djuffin wants to merge 1 commit into
w3c:mainfrom
Djuffin:reset

Conversation

@Djuffin

@Djuffin Djuffin commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Add a [[reset generation]] internal slot to AudioDecoder, VideoDecoder, AudioEncoder, and VideoEncoder.
Increment it on reset and verify it before emitting each output and before resolving flush promises.

Fixes #755


Preview | Diff

Add a [[reset generation]] internal slot to AudioDecoder, VideoDecoder, AudioEncoder, and VideoEncoder. Increment it on reset and verify it before emitting each output and before resolving flush promises.

Fixes w3c#755
@Djuffin
Djuffin requested a review from padenot October 8, 2026 22:37

@padenot padenot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some initial comments, I plan to look at this more, I think something is off when doing configure-reset-configure, with some decode in between those.

Comment thread index.src.html
3. Decrement {{AudioDecoder/[[decodeQueueSize]]}} and run the
[=AudioDecoder/Schedule Dequeue Event=] algorithm.
4. Enqueue the following steps to the {{AudioDecoder/[[codec work queue]]}}:
4. Let |resetGeneration| be {{AudioDecoder/[[reset generation]]}}.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this happen when enqueuing? Otherwise the problem isn't really solved is it?

Comment thread index.src.html
2. Remove |promise| from
algorithm with |decoded outputs| and |resetGeneration|.
2. If {{AudioDecoder/[[reset generation]]}} is not equal to
|resetGeneration|, abort these steps.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we simply want to return here.

Comment thread index.src.html
Run these steps:
1. For each |output| in |outputs|:
1. Let |timestamp| and |duration| be the
1. If {{VideoDecoder/[[reset generation]]}} is not equal to

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could use a note to explain why we seemingly check this twice (here and at the call site).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clarify reset() behaviour when multiple things are being output

2 participants