Skip to content

Editorial review: Document RTCEncodedAudioFrame.getMetadata() audioLevel return property#40835

Merged
wbamberg merged 2 commits intomdn:mainfrom
chrisdavidmills:RTCEncodedAudioFrame-getMetadata-audioLevel-return-property
Aug 27, 2025
Merged

Editorial review: Document RTCEncodedAudioFrame.getMetadata() audioLevel return property#40835
wbamberg merged 2 commits intomdn:mainfrom
chrisdavidmills:RTCEncodedAudioFrame-getMetadata-audioLevel-return-property

Conversation

@chrisdavidmills
Copy link
Copy Markdown
Contributor

Description

Chrome 139 updates the RTCEncodedAudioFrame.getMetadata() method so that the audioLevel property is available in its return object. See https://chromestatus.com/feature/5206106602995712.

This PR adds content for this new return property.

Motivation

Additional details

Related issues and pull requests

@chrisdavidmills chrisdavidmills requested a review from a team as a code owner August 21, 2025 19:16
@chrisdavidmills chrisdavidmills requested review from wbamberg and removed request for a team August 21, 2025 19:16
@github-actions github-actions bot added Content:WebAPI Web API docs size/xs [PR only] 0-5 LoC changed labels Aug 21, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Aug 21, 2025

Preview URLs

External URLs (3)

URL: /en-US/docs/Web/API/RTCEncodedAudioFrame/getMetadata
Title: RTCEncodedAudioFrame: getMetadata() method

(comment last updated: 2025-08-27 12:12:48)

@chrisdavidmills chrisdavidmills changed the title Document RTCEncodedAudioFrame.getMetadata() audioLevel return property Technical review: Document RTCEncodedAudioFrame.getMetadata() audioLevel return property Aug 21, 2025
Copy link
Copy Markdown

@guidou guidou left a comment

Choose a reason for hiding this comment

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

lgtm

@chrisdavidmills chrisdavidmills changed the title Technical review: Document RTCEncodedAudioFrame.getMetadata() audioLevel return property Editorial review: Document RTCEncodedAudioFrame.getMetadata() audioLevel return property Aug 21, 2025
An object with the following properties:

- `audioLevel`
- : A number representing the audio level of this frame. The value is between 0 and 1 inclusive (linear), where 1 represents 0 dBov, 0 represents silence, and 0.5 represents approximately 6 dBSPL change in the sound pressure level from 0 dBov. The value is converted from the -127 to 0 range specified in [RFC6464](https://www.rfc-editor.org/rfc/rfc6464) via the equation `10^(-rfc_level/20)`. If the RFC6464 header extension is not present in the received packets of the frame, `audioLevel` will be `undefined`.
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 had this comment on the stats PR that exposes audioLevel: #40495 (comment) and think it applies here too.

Is this the same thing as that one? They have slightly different information associated, should it be the same? Should we find a single place to document this, rather than repeating it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It is essentially the same piece of information, except that in this case, it is extracted from the metadata about an individual frame, rather than from statistics related to a stream.

I'd certainly be happy to make the language more consistent with what Hamish wrote; I'm not sure if there is a sensible common place we could document this and link to from both.

Would you rather I linked to Hamish's definition?

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:

  1. ideally, the WebRTC docs might have a single guide page that precisely defines concepts like audio level, that reference pages like this and @hamishwillee 's could link to. This page doesn't exist AFAIK and it's surely out of scope to ask you to add it in this PR.
  2. minimally I think we should consider if we want to explain what things like dBov and dBSPL are, which was my original comment on Hamish's PR.
  3. optionally we should make this language more consistent with the language in the other page.

I don't think linking from one reference page to another on an ad hoc basis is particularly useful. Linking to a single canonical definition ought to be part of a systematic organization of this documentation, which gets us into (1) territory.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That sounds reasonable. I've updated the description to improve consistency and add the same explanatory links as Hamish added. I've kept the extra bit of text I included.

Copy link
Copy Markdown
Collaborator

@wbamberg wbamberg left a comment

Choose a reason for hiding this comment

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

👍 thank you!

@wbamberg wbamberg merged commit 2848073 into mdn:main Aug 27, 2025
8 checks passed
@chrisdavidmills chrisdavidmills deleted the RTCEncodedAudioFrame-getMetadata-audioLevel-return-property branch August 28, 2025 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:WebAPI Web API docs size/xs [PR only] 0-5 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants