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

Commit de7bfb76 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 4801384 from dddee581 to pi-release

Change-Id: I3aa7d182d577ec379d31114947e44f9501a9cc3e
parents ca14c700 dddee581
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -262,6 +262,17 @@ int32_t CryptoHal::setHeapBase(const sp<IMemoryHeap>& heap) {
void CryptoHal::clearHeapBase(int32_t seqNum) {
    Mutex::Autolock autoLock(mLock);

    /*
     * Clear the remote shared memory mapping by setting the shared
     * buffer base to a null hidl_memory.
     *
     * TODO: Add a releaseSharedBuffer method in a future DRM HAL
     * API version to make this explicit.
     */
    uint32_t bufferId = mHeapBases.valueFor(seqNum).getBufferId();
    Return<void> hResult = mPlugin->setSharedBufferBase(hidl_memory(), bufferId);
    ALOGE_IF(!hResult.isOk(), "setSharedBufferBase(): remote call failed");

    mHeapBases.removeItem(seqNum);
}

+1 −2
Original line number Diff line number Diff line
@@ -192,7 +192,6 @@ bool AudioMixer::setChannelMasks(int name,
    // always recompute for both channel masks even if only one has changed.
    const uint32_t trackChannelCount = audio_channel_count_from_out_mask(trackChannelMask);
    const uint32_t mixerChannelCount = audio_channel_count_from_out_mask(mixerChannelMask);
    const bool mixerChannelCountChanged = track->mMixerChannelCount != mixerChannelCount;

    ALOG_ASSERT((trackChannelCount <= MAX_NUM_CHANNELS_TO_DOWNMIX)
            && trackChannelCount
@@ -213,7 +212,7 @@ bool AudioMixer::setChannelMasks(int name,
    // do it after downmix since track format may change!
    track->prepareForReformat();

    if (track->mResampler.get() != nullptr && mixerChannelCountChanged) {
    if (track->mResampler.get() != nullptr) {
        // resampler channels may have changed.
        const uint32_t resetToSampleRate = track->sampleRate;
        track->mResampler.reset(nullptr);
+39 −37
Original line number Diff line number Diff line
@@ -533,41 +533,45 @@ size_t DPFrequency::processFirstStages(ChannelBuffer &cb) {
                fTheta = exp(-1.0 / (fFRelSec * mBlocksPerSecond));
            }


            float fEnv = (1.0 - fTheta) * fEnergySum + fTheta * pMbcBandParams->previousEnvelope;
            //preserve for next iteration
            pMbcBandParams->previousEnvelope = fEnv;

            float fThreshold = dBtoLinear(pMbcBandParams->thresholdDb);
            float fNoiseGateThreshold = dBtoLinear(pMbcBandParams->noiseGateThresholdDb);

            float fNewFactor = 1.0;

            if (fEnv > fThreshold) {
                float fDbAbove = linearToDb(fThreshold / fEnv);
                float fDbTarget = fDbAbove / pMbcBandParams->ratio;
                float fDbChange = fDbAbove - fDbTarget;
                fNewFactor = dBtoLinear(fDbChange);
            } else if (fEnv < fNoiseGateThreshold) {
            if (fEnv < MIN_ENVELOPE) {
                fEnv = MIN_ENVELOPE;
            }
                float fDbBelow = linearToDb(fNoiseGateThreshold / fEnv);
                float fDbTarget = fDbBelow / pMbcBandParams->expanderRatio;
                float fDbChange = fDbBelow - fDbTarget;
                fNewFactor = dBtoLinear(fDbChange);
            }
            const float envDb = linearToDb(fEnv);
            float newLevelDb = envDb;
            //using shorter variables for code clarity
            const float thresholdDb = pMbcBandParams->thresholdDb;
            const float ratio = pMbcBandParams->ratio;
            const float kneeWidthDbHalf = pMbcBandParams->kneeWidthDb / 2;
            const float noiseGateThresholdDb = pMbcBandParams->noiseGateThresholdDb;
            const float expanderRatio = pMbcBandParams->expanderRatio;

            //find segment
            if (envDb > thresholdDb + kneeWidthDbHalf) {
                //compression segment
                newLevelDb = envDb + ((1 / ratio) - 1) * (envDb - thresholdDb);
            } else if (envDb > thresholdDb - kneeWidthDbHalf) {
                //knee-compression segment
                float temp = (envDb - thresholdDb + kneeWidthDbHalf);
                newLevelDb = envDb + ((1 / ratio) - 1) *
                        temp * temp / (kneeWidthDbHalf * 4);
            } else if (envDb < noiseGateThresholdDb) {
                //expander segment
                newLevelDb = noiseGateThresholdDb -
                        expanderRatio * (noiseGateThresholdDb - envDb);
            }

            float newFactor = dBtoLinear(newLevelDb - envDb);

            //apply post gain.
            fNewFactor *= dBtoLinear(pMbcBandParams->gainPostDb);

            if (fNewFactor < 0) {
                fNewFactor = 0;
            }
            newFactor *= dBtoLinear(pMbcBandParams->gainPostDb);

            //apply to this band
            for (size_t k = pMbcBandParams->binStart; k <= pMbcBandParams->binStop; k++) {
                cb.complexTemp[k] *= fNewFactor;
                cb.complexTemp[k] *= newFactor;
            }

        } //end per band process
@@ -604,22 +608,20 @@ size_t DPFrequency::processFirstStages(ChannelBuffer &cb) {
        //preserve for next iteration
        cb.mLimiterParams.previousEnvelope = fEnv;

        float fThreshold = dBtoLinear(cb.mLimiterParams.thresholdDb);
        const float envDb = linearToDb(fEnv);
        float newFactorDb = 0;
        //using shorter variables for code clarity
        const float thresholdDb = cb.mLimiterParams.thresholdDb;
        const float ratio = cb.mLimiterParams.ratio;

        float fNewFactor = 1.0;

        if (fEnv > fThreshold) {
            float fDbAbove = linearToDb(fThreshold / fEnv);
            float fDbTarget = fDbAbove / cb.mLimiterParams.ratio;
            float fDbChange = fDbAbove - fDbTarget;
            fNewFactor = dBtoLinear(fDbChange);
        if (envDb > thresholdDb) {
            //limiter segment
            newFactorDb = ((1 / ratio) - 1) * (envDb - thresholdDb);
        }

        if (fNewFactor < 0) {
            fNewFactor = 0;
        }
        float newFactor = dBtoLinear(newFactorDb);

        cb.mLimiterParams.newFactor = fNewFactor;
        cb.mLimiterParams.newFactor = newFactor;

    } //end Limiter
    return mBlockSize;
+1 −0
Original line number Diff line number Diff line
@@ -197,6 +197,7 @@ AMessage::Item *AMessage::allocateItem(const char *name) {
        CHECK(mNumItems < kMaxNumItems);
        i = mNumItems++;
        item = &mItems[i];
        item->mType = kTypeInt32;
        item->setName(name, len);
    }

+3 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
namespace android {

class DeviceDescriptor;
class DeviceVector;

class SessionRoute : public RefBase
{
@@ -98,7 +99,8 @@ public:
    int decRouteActivity(audio_session_t session);
    bool getAndClearRouteChanged(audio_session_t session); // also clears the changed flag
    void log(const char* caption);

    audio_devices_t getActiveDeviceForStream(audio_stream_type_t streamType,
                                             const DeviceVector& availableDevices);
    // Specify an Output(Sink) route by passing SessionRoute::SOURCE_TYPE_NA in the
    // source argument.
    // Specify an Input(Source) rout by passing SessionRoute::AUDIO_STREAM_DEFAULT
Loading