From 7658ac1860853b3c49198d54e1f469a93165c0d2 Mon Sep 17 00:00:00 2001 From: Andy Hung Date: Mon, 29 Aug 2022 20:10:03 -0700 Subject: [PATCH] SoundPool: Fix channel mask reporting Test: atest SoundPoolAacTest and check logcat Bug: 243906444 Merged-In: I5231f989183300a6b2354bbd4bbca991b1e70cb8 Change-Id: I5231f989183300a6b2354bbd4bbca991b1e70cb8 --- media/jni/soundpool/Sound.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/media/jni/soundpool/Sound.cpp b/media/jni/soundpool/Sound.cpp index ac5f35fd1e315..ecc44f483b678 100644 --- a/media/jni/soundpool/Sound.cpp +++ b/media/jni/soundpool/Sound.cpp @@ -181,8 +181,11 @@ static status_t decode(int fd, int64_t offset, int64_t length, format.get(), AMEDIAFORMAT_KEY_CHANNEL_COUNT, channelCount)) { return UNKNOWN_ERROR; } - if (!AMediaFormat_getInt32(format.get(), AMEDIAFORMAT_KEY_CHANNEL_MASK, - (int32_t*) channelMask)) { + int32_t mediaFormatChannelMask; + if (AMediaFormat_getInt32(format.get(), AMEDIAFORMAT_KEY_CHANNEL_MASK, + &mediaFormatChannelMask)) { + *channelMask = audio_channel_mask_from_media_format_mask(mediaFormatChannelMask); + } else { *channelMask = AUDIO_CHANNEL_NONE; } *sizeInBytes = written;