Skip to content

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

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

feat(plugin-meetings): add AV1 codec support and related constants#4816
fnowakow wants to merge 27 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
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
@@ -0,0 +1,58 @@
export const AV1_CODEC_PARAMETERS = {
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.

Does the AV1EncodingParams type from @webex/internal-media-core still expect a profile field? If so, this could be a type error or silent omission downstream. Worth confirming against the 2.23.3 type definitions.

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.

It does not at 2.23.3

export type AV1EncodingParams = BaseVideoEncodingParams & {
  levelIdx?: number;
  tier?: number;
  maxPicSize?: number;
  maxDecodeRate?: number;
};

Comment thread packages/@webex/plugin-meetings/src/meeting/index.ts Outdated
Comment thread packages/@webex/plugin-meetings/src/multistream/codec/constants.ts Outdated
}

describe('getIngressPayloadTypeCallback', () => {
beforeEach(() => {
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.

Either i'm not seeing, or we dont have it yet. Would be great to have unit tests verifying degradation functionality for AV1 and H264. Would be great to assert there specific values, which we expect. It makes reasoning about the changes simpler

Copy link
Copy Markdown
Contributor

@SomeBody16 SomeBody16 Apr 15, 2026

Choose a reason for hiding this comment

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

There are tests for:
re-sends media requests after degradation preferences are set
should not degrade max-fs if receive slot sources are not live
can degrade max-fs once when request exceeds max macroblocks limit
can degrade max-fs multiple times when request exceeds max macroblocks limit
can degrade only the largest max-fs when request exceeds max macroblocks limit
does trimming first and applies degradationPreferences after that


I've added separate tests for checking if degradation also affect av1

@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

tier: 0,
maxWidth: 160,
maxHeight: 90,
maxPicSize: 15_360,
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.

maxPicSze should be 14_400 -> 160 × 90.
Current 15_360 is 160x96

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.

@SomeBody16 SomeBody16 requested a review from k-wasniowski April 17, 2026 08:46
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.

4 participants