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

Commit 128aa701 authored by Karthik Reddy Katta's avatar Karthik Reddy Katta Committed by Giulio Cervera
Browse files

frameworks/base: Fix for LPA volume sequence reversal

- LPA volume is sometimes reversed while doing volume Up&DOwn.
- Two different threads are trying to set volume, one by invoking
  setSessionVolume() and other by invoking setStreamVolume().
  But currently only setStreamVolume() is mutex protected. This
  is leading to race condition and volume set second is getting
  applied first.
- Fix is to acquire mutex in setSessionVolume() before setting
  volume.

CRs-Fixed: 360973
Change-Id: I02ac979bf83c4f3589deb5c83ae816179735aa2b
parent 6638822c
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -868,6 +868,8 @@ bool AudioFlinger::masterMute() const
#ifdef WITH_QCOM_LPA
#ifdef WITH_QCOM_LPA
status_t AudioFlinger::setSessionVolume(int stream, float left, float right)
status_t AudioFlinger::setSessionVolume(int stream, float left, float right)
{
{
    AutoMutex lock(mLock);

    mLPALeftVol  = left;
    mLPALeftVol  = left;
    mLPARightVol = right;
    mLPARightVol = right;
    if( (mLPAOutput != NULL) && (mLPAStreamType == stream) ) {
    if( (mLPAOutput != NULL) && (mLPAStreamType == stream) ) {