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

Try input format PCM encoding first in MediaCodecAudioRenderer #2218

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

Conversation

nift4
Copy link

@nift4 nift4 commented Mar 8, 2025

...and remove hard requirement for 16-bit PCM support in the audio sink even if that's not needed to playback.

If the audio file is using 24-bit or 32-bit (int) PCM, MediaCodecAudioRenderer tries to output float, and if that is not supported, falls back to 16-bit PCM. This commit changes this behavior to first trying the media file format, then any close high-resolution audio formats (such as float) and then fall back to 16-bit PCM. The behaviour with DefaultAudioSink does not change, but if an audio sink supports any more optimal formats, they will now be used with MediaCodecAudioRenderer.

@nift4
Copy link
Author

nift4 commented Mar 8, 2025

Sadly forgot to add this to the commit message, but force pushed that into the commit message (I'll stop force pushing now), it's a first step towards #1931

...and remove hard requirement for 16-bit PCM support in the audio
sink even if that's not needed to playback.

If the audio file is using 24-bit or 32-bit (int) PCM,
MediaCodecAudioRenderer tries to output float, and if that is not
supported, falls back to 16-bit PCM. This commit changes this
behavior to first trying the media file format, then any close
high-resolution audio formats (such as float) and then fall back
to 16-bit PCM. The behaviour with DefaultAudioSink does not change,
but if an audio sink supports any more optimal formats, they will
now be used with MediaCodecAudioRenderer.

Issue: androidx#1931
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