Skip to content

Cherry pick PR #9309: android: Optimize av1 codec initialization#10030

Open
cobalt-github-releaser-bot wants to merge 1 commit intomainfrom
cherry-pick-main-9309
Open

Cherry pick PR #9309: android: Optimize av1 codec initialization#10030
cobalt-github-releaser-bot wants to merge 1 commit intomainfrom
cherry-pick-main-9309

Conversation

@cobalt-github-releaser-bot
Copy link
Copy Markdown
Collaborator

Refer to the original PR: #9309

Introduce a feature flag to enable optimized AV1 codec initialization.
When enabled, detect if the device supports AV1 only up to 8K30.
If so, defer codec initialization until the video's actual frame rate
is known.

Bug: 486980027

@cobalt-github-releaser-bot
Copy link
Copy Markdown
Collaborator Author

MERGE CONFLICT CAT

Caution

There were merge conflicts while cherry picking! Check out cherry-pick-main-9309 and fix the conflicts before proceeding. Check the log at https://github.com/youtube/cobalt/actions/runs/24421533252 for details.

@github-actions
Copy link
Copy Markdown
Contributor

🤖 Gemini Suggested Commit Message


android: Optimize AV1 codec initialization

Introduce a feature flag, kEnableAv1StartupOptimization, to defer AV1
codec initialization until the video's actual frame rate is known.
This optimization is enabled if the device supports AV1 only up to 8K30.
Deferring initialization prevents accidental 8K60 usage and exceeding
system resource limits on devices with limited AV1 8K capabilities.

Additionally, clear the media capabilities cache when the display or
audio output device changes to ensure accurate capability detection.

Bug: 486980027

💡 Pro Tips for a Better Commit Message:

  1. Influence the Result: Want to change the output? You can write custom prompts or instructions directly in the Pull Request description. The model uses that text to generate the message.
  2. Re-run the Generator: Post a comment with: /generate-commit-message

@jasonzhangxx jasonzhangxx force-pushed the cherry-pick-main-9309 branch from 1d66e32 to 73b6f3b Compare April 14, 2026 21:19
@jasonzhangxx jasonzhangxx marked this pull request as ready for review April 14, 2026 21:21
@jasonzhangxx jasonzhangxx requested a review from kjyoun April 14, 2026 21:21
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces an optimization for AV1 playback on Android devices that support 8K at 30fps but not 60fps. It adds a mechanism in MediaCapabilitiesCache to detect this cap and updates MediaCodecVideoDecoder to delay codec initialization until the video frame rate can be estimated. Feedback focuses on thread safety by recommending std::atomic_bool for shared flags, adhering to Chromium style by marking getter methods as const, and improving map access efficiency in the capabilities loading logic.

@datadog-cobalt-youtube
Copy link
Copy Markdown

datadog-cobalt-youtube bot commented Apr 14, 2026

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: dbf1178 | Docs | Was this helpful? Give us feedback!

Introduce a feature flag to enable optimized AV1 codec initialization.
When enabled, detect if the device supports AV1 only up to 8K30.
If so, defer codec initialization until the video's actual frame rate
is known.

Bug: 486980027
(cherry picked from commit df8841f)
@jasonzhangxx jasonzhangxx force-pushed the cherry-pick-main-9309 branch from 73b6f3b to dbf1178 Compare April 15, 2026 00:03
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.

2 participants