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

Commit f4ae022c authored by Preetam Singh Ranawat's avatar Preetam Singh Ranawat Committed by Shiv Maliyappanahalli
Browse files

hal: Fix incorrect MBDRC volume level for music use case.

 -In concurrent use case of music playback and touch tone,
  MBDRC volume level appiled for music is not correct because
  Music stream was not added to use case list. But volume
  level was not cached as calibration for low latency was set
  successfully.
 -cache MBDRC volume level always and apply it once stream
  is started.

Change-Id: Ib6a7e544149ac0ee29360b5f53be039ab08b1a62
parent 3b465aba
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -454,12 +454,9 @@ bool audio_hw_send_gain_dep_calibration(int level) {
        pthread_mutex_lock(&adev->lock);
        ret_val = platform_send_gain_dep_cal(adev->platform, level);

        // if cal set fails, cache level info
        // if cal set succeds, reset known last cal set
        if (!ret_val)
            last_known_cal_step = level;
        else if (last_known_cal_step != -1)
            last_known_cal_step = -1;
        // cache level info for any of the use case which
        // was not started.
        last_known_cal_step = level;;

        pthread_mutex_unlock(&adev->lock);
    } else {
@@ -3350,6 +3347,7 @@ static ssize_t out_write(struct audio_stream_out *stream, const void *buffer,
        if (last_known_cal_step != -1) {
            ALOGD("%s: retry previous failed cal level set", __func__);
            audio_hw_send_gain_dep_calibration(last_known_cal_step);
            last_known_cal_step = -1;
        }
    }