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

Commit f4fa5dcb authored by Mikhail Naganov's avatar Mikhail Naganov
Browse files

libaudiohal: Make closing of HAL stream an explicit call for AudioFlinger

Since introduction to Treble, closing of the HAL stream has been moved into
`StreamHal*` class destructors. Due to reference counting management of
instances of these classes this approach creates non-determinism about the
moment when the HAL stream is actually get closed. This is undesired
because some resources related to HAL streams are unique, and the audio
framework must be in a full control of the timing of their release.

Added `StreamHalInterface::close` for explicit release of HAL stream
resources. On the AudioFlinger side, this method is now called from the
destructor of `AudioStreamIn|Out` classes since they are the control the
lifetime of the HAL stream from the AudioFlinger POV.

To avoid changing the order of method calls to the HIDL HAL,
`StreamHalHidl::close` also clears callbacks before calling `IStream.close`

Flag: EXEMPT bugfix
Bug: 425272644
Test: atest CtsMediaAudioTestCases CoreAudioHalAidlTest
Test: atest audiorecord_tests trackplayerbase_tests
Change-Id: Ifd002ffeb0f083ff7bd0421f6a50a88e56cd05bc
parent 9368ccc6
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment