Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make MediaCodecVideoRenderer::shouldUsePlaceholderSurface protected. #1905

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

khouzam
Copy link
Contributor

@khouzam khouzam commented Nov 19, 2024

This enables a derived renderer to disable the placeholder surface.

Not having a placeholder surface allows to delay instantiating the codecs until we have a surface. This allows to have more players ready without having their decoders loaded.

This follows the mode that shouldUseDetachedSurface is protected and overridable by a derived class.

Since getSurfaceForCodec must call hasSurfaceForCodec, the check for the placeholder surface in getSurfaceForCodec should not trigger if we disable the placeholder surface as hasSurfaceForCodec would have returned false.

This enables a derived renderer to disable the placeholder surface.
@microkatz
Copy link
Contributor

microkatz commented Nov 22, 2024

@khouzam

Thanks for submitting your request! Just a curiosity, have you looked at MediaCodecVideoRenderer::shouldInitCodec for your use case? Its already overridable and utilized by MediaCodecRenderer to decide if the decoder should be initialized.

@khouzam
Copy link
Contributor Author

khouzam commented Nov 22, 2024

@microkatz Thanks for the suggestion, I'll experiment with it, but while this can prevent the initialization of the codec, it will still create the PlaceholderSurface when a null surface gets set.

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