Skip to content

Commit d3d8f85

Browse files
committed
c2.sec.flac.decoder does not support 32-bit audio on Android 14
fixes 32-bit FLAC playback on Galaxy S23 FE (Snapdragon 8 Gen 1 version)
1 parent 6c5c5f2 commit d3d8f85

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

libraries/exoplayer/src/main/java/androidx/media3/exoplayer/mediacodec/MediaCodecInfo.java

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -382,14 +382,23 @@ private boolean isCodecProfileAndLevelSupported(
382382
}
383383

384384
private boolean isCompressedAudioBitDepthSupported(Format format) {
385-
// MediaCodec doesn't have a way to query FLAC decoder bit-depth support.
386-
// c2.android.flac.decoder is known not to support 32-bit until API 34. We optimistically assume
387-
// that another (unrecognized) FLAC decoder does support 32-bit on all API levels where it
388-
// exists.
389-
return !Objects.equals(format.sampleMimeType, MimeTypes.AUDIO_FLAC)
390-
|| format.pcmEncoding != C.ENCODING_PCM_32BIT
391-
|| SDK_INT >= 34
392-
|| !name.equals("c2.android.flac.decoder");
385+
// MediaCodec doesn't have a way to query decoder bit-depth support.
386+
if (!Objects.equals(format.sampleMimeType, MimeTypes.AUDIO_FLAC)
387+
|| format.pcmEncoding != C.ENCODING_PCM_32BIT) {
388+
// Only 32-bit FLAC is a concern at the moment, everything else can be marked supported.
389+
return true;
390+
}
391+
// c2.android.flac.decoder is known not to support 32-bit until API 34.
392+
if (name.equals("c2.android.flac.decoder")) {
393+
return SDK_INT >= 34;
394+
}
395+
// c2.sec.flac.decoder is known not to support 32-bit until API 35.
396+
if (name.equals("c2.sec.flac.decoder")) {
397+
return SDK_INT >= 35;
398+
}
399+
// We optimistically assume that another (unrecognized) FLAC decoder does support 32-bit on all
400+
// API levels where it exists.
401+
return true;
393402
}
394403

395404
/** Whether the codec handles HDR10+ out-of-band metadata. */

0 commit comments

Comments
 (0)