Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c8b8a98c authored by Andy Hung's avatar Andy Hung Committed by Automerger Merge Worker
Browse files

Merge "NuPlayer: Update code for channel mask conversion refactor" am:...

Merge "NuPlayer: Update code for channel mask conversion refactor" am: a05abbf5 am: 3fbaa20e am: 10571419

Original change: https://android-review.googlesource.com/c/platform/frameworks/av/+/2201774



Change-Id: I70ffda67ae12e5bdbd229aecc447077574cd4d30
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 39577195 10571419
Loading
Loading
Loading
Loading
+3 −13
Original line number Original line Diff line number Diff line
@@ -1947,22 +1947,12 @@ status_t NuPlayer::Renderer::onOpenAudioSink(
    CHECK(format->findInt32("channel-count", &numChannels));
    CHECK(format->findInt32("channel-count", &numChannels));


    // channel mask info as read from the audio format
    // channel mask info as read from the audio format
    int32_t channelMaskFromFormat;
    int32_t mediaFormatChannelMask;
    // channel mask to use for native playback
    // channel mask to use for native playback
    audio_channel_mask_t channelMask;
    audio_channel_mask_t channelMask;
    if (format->findInt32("channel-mask", &channelMaskFromFormat)) {
    if (format->findInt32("channel-mask", &mediaFormatChannelMask)) {
        // KEY_CHANNEL_MASK follows the android.media.AudioFormat java mask
        // KEY_CHANNEL_MASK follows the android.media.AudioFormat java mask
        // which is left-bitshifted by 2 relative to the native mask
        channelMask = audio_channel_mask_from_media_format_mask(mediaFormatChannelMask);
        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 {
    } else {
        // no mask found: the mask will be derived from the channel count
        // no mask found: the mask will be derived from the channel count
        channelMask = CHANNEL_MASK_USE_CHANNEL_ORDER;
        channelMask = CHANNEL_MASK_USE_CHANNEL_ORDER;