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

Enhance the logic for finding a media codec for a media format #109

Conversation

Ma7moudHatem
Copy link
Contributor

Enhance the logic for finding a media codec for a media format, where sometimes the findEncoderForFormat/findDeccoderForFormat or createEncoderByType/createDecoderByType methods will return the first MediaCodec in the available media codecs that could support the media type, but this codec may not be able to configure the media format, so the fix here is to get all available codecs that support the mimeType, and iterate over them to check which codec could configure the media format and return it

…re sometimes the findEncoderForFormat/findDeccoderForFormat or createEncoderByType/createDecoderByType methods will return the first MediaCodec in the available media codecs that could support the media type, but this codec may not be able to configure the media format, so the fix here is to get all available codecs that support the mimeType, and iterate over them to check which codec could configure the media format and return it
if (mediaCodec != null) {
mediaCodec.configure(mediaFormat, surface, null, isEncoder ? MediaCodec.CONFIGURE_FLAG_ENCODE : 0);
@NonNull
private static MediaCodec getAndConfigureCodec(
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename this to createAndConfigureCodec, more accurate to what method does

@izzytwosheds izzytwosheds merged commit d178c31 into linkedin:main Mar 27, 2021
@Ma7moudHatem Ma7moudHatem deleted the enhance-getting-and-configuring-mediacodec branch March 29, 2021 06:28
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