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

Commit 7404a73a authored by Krishnankutty Kolathappilly's avatar Krishnankutty Kolathappilly Committed by Steve Kondik
Browse files

libstagefright: Use channel count if channel mask is zero.

-If the channel mask which is part of the meta data is zero use
 a valid channel count to update the channel mask.
-PCM offload playback for wav clips fails for some clips because
 channel mask part of the wave header is zero.

CRs-Fixed: 664374
Change-Id: I1bd5f2cc56fbc1eb9a6e04d219185690d3ce409c
parent 68c8401d
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -133,7 +133,7 @@ status_t AudioPlayer::start(bool sourceAlreadyStarted) {
    success = format->findInt32(kKeySampleRate, &mSampleRate);
    CHECK(success);

    int32_t numChannels, channelMask;
    int32_t numChannels, channelMask = 0;
    success = format->findInt32(kKeyChannelCount, &numChannels);
    CHECK(success);

@@ -142,6 +142,9 @@ status_t AudioPlayer::start(bool sourceAlreadyStarted) {
        ALOGI_IF(numChannels > 2,
                "source format didn't specify channel mask, using (%d) channel order", numChannels);
        channelMask = CHANNEL_MASK_USE_CHANNEL_ORDER;
    } else if (channelMask == 0) {
        channelMask = audio_channel_out_mask_from_count(numChannels);
        ALOGV("channel mask is zero,update from channel count %d", channelMask);
    }

    audio_format_t audioFormat = AUDIO_FORMAT_PCM_16_BIT;
+1 −1
Original line number Diff line number Diff line
@@ -626,7 +626,7 @@ bool canOffloadStream(const sp<MetaData>& meta, bool hasVideo, const sp<MetaData
    info.sample_rate = srate;

    int32_t cmask = 0;
    if (!meta->findInt32(kKeyChannelMask, &cmask)) {
    if (!meta->findInt32(kKeyChannelMask, &cmask) || (cmask == 0)) {
        ALOGV("track of type '%s' does not publish channel mask", mime);

        // Try a channel count instead