Skip to content

Add resource reclamation section - #282

Merged
chcunningham merged 14 commits into
w3c:mainfrom
tguilbert-google:quota_exceeded
Aug 16, 2021
Merged

chcunningham merged 14 commits into
w3c:mainfrom
tguilbert-google:quota_exceeded

Conversation

@tguilbert-google

@tguilbert-google tguilbert-google commented Jun 16, 2021 •

Copy link
Copy Markdown
Member

This PR fixes #121.

Areas of this PR that should be scrutinized (amongst others):

  • Definition of an inactive codec
  • Definition of a background codec
  • Whether to fire QuotaExceededError, or a new exception/error.

Preview | Diff

Comment thread index.src.html Resolved
Comment thread index.src.html Resolved
Comment thread index.src.html Resolved
Comment thread index.src.html Resolved

@chcunningham chcunningham 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.

Generally looks good. A few simple questions.

Comment thread index.src.html Resolved
Comment thread index.src.html Resolved
Comment thread index.src.html Resolved
Comment thread index.src.html Resolved
Comment thread index.src.html Resolved
Comment thread index.src.html Resolved
Comment thread index.src.html Resolved

@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.

Quite a few comments on this that we need to talk about.

Comment thread index.src.html Resolved
Comment thread index.src.html Resolved
Comment thread index.src.html Outdated
foreground pages.
- Any other heuristics, determined by the User Agent. For example,
heuristics might prioritize reclaiming the oldest codecs, the ones with
the least recent activity, or the least frequent activity.

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 is going to be a web compat nightmare.

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.

In my initial read of this I agreed, but then I re-read the intro and felt better.

A User Agent may only reclaim a codec that is either an inactive codec, a background codec, or both. A User Agent MUST NOT reclaim a codec that is both active and in the foreground, e.g any codec that is neither an inactive codec nor a background codec.

This caused me to read the highlighted sentence as purely informational description (perhaps it should be a note) of the narrow flexibility afforded by the above rule and how UAs might prioritize codecs for reclamation. For instance, the UA may choose to reclaim only one of two inactive codecs if one codec was holding onto a more precious resource than the other. The UA may also choose to reclaim both innactive codecs or neither. But this sentence does not allow the UA to reclaim an active foreground codec.

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 needs to be specced a bit more tightly, #121 (comment) is my latest thinking, transcribed by @chcunningham.

Comment thread index.src.html Resolved

@tguilbert-google tguilbert-google left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I've added restrictions to background reclamations. I think these new ones cover the RTC case @chcunningham mention in this comment

I've removed all language specifying how a User Agent might want to prioritize codecs reclamation within the pool of acceptable codecs.

Comment thread index.src.html Resolved
Comment thread index.src.html Resolved

@chcunningham chcunningham 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.

Gernally looks good. @padenot a few questions for you

Comment thread index.src.html Resolved
Comment thread index.src.html Resolved
Comment thread index.src.html Resolved
Comment thread index.src.html Outdated
- [=Active=] {{AudioDecoder}}s or {{VideoDecoder}}s, if there is
respectively an [=active=] {{AudioEncoder}} or {{VideoEncoder}} in the
same context, to prevent breaking long running transcoding tasks.
- [=Active=] {{AudioDecoder}}s when their respective tabs is actively

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.

@padenot is there some better way to say "tab is actively playing audio". Does WA have this notion?

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.

Not that I know of in terms of spec. That said in Gecko we prefer to use the term "audible", because sometimes we adopt a different behaviour if a page is technically playing audio (i.e. an audio stream is running), but it's been silent for a while.

@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.

Approved with the comments fixed, thanks!

Comment thread index.src.html Resolved
Comment thread index.src.html
received a call to `encode()` or `decode()` in the past `10 seconds`, or has
called its `output()` callback in the past `10 seconds`. An
<dfn lt="inactive codec|inactive">inactive codec</dfn> is any codec that does
not meet the definition of an [=active codec=].

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 is good, but we need to add another condition, when a frame is being encoded: it's well possible that there is 10s between calling encode() and the encoded frame being output. I tested encoding a 1080p file to av1 on my rather powerful Macbook with rav1e, a high quality encoding is > 10s per frame.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I added a special case for VideoEncoder, and added a note.

A concern @chcunningham and I shared was "how do we reclaim stalled VideoEncoders", which is why I went with "making progress in encoding" as the definition for activity

Comment thread index.src.html Outdated
- [=Active=] {{AudioDecoder}}s or {{VideoDecoder}}s, if there is
respectively an [=active=] {{AudioEncoder}} or {{VideoEncoder}} in the
same context, to prevent breaking long running transcoding tasks.
- [=Active=] {{AudioDecoder}}s when their respective tabs is actively

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.

Not that I know of in terms of spec. That said in Gecko we prefer to use the term "audible", because sometimes we adopt a different behaviour if a page is technically playing audio (i.e. an audio stream is running), but it's been silent for a while.

@chcunningham chcunningham 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.

LGTM. Nice work!

@chcunningham
chcunningham merged commit 79a1416 into w3c:main Aug 16, 2021
github-actions Bot added a commit that referenced this pull request Aug 16, 2021
SHA: 79a1416
Reason: push, by @chcunningham

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
github-actions Bot added a commit that referenced this pull request Aug 16, 2021
SHA: 79a1416
Reason: push, by @chcunningham

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
github-actions Bot added a commit that referenced this pull request Aug 16, 2021
SHA: 79a1416
Reason: push, by @chcunningham

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
github-actions Bot added a commit that referenced this pull request Aug 16, 2021
SHA: 79a1416
Reason: push, by @chcunningham

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
github-actions Bot added a commit that referenced this pull request Aug 16, 2021
SHA: 79a1416
Reason: push, by @chcunningham

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
github-actions Bot added a commit that referenced this pull request Aug 16, 2021
SHA: 79a1416
Reason: push, by @chcunningham

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
github-actions Bot added a commit that referenced this pull request Aug 16, 2021
SHA: 79a1416
Reason: push, by @chcunningham

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
github-actions Bot added a commit that referenced this pull request Aug 16, 2021
SHA: 79a1416
Reason: push, by @chcunningham

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
github-actions Bot added a commit that referenced this pull request Aug 16, 2021
SHA: 79a1416
Reason: push, by @chcunningham

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
github-actions Bot added a commit that referenced this pull request Aug 16, 2021
SHA: 79a1416
Reason: push, by @chcunningham

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

Fire QuotaExceeded if codec resources are exhausted/reclaimed

5 participants