Loading media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp +21 −6 Original line number Original line Diff line number Diff line Loading @@ -1946,12 +1946,27 @@ status_t NuPlayer::Renderer::onOpenAudioSink( int32_t numChannels; int32_t numChannels; CHECK(format->findInt32("channel-count", &numChannels)); CHECK(format->findInt32("channel-count", &numChannels)); int32_t rawChannelMask; // channel mask info as read from the audio format audio_channel_mask_t channelMask = int32_t channelMaskFromFormat; format->findInt32("channel-mask", &rawChannelMask) ? // channel mask to use for native playback static_cast<audio_channel_mask_t>(rawChannelMask) audio_channel_mask_t channelMask; // signal to the AudioSink to derive the mask from count. if (format->findInt32("channel-mask", &channelMaskFromFormat)) { : CHANNEL_MASK_USE_CHANNEL_ORDER; // KEY_CHANNEL_MASK follows the android.media.AudioFormat java mask // which is left-bitshifted by 2 relative to the native mask if ((channelMaskFromFormat & 0b11) != 0) { // received an unexpected mask (supposed to follow AudioFormat constants // for output masks with the 2 least-significant bits at 0), but // it may come from an extractor that uses native masks: keeping // the mask as given is ok as it contains at least mono or stereo // and potentially the haptic channels channelMask = static_cast<audio_channel_mask_t>(channelMaskFromFormat); } else { channelMask = static_cast<audio_channel_mask_t>(channelMaskFromFormat >> 2); } } else { // no mask found: the mask will be derived from the channel count channelMask = CHANNEL_MASK_USE_CHANNEL_ORDER; } int32_t sampleRate; int32_t sampleRate; CHECK(format->findInt32("sample-rate", &sampleRate)); CHECK(format->findInt32("sample-rate", &sampleRate)); Loading Loading
media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp +21 −6 Original line number Original line Diff line number Diff line Loading @@ -1946,12 +1946,27 @@ status_t NuPlayer::Renderer::onOpenAudioSink( int32_t numChannels; int32_t numChannels; CHECK(format->findInt32("channel-count", &numChannels)); CHECK(format->findInt32("channel-count", &numChannels)); int32_t rawChannelMask; // channel mask info as read from the audio format audio_channel_mask_t channelMask = int32_t channelMaskFromFormat; format->findInt32("channel-mask", &rawChannelMask) ? // channel mask to use for native playback static_cast<audio_channel_mask_t>(rawChannelMask) audio_channel_mask_t channelMask; // signal to the AudioSink to derive the mask from count. if (format->findInt32("channel-mask", &channelMaskFromFormat)) { : CHANNEL_MASK_USE_CHANNEL_ORDER; // KEY_CHANNEL_MASK follows the android.media.AudioFormat java mask // which is left-bitshifted by 2 relative to the native mask if ((channelMaskFromFormat & 0b11) != 0) { // received an unexpected mask (supposed to follow AudioFormat constants // for output masks with the 2 least-significant bits at 0), but // it may come from an extractor that uses native masks: keeping // the mask as given is ok as it contains at least mono or stereo // and potentially the haptic channels channelMask = static_cast<audio_channel_mask_t>(channelMaskFromFormat); } else { channelMask = static_cast<audio_channel_mask_t>(channelMaskFromFormat >> 2); } } else { // no mask found: the mask will be derived from the channel count channelMask = CHANNEL_MASK_USE_CHANNEL_ORDER; } int32_t sampleRate; int32_t sampleRate; CHECK(format->findInt32("sample-rate", &sampleRate)); CHECK(format->findInt32("sample-rate", &sampleRate)); Loading