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

Commit 5fb38df6 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Initialize volume level of volume control effect as lowest level." am:...

Merge "Initialize volume level of volume control effect as lowest level." am: 1dc5e7f4 am: b1916324 am: e2303d37

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



Change-Id: Ic640fd331c2b8c9144ec7957171d8ed18f6bc7ac
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents bb1e9a1c e2303d37
Loading
Loading
Loading
Loading
+25 −17
Original line number Diff line number Diff line
@@ -1058,6 +1058,13 @@ status_t AudioFlinger::EffectModule::configure()
                    &size,
                    &cmdStatus);
        }

        if (isVolumeControl()) {
            // Force initializing the volume as 0 for volume control effect for safer ramping
            uint32_t left = 0;
            uint32_t right = 0;
            setVolumeInternal(&left, &right, true /*controller*/);
        }
    }

    // mConfig.outputCfg.buffer.frameCount cannot be zero.
@@ -1431,15 +1438,17 @@ status_t AudioFlinger::EffectModule::setVolume(uint32_t *left, uint32_t *right,
            ((mDescriptor.flags & EFFECT_FLAG_VOLUME_MASK) == EFFECT_FLAG_VOLUME_CTRL ||
             (mDescriptor.flags & EFFECT_FLAG_VOLUME_MASK) == EFFECT_FLAG_VOLUME_IND ||
             (mDescriptor.flags & EFFECT_FLAG_VOLUME_MASK) == EFFECT_FLAG_VOLUME_MONITOR)) {
        uint32_t volume[2];
        uint32_t *pVolume = NULL;
        uint32_t size = sizeof(volume);
        volume[0] = *left;
        volume[1] = *right;
        if (controller) {
            pVolume = volume;
        status = setVolumeInternal(left, right, controller);
    }
    return status;
}
        status = mEffectInterface->command(EFFECT_CMD_SET_VOLUME,

status_t AudioFlinger::EffectModule::setVolumeInternal(
        uint32_t *left, uint32_t *right, bool controller) {
    uint32_t volume[2] = {*left, *right};
    uint32_t *pVolume = controller ? volume : nullptr;
    uint32_t size = sizeof(volume);
    status_t status = mEffectInterface->command(EFFECT_CMD_SET_VOLUME,
                                                size,
                                                volume,
                                                &size,
@@ -1448,7 +1457,6 @@ status_t AudioFlinger::EffectModule::setVolume(uint32_t *left, uint32_t *right,
        *left = volume[0];
        *right = volume[1];
    }
    }
    return status;
}

+2 −0
Original line number Diff line number Diff line
@@ -306,6 +306,8 @@ private:
                ? EFFECT_BUFFER_ACCESS_WRITE : EFFECT_BUFFER_ACCESS_ACCUMULATE;
    }

    status_t setVolumeInternal(uint32_t *left, uint32_t *right, bool controller);


    effect_config_t     mConfig;    // input and output audio configuration
    sp<EffectHalInterface> mEffectInterface; // Effect module HAL