Skip to content

Commit

Permalink
Spatializer: Assume linear channel count for E-AC3 JOC streams
Browse files Browse the repository at this point in the history
#minor-release

PiperOrigin-RevId: 454884692
  • Loading branch information
christosts authored and marcbaechinger committed Jun 14, 2022
1 parent 1c373d5 commit 6dc4b39
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3678,10 +3678,17 @@ public boolean isEnabled() {
}

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);
}
Expand Down

0 comments on commit 6dc4b39

Please sign in to comment.