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

Commit 85e81a1b authored by Vidyakumar Athota's avatar Vidyakumar Athota Committed by Divya Sharma
Browse files

frameworks/av: Fix no audio issue during MT call ring tone

No audio is observed during MT call ring tone playback. This is due to
update of mStreamType flag to AUDIO_STREAM_DEFAULT when attributes are used.
Use streamType flag which is derived from attributes instead of mSteamType
while creating track to avoid createTrack failures.

Change-Id: Ibdb4859f9eb838b7b930e2509de1d98d62e1599d
parent 0d67a9de
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -415,9 +415,13 @@ status_t AudioTrack::set(
        }
    }

    if ((mStreamType == AUDIO_STREAM_VOICE_CALL) &&
    audio_stream_type_t attr_streamType = (mStreamType == AUDIO_STREAM_DEFAULT) ?
                                           audio_attributes_to_stream_type(&mAttributes):
                                           mStreamType;

    if ((attr_streamType == AUDIO_STREAM_VOICE_CALL) &&
        (mChannelCount == 1) &&
        (mSampleRate == 8000 || mSampleRate == 16000)) {
        (sampleRate == 8000 || sampleRate == 16000)) {
        // Allow Voip direct output only if:
        // audio mode is MODE_IN_COMMUNCATION; AND
        // voip output is not opened already; AND
@@ -445,7 +449,7 @@ status_t AudioTrack::set(
        }

        if ((mode == AUDIO_MODE_IN_COMMUNICATION) && (voipOutCount == 0) &&
            ((voipSampleRate == 0) || (voipSampleRate == mSampleRate))) {
            ((voipSampleRate == 0) || (voipSampleRate == sampleRate))) {
            if (audio_is_linear_pcm(format)) {
                char propValue[PROPERTY_VALUE_MAX] = {0};
                property_get("use.voice.path.for.pcm.voip", propValue, "0");
@@ -1301,7 +1305,7 @@ status_t AudioTrack::createTrack_l()
                    AUDIO_FORMAT_PCM_16_BIT : mFormat;
        ALOGV("Create normal PCM 0x%x Track", format);
    }
    sp<IAudioTrack> track = audioFlinger->createTrack(mStreamType,
    sp<IAudioTrack> track = audioFlinger->createTrack(streamType,
                                                      mSampleRate,
                                                      format,
                                                      mChannelMask,