Spatializer: Assume linear channel count for E-AC3 JOC streams

#minor-release

PiperOrigin-RevId: 454884692
(cherry picked from commit 118d689a08b1097a346f543111ea65deead56459)
This commit is contained in:
christosts 2022-06-14 16:45:16 +00:00 committed by Marc Baechinger
parent 6377f9130d
commit 0d84cf9210

View File

@ -3685,10 +3685,17 @@ public class DefaultTrackSelector extends MappingTrackSelector {
}
public boolean canBeSpatialized(AudioAttributes audioAttributes, Format format) {
// For E-AC3 JOC, the format is object based. When the channel count is 16, this maps to 12
// linear channels and the rest are used for objects. See
// https://github.com/google/ExoPlayer/pull/10322#discussion_r895265881
int linearChannelCount =
MimeTypes.AUDIO_E_AC3_JOC.equals(format.sampleMimeType) && format.channelCount == 16
? 12
: format.channelCount;
AudioFormat.Builder builder =
new AudioFormat.Builder()
.setEncoding(AudioFormat.ENCODING_PCM_16BIT)
.setChannelMask(Util.getAudioTrackChannelConfig(format.channelCount));
.setChannelMask(Util.getAudioTrackChannelConfig(linearChannelCount));
if (format.sampleRate != Format.NO_VALUE) {
builder.setSampleRate(format.sampleRate);
}