Skip to content
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2264,6 +2264,22 @@ public static int getAudioTrackChannelConfig(int channelCount) {
}
case 12:
return AudioFormat.CHANNEL_OUT_7POINT1POINT4;
case 24:
return Util.SDK_INT >= 32
? AudioFormat.CHANNEL_OUT_7POINT1POINT4 |
AudioFormat.CHANNEL_OUT_FRONT_LEFT_OF_CENTER |
AudioFormat.CHANNEL_OUT_FRONT_RIGHT_OF_CENTER |
AudioFormat.CHANNEL_OUT_BACK_CENTER |
AudioFormat.CHANNEL_OUT_TOP_CENTER |
AudioFormat.CHANNEL_OUT_TOP_FRONT_CENTER |
AudioFormat.CHANNEL_OUT_TOP_BACK_CENTER |
AudioFormat.CHANNEL_OUT_TOP_SIDE_LEFT |
AudioFormat.CHANNEL_OUT_TOP_SIDE_RIGHT |
AudioFormat.CHANNEL_OUT_BOTTOM_FRONT_LEFT |
AudioFormat.CHANNEL_OUT_BOTTOM_FRONT_RIGHT |
AudioFormat.CHANNEL_OUT_BOTTOM_FRONT_CENTER |
AudioFormat.CHANNEL_OUT_LOW_FREQUENCY_2
: AudioFormat.CHANNEL_INVALID;
default:
return AudioFormat.CHANNEL_INVALID;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4242,13 +4242,23 @@ 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;
int linearChannelCount;
if (MimeTypes.AUDIO_E_AC3_JOC.equals(format.sampleMimeType)) {
// 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
linearChannelCount = format.channelCount == 16 ? 12 : format.channelCount;
} else if (MimeTypes.AUDIO_AC4.equals(format.sampleMimeType)) {
// For AC-4 level 3 or level 4, the format may be object based. When the channel count is
// 18 (level 3 17.1 OBI) or 21 (level 4 20.1 OBI), it is mapped to 24 linear channels
// (There are some channels used for metadata transfer).
linearChannelCount = (format.channelCount == 18 || format.channelCount == 21)
? 24
: format.channelCount;
} else {
linearChannelCount = format.channelCount;
}

AudioFormat.Builder builder =
new AudioFormat.Builder()
.setEncoding(AudioFormat.ENCODING_PCM_16BIT)
Expand Down
Loading