Skip to content
Snippets Groups Projects
Commit d3b8e9f2 authored by Jakub Tyszkowski's avatar Jakub Tyszkowski
Browse files

LeAudio: Split HAL clients into source and sink

This splits the client_audio.cc for sink and source files
and moves them into a new subdirectory for better separation
and mantainability. It was also put into the le_audio namespace.

It simplifies class naming - now named from the perspective of
the bluetooth profile role rather than mixing the bluetooth
domain with the framework point of view. This eliminates the
non-intuitive usages like registering LeAudioClientAudioSinkReceiver
in LeAudioClientAudioSource. It could be confusing who is Sink,
who is Source and what the Receiver is. After this change, the
AudioHalClient::LeAudioSourceCallbacks instance is registered
in AudioHalClient::LeAudioSource.

The interface was cleaned up, simplified and the confusing
const void* token has been removed. The object ownership was
redefined. Sink and Source endpoint classes have a static
Acquire() methods which gives the user an ownership of a HAL
session. Since HAL allows a single client for a single direction,
the acquired HAL client instance needs to be released to allow
subsequent Acquire() calls to proceed. The Hal client life cycle
is managed by a smart pointers. Releasing it, releases the HAL
audio session and deallocates the HAL client instance. Previously
the ownership was not clearly defined, which caused situations like
le audio service allocating and releasing it in the production run,
but only releasing it in the unit test runs. But in some test cases
this object was deallocated by the test case itself. This required
special handling to avoid double free or the usage of stack allocated
objects.

Lastly, it improves logs and switches to the new logging mechanism.

Test: atest --host bluetooth_le_audio_test bluetooth_le_audio_client_test bluetooth_test_broadcaster --no-bazel-mode
Bug: 249737696
Tag: #refactor
Change-Id: I41da290d7941b4a1a3001015cb9c15a89f9c3375
parent 33020344
No related branches found
No related tags found
No related merge requests found
Showing
with 1487 additions and 1447 deletions
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