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

Commit a4fc9020 authored by Ravi Kumar Alamanda's avatar Ravi Kumar Alamanda Committed by Vineeta Srivastava
Browse files

hal: update handling voice call driving output

For device switch from USB headset to speaker or vice-versa,
it is not required to completely tear down the call and restart
on the new device.

Bug: 17573788
Change-Id: I5ccdc225e19a7036dd8c6a028f69a505c9a3634d
parent 744996b5
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -1340,15 +1340,10 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs)

            if ((adev->mode == AUDIO_MODE_IN_CALL) &&
                    output_drives_call(adev, out)) {

                if (adev->current_call_output != NULL &&
                        adev->current_call_output != out) {
                    voice_stop_call(adev);
                }
                if (!voice_is_in_call(adev)) {
                adev->current_call_output = out;
                if (!voice_is_in_call(adev))
                    ret = voice_start_call(adev);
                } else
                else
                    voice_update_devices_for_all_voice_usecases(adev);
            }
        }
@@ -2125,6 +2120,10 @@ static void adev_close_output_stream(struct audio_hw_device *dev __unused,
        if (out->compr_config.codec != NULL)
            free(out->compr_config.codec);
    }

    if (adev->voice_tx_output == out)
        adev->voice_tx_output = NULL;

    pthread_cond_destroy(&out->cond);
    pthread_mutex_destroy(&out->lock);
    free(stream);
+1 −0
Original line number Diff line number Diff line
@@ -462,6 +462,7 @@ void voice_update_devices_for_all_voice_usecases(struct audio_device *adev)
        if (usecase->type == VOICE_CALL) {
            ALOGV("%s: updating device for usecase:%s", __func__,
                  use_case_table[usecase->id]);
            usecase->stream.out = adev->current_call_output;
            select_devices(adev, usecase->id);
        }
    }