Skip to content

feat(plugin-meetings): add AV1 codec support and related constants#4816

Open
fnowakow wants to merge 33 commits intowebex:nextfrom
fnowakow:av1-no-refactor
Open

feat(plugin-meetings): add AV1 codec support and related constants#4816
fnowakow wants to merge 33 commits intowebex:nextfrom
fnowakow:av1-no-refactor

Conversation

@fnowakow
Copy link
Copy Markdown
Contributor

@fnowakow fnowakow commented Mar 27, 2026

COMPLETES SPARK-797573

This pull request addresses

Multistream meetings currently only support H.264 codec for video slides. This PR adds AV1 codec support for video slides in multistream media connections, enabling better compression efficiency and quality at lower bitrates when the AV1 codec is available and negotiated.

by making the following changes

  • New AV1 codec constants: Added codec/constants.ts with resolution-based AV1 encoding parameters (90p through 1080p) including levelIdx, tier, maxWidth, maxHeight, maxPicSize, and maxDecodeRate. Extracted H264 codec defaults into the same constants file.

  • Dynamic ingress payload type resolution: Introduced a getIngressPayloadTypeCallback that queries the active webrtcMediaConnection for the correct payload type per codec/media type at runtime, replacing the previously hardcoded 0x80 H264 payload type.

  • AV1 codec info in media requests: Extended MediaRequestManager to build and include AV1 WcmeCodecInfo entries alongside H264 when enableAv1 is set. AV1 encoding parameters are resolved from the requested frame size by mapping to the appropriate resolution bucket.

  • Configuration and API surface: Added enableAv1SlidesSupport config flag (default false), wired it through Media.createMediaConnection into the multistream connection config, and added _toggleEnableAv1SlidesSupport() on the Meetings class to toggle it before joining.

  • Degradation support: AV1 codec parameters degrade in lockstep with H264 when the macroblock limit is exceeded, ensuring consistent quality reduction across codecs.

  • Test coverage: Comprehensive unit tests for AV1 resolution mapping, codec info generation, degradation behavior with AV1 enabled, payload type callback integration, and the new toggle API.

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Tooling change
  • Internal code refactor

The following scenarios were tested

  • Verified AV1 codec parameters are correctly mapped for all resolution buckets (90p, 180p, 360p, 540p, 720p, 1080p)
  • Verified frame sizes between breakpoints map to the correct next-higher resolution bucket
  • Verified frame sizes exceeding 1080p default to 1080p AV1 parameters
  • Verified AV1 codec info is included in both active-speaker and receiver-selected stream requests when enabled
  • Verified AV1 codec info is not included when enableAv1 is false (default behavior unchanged)
  • Verified AV1 codec info is not included when the AV1 ingress payload type is unavailable (callback returns undefined)
  • Verified degradation correctly adjusts AV1 parameters alongside H264 when macroblock limits are exceeded
  • Verified degradation with mixed resolutions only downgrades the largest streams
  • Verified no degradation occurs when receive slot sources are not live
  • Verified _toggleEnableAv1SlidesSupport correctly updates config and rejects non-boolean values
  • Verified enableAV1SlidesSupport flag is passed through to MultistreamConnectionConfig
  • All existing unit tests continue to pass

The GAI Coding Policy And Copyright Annotation Best Practices

  • GAI was not used (or, no additional notation is required)
  • Code was generated entirely by GAI
  • GAI was used to create a draft that was subsequently customized or modified
  • Coder created a draft manually that was non-substantively modified by GAI (e.g., refactoring was performed by GAI on manually written code)
  • Tool used for AI assistance (GitHub Copilot / Other - specify)
    • Github Copilot
    • Other - Please Specify
  • This PR is related to
    • Feature
    • Defect fix
    • Tech Debt
    • Automation

I certified that

  • I have read and followed contributing guidelines
  • I discussed changes with code owners prior to submitting this pull request
  • I have not skipped any automated checks
  • All existing and new tests passed
  • I have updated the documentation accordingly

Make sure to have followed the contributing guidelines before submitting.

@aws-amplify-us-east-2
Copy link
Copy Markdown

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-4816.d3m3l2kee0btzx.amplifyapp.com

Comment thread packages/@webex/plugin-meetings/src/multistream/mediaRequestManager.ts Outdated
Comment thread packages/@webex/plugin-meetings/src/meeting/index.ts Outdated
@edvujic edvujic added the validated If the pull request is validated for automation. label Apr 1, 2026
Comment thread packages/@webex/plugin-meetings/src/meeting/index.ts Outdated
Comment thread packages/@webex/plugin-meetings/src/meeting/index.ts Outdated
Comment thread packages/@webex/plugin-meetings/src/config.ts Outdated
@edvujic edvujic assigned edvujic and SomeBody16 and unassigned SomeBody16 and edvujic Apr 1, 2026
@SomeBody16 SomeBody16 marked this pull request as ready for review April 8, 2026 07:43
@SomeBody16 SomeBody16 requested review from a team as code owners April 8, 2026 07:43
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e93a35bb71

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/@webex/plugin-meetings/src/meeting/index.ts
Comment thread packages/@webex/plugin-meetings/test/unit/spec/multistream/mediaRequestManager.ts Outdated
Comment thread packages/@webex/plugin-meetings/test/unit/spec/multistream/mediaRequestManager.ts Outdated
Comment thread packages/@webex/plugin-meetings/test/unit/spec/multistream/mediaRequestManager.ts Outdated
Comment thread packages/@webex/plugin-meetings/test/unit/spec/multistream/mediaRequestManager.ts Outdated
Comment thread packages/@webex/plugin-meetings/test/unit/spec/multistream/mediaRequestManager.ts Outdated
Comment thread packages/@webex/plugin-meetings/src/multistream/codec/constants.ts Outdated
Comment thread packages/@webex/plugin-meetings/src/meeting/index.ts Outdated
Comment thread packages/@webex/plugin-meetings/src/multistream/codec/constants.ts Outdated
@k-wasniowski
Copy link
Copy Markdown
Contributor

@codex do the code review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1b0e493fb7

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/@webex/plugin-meetings/src/meeting/index.ts
maxWidth: 1920,
maxHeight: 1080,
maxPicSize: 2_073_600,
maxDecodeRate: 70_778_880,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

maxDecodeRate per AV1 spec for level Idx 8 is 77,856,768.
https://aomediacodec.github.io/av1-spec/#levels

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I fixed all the values

  • for maxPicSize -> calculations of maxWidth * maxHeight so it's more visible what this value represents
  • for maxDecodeRate - updated all values because when creating this I copied values from MaxDisplayRate by mistake

Comment thread packages/@webex/plugin-meetings/src/multistream/codec/constants.ts Outdated
@SomeBody16 SomeBody16 requested a review from k-wasniowski April 17, 2026 08:46
Comment thread packages/@webex/plugin-meetings/src/meeting/index.ts Outdated
Comment thread packages/@webex/plugin-meetings/src/meeting/index.ts Outdated
Comment thread packages/@webex/plugin-meetings/src/config.ts
Comment thread packages/@webex/plugin-meetings/src/multistream/codec/constants.ts Outdated
* @memberof Meetings
* @returns {undefined}
*/
private _toggleEnableAv1SlidesSupport(newValue: boolean) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The JSDoc says this must be called before joinWithMedia(), but nothing enforces it. If a caller toggles after a connection is up, the config silently changes with no effect. Should we log a warn when a multistream connection already exists?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The only use of this method is in web-client when enabling/ disabling feature. Otherwise this method is completely private and internal.

Currently it follows all other feature toggle flow so I don't think that it should have any checks and warnings

Copy link
Copy Markdown
Contributor

@antsukanova antsukanova Apr 21, 2026

Choose a reason for hiding this comment

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

Got you, thanks! but why we are interetsed to have it called only after joinWithMedia?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Small clarification: the doc says before joinWithMedia(), not after.

We read enableAv1SlidesSupport when we create the multistream setup (for example when we build the slide MediaRequestManager) and when we create the media connection. Those paths copy the value once, they don’t watch the config forever. So changing the flag after join doesn’t change the running call; it only changes what we’d use on a later join. That’s why we document “set it before join.”

Comment thread packages/@webex/plugin-meetings/src/meetings/index.ts
return;
}

// @ts-ignore
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why do we need here @ts-ignore?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

current this is Meetings which doesn't have config property so we need @ts-ignore

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see. Just out of curiosity and understanding when this prop will be there, could you clarify?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

config isn’t missing at runtime for normal flows. Meetings extends WebexPlugin, which is implemented in JS and adds config as a getter. That getter returns webex.config.meetings (see webex-plugin.js). Our TS class never declares that property, so TypeScript complains unless we use @ts-ignore or add a type. The prop is there whenever the client has been set up with the usual meetings config.

@edvujic edvujic requested review from SomeBody16 and antsukanova May 4, 2026 10:50
@edvujic edvujic requested a review from marcin-bazyl May 5, 2026 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

validated If the pull request is validated for automation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants