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

Skip to content
Commit 623218ee authored by Phil Burk's avatar Phil Burk Committed by Android Build Coastguard Worker
Browse files

aaudio: prevent deadlock when stop() calls disconnect()

Move all calls to send the timestamp into the one timestamp thread.

There was a clear code path that could lead to a deadlock.
If the call to get the timestamp from the HAL returned
an unexpected error code then it would call disconnect().
If that happened below the call to stop() then the
deadlock would occur.

The sequence of calls was AAudioServiceStreamBase::stop()
  which locked mLock,
  then called AAudioServiceStreamBase::stop_l(),
  which called AAudioServiceStreamBase:sendCurrentTimeStamp(),
  which called AAudioServiceStreamMMAP::getFreeRunningPosition(),
  which called disconnect(),
  which locked mLock AGAIN.

It is not clear what would trigger the error return
from the HAL but a routing change may be involved.

The bug was discovered during stress tests and we do not
have a clear repro case.

Bug: 182852602
Bug: 153358911
Test: atest CtsNativeMediaAAudioTestCases
Change-Id: I575f75ece9b459e7412bca293d7338babe76b3a7
Merged-In: I575f75ece9b459e7412bca293d7338babe76b3a7
(cherry picked from commit 45da1b7e)
(cherry picked from commit 9dd928e1)
parent 25dc2a74
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment