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
Showing
- system/bta/Android.bp 5 additions, 5 deletionssystem/bta/Android.bp
- system/bta/include/bta_le_audio_api.h 0 additions, 6 deletionssystem/bta/include/bta_le_audio_api.h
- system/bta/include/bta_le_audio_broadcaster_api.h 0 additions, 4 deletionssystem/bta/include/bta_le_audio_broadcaster_api.h
- system/bta/le_audio/audio_hal_client/audio_hal_client.h 63 additions, 89 deletionssystem/bta/le_audio/audio_hal_client/audio_hal_client.h
- system/bta/le_audio/audio_hal_client/audio_hal_client_test.cc 114 additions, 122 deletions...em/bta/le_audio/audio_hal_client/audio_hal_client_test.cc
- system/bta/le_audio/audio_hal_client/audio_sink_hal_client.cc 343 additions, 0 deletions...em/bta/le_audio/audio_hal_client/audio_sink_hal_client.cc
- system/bta/le_audio/audio_hal_client/audio_source_hal_client.cc 485 additions, 0 deletions.../bta/le_audio/audio_hal_client/audio_source_hal_client.cc
- system/bta/le_audio/broadcaster/broadcaster.cc 32 additions, 52 deletionssystem/bta/le_audio/broadcaster/broadcaster.cc
- system/bta/le_audio/broadcaster/broadcaster_test.cc 45 additions, 39 deletionssystem/bta/le_audio/broadcaster/broadcaster_test.cc
- system/bta/le_audio/broadcaster/broadcaster_types.h 1 addition, 1 deletionsystem/bta/le_audio/broadcaster/broadcaster_types.h
- system/bta/le_audio/client.cc 81 additions, 110 deletionssystem/bta/le_audio/client.cc
- system/bta/le_audio/client_audio.cc 0 additions, 727 deletionssystem/bta/le_audio/client_audio.cc
- system/bta/le_audio/codec_manager.cc 2 additions, 2 deletionssystem/bta/le_audio/codec_manager.cc
- system/bta/le_audio/devices.cc 1 addition, 1 deletionsystem/bta/le_audio/devices.cc
- system/bta/le_audio/devices.h 1 addition, 1 deletionsystem/bta/le_audio/devices.h
- system/bta/le_audio/le_audio_client_test.cc 313 additions, 287 deletionssystem/bta/le_audio/le_audio_client_test.cc
- system/bta/le_audio/le_audio_types.cc 1 addition, 1 deletionsystem/bta/le_audio/le_audio_types.cc
Loading
Please register or sign in to comment