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

Commit 5aa24d2a authored by Vidyakumar Athota's avatar Vidyakumar Athota Committed by Gerrit - the friendly Code Review server
Browse files

audiopolicy: do not update channelMask for voice input source

It's not needed to update the channel mask based on source because
the source is sent to audio HAL through set_parameters() and if source
equal to VOICE_CALL does not mean that two channels need to capture.
If recorder app selects AMR as encoding format but source as RX+TX means
both RX and TX are captured in ONE channel. So use channels set by the app
and use source for the type of capture (RX only, TX only, or RX+TX).

Change-Id: Ic34c9c994713ac9b79da19d61e61ca91dc210ae6
parent 305b52a4
Loading
Loading
Loading
Loading
+12 −26
Original line number Diff line number Diff line
@@ -2106,28 +2106,6 @@ status_t AudioPolicyManager::getInputForAttr(const audio_attributes_t *attr,
    audio_source_t halInputSource;
    AudioMix *policyMix = NULL;

    /*The below code is intentionally not ported.
    It's not needed to update the channel mask based on source because
    the source is sent to audio HAL through set_parameters().
    For example, if source = VOICE_CALL, does not mean we need to capture two channels.
    If the sound recorder app selects AMR as encoding format but source as RX+TX,
    we need both in ONE channel. So we use the channels set by the app and use source
    to tell the driver what needs to captured (RX only, TX only, or RX+TX ).*/
    // adapt channel selection to input source
    /*switch (inputSource) {
    case AUDIO_SOURCE_VOICE_UPLINK:
        channelMask = AUDIO_CHANNEL_IN_VOICE_UPLINK;
        break;
    case AUDIO_SOURCE_VOICE_DOWNLINK:
        channelMask = AUDIO_CHANNEL_IN_VOICE_DNLINK;
        break;
    case AUDIO_SOURCE_VOICE_CALL:
        channelMask = AUDIO_CHANNEL_IN_VOICE_UPLINK | AUDIO_CHANNEL_IN_VOICE_DNLINK;
        break;
    default:
        break;
    }*/

#ifdef VOICE_CONCURRENCY

    char propValue[PROPERTY_VALUE_MAX];
@@ -2182,14 +2160,15 @@ status_t AudioPolicyManager::getInputForAttr(const audio_attributes_t *attr,
                return 0;
            }
        }
    }

#endif

    if (inputSource == AUDIO_SOURCE_DEFAULT) {
        inputSource = AUDIO_SOURCE_MIC;
    }
    halInputSource = inputSource;


#endif
    if (inputSource == AUDIO_SOURCE_REMOTE_SUBMIX &&
            strncmp(attr->tags, "addr=", strlen("addr=")) == 0) {
        device = AUDIO_DEVICE_IN_REMOTE_SUBMIX;
@@ -2229,8 +2208,15 @@ status_t AudioPolicyManager::getInputForAttr(const audio_attributes_t *attr,
        } else {
            *inputType = API_INPUT_LEGACY;
        }
        /*The below code is intentionally not ported.
        It's not needed to update the channel mask based on source because
        the source is sent to audio HAL through set_parameters().
        for example, if source = VOICE_CALL, does not mean we need to capture two channels.
        If the sound recorder app selects AMR as encoding format but source as RX+TX,
        we need both in ONE channel. So we use the channels set by the app and use source
        to tell the driver what needs to captured (RX only, TX only, or RX+TX ).*/
        // adapt channel selection to input source
        switch (inputSource) {
        /*switch (inputSource) {
        case AUDIO_SOURCE_VOICE_UPLINK:
            channelMask = AUDIO_CHANNEL_IN_VOICE_UPLINK;
            break;
@@ -2242,7 +2228,7 @@ status_t AudioPolicyManager::getInputForAttr(const audio_attributes_t *attr,
            break;
        default:
            break;
        }
        }*/
        if (inputSource == AUDIO_SOURCE_HOTWORD) {
            ssize_t index = mSoundTriggerSessions.indexOfKey(session);
            if (index >= 0) {