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

Commit bc913d94 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "AudioOutput: Consider output bit width when reusing offload output"

parents 0206741a 59cb6bac
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -1457,6 +1457,7 @@ MediaPlayerService::AudioOutput::AudioOutput(int sessionId, int uid, int pid,
    mSendLevel = 0.0;
    setMinBufferCount();
    mAttributes = attr;
    mBitWidth = 16;
}

MediaPlayerService::AudioOutput::~AudioOutput()
@@ -1665,6 +1666,15 @@ status_t MediaPlayerService::AudioOutput::open(
        } else if (mRecycledTrack->format() != format) {
            reuse = false;
        }

        if (bothOffloaded) {
            if (mBitWidth != offloadInfo->bit_width) {
                ALOGV("output bit width differs %d v/s %d",
                      mBitWidth, offloadInfo->bit_width);
                reuse = false;
            }
        }

    } else {
        ALOGV("no track available to recycle");
    }
@@ -1776,6 +1786,13 @@ status_t MediaPlayerService::AudioOutput::open(
    mSampleRateHz = sampleRate;
    mFlags = flags;
    mMsecsPerFrame = mPlaybackRatePermille / (float) sampleRate;

    if (offloadInfo) {
        mBitWidth = offloadInfo->bit_width;
    } else {
        mBitWidth = 16;
    }

    uint32_t pos;
    if (t->getPosition(&pos) == OK) {
        mBytesWritten = uint64_t(pos) * t->frameSize();
@@ -1828,6 +1845,7 @@ void MediaPlayerService::AudioOutput::switchToNextOutput() {
        mNextOutput->mMsecsPerFrame = mMsecsPerFrame;
        mNextOutput->mBytesWritten = mBytesWritten;
        mNextOutput->mFlags = mFlags;
        mNextOutput->mBitWidth = mBitWidth;
    }
}

+1 −0
Original line number Diff line number Diff line
@@ -150,6 +150,7 @@ class MediaPlayerService : public BnMediaPlayerService
        static bool             mIsOnEmulator;
        static int              mMinBufferCount;  // 12 for emulator; otherwise 4
        audio_output_flags_t    mFlags;
        uint16_t                mBitWidth;

        // CallbackData is what is passed to the AudioTrack as the "user" data.
        // We need to be able to target this to a different Output on the fly,