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

Commit 96afc16c authored by Preetam Singh Ranawat's avatar Preetam Singh Ranawat Committed by Gerrit - the friendly Code Review server
Browse files

policy_hal: Native DSD concurrency with voice call.

 -Native DSD playback is not supported concurrently with vocie call.

 -Reject offload request for DSD if voice call is in progress.
  Close DSD compress output for incoming voice call.

Change-Id: I5aae69e232db8d12f2492f0774984597ef06b610
parent 2f49a7c7
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -464,6 +464,11 @@ bool AudioPolicyManagerCustom::isOffloadSupported(const audio_offload_info_t& of
         }
    }
#endif
    if (property_get_bool("voice.dsd.playback.conc.disabled", true) &&
        isInCall() &&  (offloadInfo.format == AUDIO_FORMAT_DSD)) {
        ALOGD("blocking DSD compress offload on call mode");
        return false;
    }
#ifdef RECORD_PLAY_CONCURRENCY
    char recConcPropValue[PROPERTY_VALUE_MAX];
    bool prop_rec_play_enabled = false;
@@ -846,6 +851,26 @@ void AudioPolicyManagerCustom::setPhoneState(audio_mode_t state)
    }

#endif

    sp<SwAudioOutputDescriptor> outputDesc = NULL;
    for (size_t i = 0; i < mOutputs.size(); i++) {
        outputDesc = mOutputs.valueAt(i);
        if ((outputDesc == NULL) || (outputDesc->mProfile == NULL)) {
            ALOGD("voice_conc:ouput desc / profile is NULL");
            continue;
        }

        if (property_get_bool("voice.dsd.playback.conc.disabled", true) &&
            (outputDesc->mFlags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) &&
            (outputDesc->mFormat == AUDIO_FORMAT_DSD)) {
            ALOGD("voice_conc:calling closeOutput on call mode for DSD COMPRESS output");
            closeOutput(mOutputs.keyAt(i));
            // call invalidate for music, so that DSD compress will fallback to deep-buffer.
            mpClientInterface->invalidateStream(AUDIO_STREAM_MUSIC);
        }

    }

#ifdef RECORD_PLAY_CONCURRENCY
    char recConcPropValue[PROPERTY_VALUE_MAX];
    bool prop_rec_play_enabled = false;