Skip to content

media: Run init_cb on init error without render mode - #13066

Merged
yell0wd0g merged 3 commits into
youtube:mainfrom
abhijeetk:init-error-before-rendering-mode
Oct 5, 2026
Merged

yell0wd0g merged 3 commits into
youtube:mainfrom
abhijeetk:init-error-before-rendering-mode

Conversation

@abhijeetk

Copy link
Copy Markdown
Collaborator

StarboardRendererClient completed initialization only after both the
Mojo Initialize() reply and the rendering mode arrived. The GPU side
sends a rendering mode only after it creates a valid SbPlayerBridge,
so an init error before that (SbPlayerCreate() failure, an invalid
output mode, a bypass-bridge init failure, Android overlay failures)
sent no mode. init_cb never ran and pipeline start hung on every
Starboard platform.

Run init_cb immediately on an error status. A successful reply still
waits for the rendering mode.

Add tests for an error with no rendering mode, a late rendering mode
after a failed init, and success-then-mode ordering. Stop injecting a
rendering mode in the existing bypass-bridge failure test, which
masked the hang. Also assert that no rendering mode is sent when
SbPlayerBridge creation fails.

Bug: 568602448

@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor
Context State Description
CI / All Pass ✅ PASS All checks passed
CI / android ✅ PASS Passed
CI / evergreen ✅ PASS Passed
CI / linux ✅ PASS Passed
CI / tvos ✅ PASS Passed
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

🤖 Gemini Suggested Commit Message


media: Handle init errors without rendering mode

StarboardRendererClient waited for both a Mojo initialization reply and
a rendering mode before completing initialization. Because the rendering
mode is only sent after successful SbPlayerBridge creation, any error
occurring before that point, such as an invalid output mode or player
creation failure, caused the initialization callback to never run. This
resulted in the media pipeline hanging on Starboard platforms.

This change ensures that the initialization callback is executed
immediately if an error status is received, rather than waiting for a
rendering mode that will never arrive.

Bug: 568602448

💡 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
@abhijeetk
abhijeetk marked this pull request as ready for review October 2, 2026 09:57
@abhijeetk
abhijeetk requested a review from a team as a code owner October 2, 2026 09:57

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

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.

Code Review

This pull request updates StarboardRendererClient to handle initialization errors immediately without waiting for a rendering mode, and adds comprehensive unit tests for these scenarios. Feedback on the changes highlights a potential dangling pointer issue in StarboardRendererTest.InitializeWithInvalidSbPlayer where a local callback is registered to a member-owned renderer_ that outlives the test method, suggesting a scoped helper to reset the callbacks upon test exit.

@abhijeetk abhijeetk self-assigned this Oct 2, 2026
StarboardRendererClient completed initialization only after both the
Mojo Initialize() reply and the rendering mode arrived. The GPU side
sends a rendering mode only after it creates a valid SbPlayerBridge,
so an init error before that (SbPlayerCreate() failure, an invalid
output mode, a bypass-bridge init failure, Android overlay failures)
sent no mode. init_cb never ran and pipeline start hung on every
Starboard platform.

Run init_cb immediately on an error status. A successful reply still
waits for the rendering mode.

Add tests for an error with no rendering mode, a late rendering mode
after a failed init, and success-then-mode ordering. Stop injecting a
rendering mode in the existing bypass-bridge failure test, which
masked the hang. Also assert that no rendering mode is sent when
SbPlayerBridge creation fails.

Bug: 568602448
The condition is self-explanatory, per review feedback.

Bug: 568602448
@abhijeetk
abhijeetk force-pushed the init-error-before-rendering-mode branch from efd897c to 53ae2fc Compare October 5, 2026 07:08
@abhijeetk
abhijeetk requested a review from jasonzhangxx October 5, 2026 07:11
@abhijeetk

Copy link
Copy Markdown
Collaborator Author
@abhijeetk
abhijeetk requested a review from yell0wd0g October 5, 2026 17:58

@yell0wd0g yell0wd0g left a comment

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.

LGTM! Thanks @abhijeetk !

@yell0wd0g
yell0wd0g merged commit fd27ee6 into youtube:main Oct 5, 2026
519 checks passed
@github-actions github-actions Bot added the cp-27.lts Cherry Pick to the 27.lts branch label Oct 5, 2026
@andrewsavage1 andrewsavage1 removed the cp-27.lts Cherry Pick to the 27.lts branch label Oct 5, 2026
briantting pushed a commit that referenced this pull request Oct 6, 2026
…r mode

Refer to original PR: #13066

StarboardRendererClient completed initialization only after both the
Mojo Initialize() reply and the rendering mode arrived. The GPU side
sends a rendering mode only after it creates a valid SbPlayerBridge,
so an init error before that (SbPlayerCreate() failure, an invalid
output mode, a bypass-bridge init failure, Android overlay failures)
sent no mode. init_cb never ran and pipeline start hung on every
Starboard platform.

Run init_cb immediately on an error status. A successful reply still
waits for the rendering mode.

Add tests for an error with no rendering mode, a late rendering mode
after a failed init, and success-then-mode ordering. Stop injecting a
rendering mode in the existing bypass-bridge failure test, which
masked the hang. Also assert that no rendering mode is sent when
SbPlayerBridge creation fails.

Bug: 568602448

(cherry picked from commit fd27ee6)
briantting pushed a commit that referenced this pull request Oct 16, 2026
…r mode

Refer to original PR: #13066

StarboardRendererClient completed initialization only after both the
Mojo Initialize() reply and the rendering mode arrived. The GPU side
sends a rendering mode only after it creates a valid SbPlayerBridge,
so an init error before that (SbPlayerCreate() failure, an invalid
output mode, a bypass-bridge init failure, Android overlay failures)
sent no mode. init_cb never ran and pipeline start hung on every
Starboard platform.

Run init_cb immediately on an error status. A successful reply still
waits for the rendering mode.

Add tests for an error with no rendering mode, a late rendering mode
after a failed init, and success-then-mode ordering. Stop injecting a
rendering mode in the existing bypass-bridge failure test, which
masked the hang. Also assert that no rendering mode is sent when
SbPlayerBridge creation fails.

Bug: 568602448

(cherry picked from commit fd27ee6)
briantting pushed a commit that referenced this pull request Oct 16, 2026
…r mode

Refer to original PR: #13066

StarboardRendererClient completed initialization only after both the
Mojo Initialize() reply and the rendering mode arrived. The GPU side
sends a rendering mode only after it creates a valid SbPlayerBridge,
so an init error before that (SbPlayerCreate() failure, an invalid
output mode, a bypass-bridge init failure, Android overlay failures)
sent no mode. init_cb never ran and pipeline start hung on every
Starboard platform.

Run init_cb immediately on an error status. A successful reply still
waits for the rendering mode.

Add tests for an error with no rendering mode, a late rendering mode
after a failed init, and success-then-mode ordering. Stop injecting a
rendering mode in the existing bypass-bridge failure test, which
masked the hang. Also assert that no rendering mode is sent when
SbPlayerBridge creation fails.

Bug: 568602448

(cherry picked from commit fd27ee6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

5 participants