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

Commit 90ac1ea5 authored by Weiyin Jiang's avatar Weiyin Jiang Committed by Gerrit - the friendly Code Review server
Browse files

post_proc: return proper volume in reply data for offload effect

Since EFFECT_FLAG_VOLUME_CTRL flag is set in non offload effect
implementations, EFFECT_CMD_SET_VOLUME should be handled in the same
manner as AOSP effect bundle.

In order for volume control to work, return the received volume in the
reply data.

CRs-Fixed: 2033812
Change-Id: Iee4cd3b80c1470034a208f0c5a014f10042a1ce2
parent e8ebd830
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2015, 2017, The Linux Foundation. All rights reserved.
 * Not a Contribution.
 *
 * Copyright (C) 2013 The Android Open Source Project
@@ -37,7 +37,8 @@ const effect_descriptor_t bassboost_descriptor = {
        {0x0634f220, 0xddd4, 0x11db, 0xa0fc, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b }},
        {0x2c4a8c24, 0x1581, 0x487f, 0x94f6, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}, // uuid
        EFFECT_CONTROL_API_VERSION,
        (EFFECT_FLAG_TYPE_INSERT | EFFECT_FLAG_DEVICE_IND | EFFECT_FLAG_HW_ACC_TUNNEL),
        (EFFECT_FLAG_TYPE_INSERT | EFFECT_FLAG_DEVICE_IND | EFFECT_FLAG_HW_ACC_TUNNEL |
         EFFECT_FLAG_VOLUME_CTRL),
        0, /* TODO */
        1,
        "MSM offload bassboost",
@@ -680,7 +681,8 @@ static int pbe_load_config(struct pbe_params *params)
    char                 propValueStr[PROPERTY_VALUE_MAX];
    void                 *acdb_handle = NULL;
    acdb_get_audio_cal_t acdb_get_audio_cal = NULL;
    acdb_audio_cal_cfg_t cal_cfg = {0};
    acdb_audio_cal_cfg_t cal_cfg;
    memset(&cal_cfg, 0, sizeof(acdb_audio_cal_cfg_t));

    acdb_handle = dlopen(LIB_ACDB_LOADER, RTLD_NOW);
    if (acdb_handle == NULL) {
+19 −9
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
 * Not a Contribution.
 *
 * Copyright (C) 2013 The Android Open Source Project
@@ -899,7 +899,17 @@ int effect_command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSize,
        if (context->ops.set_device)
            context->ops.set_device(context, device);
        } break;
    case EFFECT_CMD_SET_VOLUME:
    case EFFECT_CMD_SET_VOLUME: {
        // if pReplyData is NULL, VOL_CTRL is delegated to another effect
        if (pReplyData == NULL) {
            break;
        }
        if (pCmdData == NULL || cmdSize != 2 * sizeof(uint32_t) ||
                replySize == NULL || *replySize < 2*sizeof(int32_t)) {
            return -EINVAL;
        }
        memcpy(pReplyData, pCmdData, sizeof(int32_t)*2);
        } break;
    case EFFECT_CMD_SET_AUDIO_MODE:
        break;

@@ -995,11 +1005,11 @@ const struct effect_interface_s effect_interface = {

__attribute__ ((visibility ("default")))
audio_effect_library_t AUDIO_EFFECT_LIBRARY_INFO_SYM = {
    tag : AUDIO_EFFECT_LIBRARY_TAG,
    version : EFFECT_LIBRARY_API_VERSION,
    name : "Offload Effects Bundle Library",
    implementor : "The Linux Foundation",
    create_effect : effect_lib_create,
    release_effect : effect_lib_release,
    get_descriptor : effect_lib_get_descriptor,
    .tag            = AUDIO_EFFECT_LIBRARY_TAG,
    .version        = EFFECT_LIBRARY_API_VERSION,
    .name           = "Offload Effects Bundle Library",
    .implementor    = "The Linux Foundation",
    .create_effect  = effect_lib_create,
    .release_effect = effect_lib_release,
    .get_descriptor = effect_lib_get_descriptor,
};
+3 −3
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2014, 2017, The Linux Foundation. All rights reserved.
 * Not a Contribution.
 *
 * Copyright (C) 2013 The Android Open Source Project
@@ -34,7 +34,7 @@ const effect_descriptor_t equalizer_descriptor = {
        {0x0bed4300, 0xddd6, 0x11db, 0x8f34, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}, // type
        {0xa0dac280, 0x401c, 0x11e3, 0x9379, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}, // uuid
        EFFECT_CONTROL_API_VERSION,
        (EFFECT_FLAG_TYPE_INSERT | EFFECT_FLAG_HW_ACC_TUNNEL),
        (EFFECT_FLAG_TYPE_INSERT | EFFECT_FLAG_HW_ACC_TUNNEL | EFFECT_FLAG_VOLUME_CTRL),
        0, /* TODO */
        1,
        "MSM offload equalizer",
@@ -196,7 +196,7 @@ const char * equalizer_get_preset_name(equalizer_context_t *context,
int equalizer_get_num_presets(equalizer_context_t *context)
{
    ALOGV("%s: ctxt %p, presets_num: %d", __func__, context,
           sizeof(equalizer_preset_names)/sizeof(char *));
           (int)(sizeof(equalizer_preset_names)/sizeof(char *)));
    return sizeof(equalizer_preset_names)/sizeof(char *);
}

+7 −5
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013 - 2014, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013 - 2014, 2017, The Linux Foundation. All rights reserved.
 * Not a Contribution.
 *
 * Copyright (C) 2013 The Android Open Source Project
@@ -35,7 +35,7 @@ const effect_descriptor_t aux_env_reverb_descriptor = {
        { 0xc2e5d5f0, 0x94bd, 0x4763, 0x9cac, { 0x4e, 0x23, 0x4d, 0x06, 0x83, 0x9e } },
        { 0x79a18026, 0x18fd, 0x4185, 0x8233, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b } },
        EFFECT_CONTROL_API_VERSION,
        (EFFECT_FLAG_TYPE_AUXILIARY | EFFECT_FLAG_HW_ACC_TUNNEL),
        (EFFECT_FLAG_TYPE_AUXILIARY | EFFECT_FLAG_HW_ACC_TUNNEL | EFFECT_FLAG_VOLUME_CTRL),
        0, /* TODO */
        1,
        "MSM offload Auxiliary Environmental Reverb",
@@ -47,7 +47,8 @@ const effect_descriptor_t ins_env_reverb_descriptor = {
        {0xc2e5d5f0, 0x94bd, 0x4763, 0x9cac, {0x4e, 0x23, 0x4d, 0x06, 0x83, 0x9e}},
        {0xeb64ea04, 0x973b, 0x43d2, 0x8f5e, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}},
        EFFECT_CONTROL_API_VERSION,
        (EFFECT_FLAG_TYPE_INSERT | EFFECT_FLAG_INSERT_FIRST | EFFECT_FLAG_HW_ACC_TUNNEL),
        (EFFECT_FLAG_TYPE_INSERT | EFFECT_FLAG_INSERT_FIRST | EFFECT_FLAG_HW_ACC_TUNNEL |
         EFFECT_FLAG_VOLUME_CTRL),
        0, /* TODO */
        1,
        "MSM offload Insert Environmental Reverb",
@@ -59,7 +60,7 @@ const effect_descriptor_t aux_preset_reverb_descriptor = {
        {0x47382d60, 0xddd8, 0x11db, 0xbf3a, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}},
        {0x6987be09, 0xb142, 0x4b41, 0x9056, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}},
        EFFECT_CONTROL_API_VERSION,
        (EFFECT_FLAG_TYPE_AUXILIARY | EFFECT_FLAG_HW_ACC_TUNNEL),
        (EFFECT_FLAG_TYPE_AUXILIARY | EFFECT_FLAG_HW_ACC_TUNNEL | EFFECT_FLAG_VOLUME_CTRL),
        0, /* TODO */
        1,
        "MSM offload Auxiliary Preset Reverb",
@@ -71,7 +72,8 @@ const effect_descriptor_t ins_preset_reverb_descriptor = {
        {0x47382d60, 0xddd8, 0x11db, 0xbf3a, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}},
        {0xaa2bebf6, 0x47cf, 0x4613, 0x9bca, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}},
        EFFECT_CONTROL_API_VERSION,
        (EFFECT_FLAG_TYPE_INSERT | EFFECT_FLAG_INSERT_FIRST | EFFECT_FLAG_HW_ACC_TUNNEL),
        (EFFECT_FLAG_TYPE_INSERT | EFFECT_FLAG_INSERT_FIRST | EFFECT_FLAG_HW_ACC_TUNNEL |
         EFFECT_FLAG_VOLUME_CTRL),
        0, /* TODO */
        1,
        "MSM offload Insert Preset Reverb",
+3 −2
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2015, 2017, The Linux Foundation. All rights reserved.
 * Not a Contribution.
 *
 * Copyright (C) 2013 The Android Open Source Project
@@ -34,7 +34,8 @@ const effect_descriptor_t virtualizer_descriptor = {
        {0x37cc2c00, 0xdddd, 0x11db, 0x8577, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}},
        {0x509a4498, 0x561a, 0x4bea, 0xb3b1, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}, // uuid
        EFFECT_CONTROL_API_VERSION,
        (EFFECT_FLAG_TYPE_INSERT | EFFECT_FLAG_DEVICE_IND | EFFECT_FLAG_HW_ACC_TUNNEL),
        (EFFECT_FLAG_TYPE_INSERT | EFFECT_FLAG_DEVICE_IND | EFFECT_FLAG_HW_ACC_TUNNEL |
         EFFECT_FLAG_VOLUME_CTRL),
        0, /* TODO */
        1,
        "MSM offload virtualizer",