Commit Graph

2374 Commits

Author SHA1 Message Date
Mikhail Naganov
3bb96fe48b Merge "audio: Adjust default impl for non-RT audio behavior of AVD" into main am: 8062a77307
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2836447

Change-Id: I645533b75063f3e80717afa5427262f65289f63a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-27 18:51:26 +00:00
Mikhail Naganov
8062a77307 Merge "audio: Adjust default impl for non-RT audio behavior of AVD" into main 2023-11-27 18:50:48 +00:00
Shunkai Yao
a3c120c31a Merge "Add Headtracking connection mode for Spatializer AIDL" into main am: 17017a2aa4
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2835087

Change-Id: I9103d611f4e116f908744158f832ea95f3e83d52
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-18 01:34:30 +00:00
Mikhail Naganov
6c419352c2 audio: Adjust default impl for non-RT audio behavior of AVD
The default implementation of the primary HAL is intended to
work with the AVD. Current implementation of virtualized audio
I/O on AVD falls behind actual hardware in terms of I/O timing.
This is not tolerated by CTS tests which are tailored for
real hardware.

Make the primary HAL implementation more resilient to irregular
ALSA read/write behavior on AVD by prolonging I/O time, or
skipping operations when falling behind expected time.

Bug: 302132812
Bug: 302587331
Test: atest CtsMediaAudioTestCases
Change-Id: Ia290d9541a8a0e22d28024f7930ef554396d63c6
2023-11-17 13:39:28 -08:00
Shunkai Yao
d5b19ea384 Add Headtracking connection mode for Spatializer AIDL
Bug: 311474218
Test: m android.hardware.audio.effect-update-api
Test: m
Change-Id: I2578cc37f55000d881211048a10256e67aa26532
2023-11-17 04:27:23 +00:00
Treehugger Robot
41d67f2327 Merge "audio: Add a missing include to ModuleConfig.cpp" into main am: 035672eb61
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2825166

Change-Id: I90eaeaa59f12726b035dc001e7e4602a0b74aaa8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-16 20:27:21 +00:00
Treehugger Robot
035672eb61 Merge "audio: Add a missing include to ModuleConfig.cpp" into main 2023-11-16 19:47:54 +00:00
Mikhail Naganov
ba113931bd Merge "audio: Fix remote submix configuration and 'prepareToClose'" into main am: 8a4394f8b8
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2825161

Change-Id: I370c8367226ef33724605f22354f8b3008becd41
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-15 16:45:37 +00:00
Mikhail Naganov
8a4394f8b8 Merge "audio: Fix remote submix configuration and 'prepareToClose'" into main 2023-11-15 16:10:04 +00:00
Andy Hung
9f1b5aceac Merge "frameCountFromDurationUs: Avoid integer overflow" into main am: 4cf75592a3
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2824592

Change-Id: Ide582f21f71dce662bc9d1ad617c47fc183140eb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-15 04:05:40 +00:00
Andy Hung
4cf75592a3 Merge "frameCountFromDurationUs: Avoid integer overflow" into main 2023-11-15 03:31:58 +00:00
Mikhail Naganov
6198ad3883 audio: Add a missing include to ModuleConfig.cpp
This module uses logging, however it did not include
the corresponding header.

Bug: 308706390
Test: build source tree
Change-Id: I1b3b5d8c5118b4f56cb0fe0c2bafd1ff30a6ca41
Merged-In: I1b3b5d8c5118b4f56cb0fe0c2bafd1ff30a6ca41
2023-11-14 01:52:09 +00:00
Shunkai Yao
a1bbe741af Merge "Effect AIDL: add Spatializer aidl in audio effect HAL" into main am: 69bc4e0711
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2486775

Change-Id: I09ae828de8aac51d8a788a73fc25bd96541cdc89
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-13 19:07:26 +00:00
Michael Chan
76f06f2c6a frameCountFromDurationUs: Avoid integer overflow
Change-Id: Ifbeab2724172f0adc113d6f8852a6f8ae7870817
2023-11-13 16:53:36 +11:00
Shunkai Yao
992b009bc5 Effect AIDL: add Spatializer aidl in audio effect HAL
Spatializer is a union representing parameters for audio spatialization effects

Bug: 273373363
Test: Build
Change-Id: I6e8414238256903aeae171c5b7b7a98fe5f96f89
2023-11-10 05:33:58 +00:00
Mikhail Naganov
2ebe3906ad audio: Fix remote submix configuration and 'prepareToClose'
In the configuration, remove "mono" channel masks.
The legacy implementation always used stereo, the framework
handles channel conversion. Otherwise, the input may
be opened with a different channel mask from the output.

In 'prepareToClose', close the output side of the route.
The framework may close the "old" output stream after
it has opened a new one. A call to 'prepareToClose' means
that the framework thread is already shutting down, thus
it is safe to shut down the route.

Bug: 302036943
Test: atest audioeffect_analysis
Change-Id: I95b57807f2559ef681da822b3cab4ea6b4340143
2023-11-09 14:33:37 -08:00
William Escande
e76315b139 Merge "Add defaults for audio AIDL interfaces" into main 2023-11-08 19:06:32 +00:00
feiyuchen
17c0fe507e Add "system" group to Audio HAL
needed for using EdgeTpu.
Due to this code goes to AOSP, please see CL details and test result in b/289097511#comment24.

Bug: 289097511
Change-Id: Ie0969309346cd85b4bb8ac71860a529710c73345
2023-11-08 17:24:21 +00:00
Shunkai Yao
ca63a36695 Merge "Add defaults for audio AIDL interfaces" into aosp-main-future 2023-11-08 01:41:21 +00:00
Bart Van Assche
a0234940b3 audio: VtsHalAudioCoreModuleTargetTest: Convert a SIGSEGV into an assertion failure
Convert the following segmentation fault into an assertion failure:

 signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0000000000000000
 Cause: null pointer dereference
 9 total frames
 backtrace:
       #00 pc 000000000020e532  /data/local/tmp/VtsHalAudioCoreTargetTest/x86_64/VtsHalAudioCoreTargetTest (AudioCoreModuleBase::TearDownImpl()+114) (BuildId: f1bb3c414cf012ccd7d268b4e0c7fefe)
       #01 pc 00000000001c890a  /data/local/tmp/VtsHalAudioCoreTargetTest/x86_64/VtsHalAudioCoreTargetTest (AudioCoreModule::TearDown()+106) (BuildId: f1bb3c414cf012ccd7d268b4e0c7fefe)
       #02 pc 00000000002b62a8  /data/local/tmp/VtsHalAudioCoreTargetTest/x86_64/VtsHalAudioCoreTargetTest (testing::TestInfo::Run()+424) (BuildId: f1bb3c414cf012ccd7d268b4e0c7fefe)
       #03 pc 00000000002b6de4  /data/local/tmp/VtsHalAudioCoreTargetTest/x86_64/VtsHalAudioCoreTargetTest (testing::TestSuite::Run()+804) (BuildId: f1bb3c414cf012ccd7d268b4e0c7fefe)
       #04 pc 00000000002c5c7e  /data/local/tmp/VtsHalAudioCoreTargetTest/x86_64/VtsHalAudioCoreTargetTest (testing::internal::UnitTestImpl::RunAllTests()+2622) (BuildId: f1bb3c414cf012ccd7d268b4e0c7fefe)
       #05 pc 00000000002c50cc  /data/local/tmp/VtsHalAudioCoreTargetTest/x86_64/VtsHalAudioCoreTargetTest (testing::UnitTest::Run()+140) (BuildId: f1bb3c414cf012ccd7d268b4e0c7fefe)
       #06 pc 00000000001c86f0  /data/local/tmp/VtsHalAudioCoreTargetTest/x86_64/VtsHalAudioCoreTargetTest (RUN_ALL_TESTS()+16) (BuildId: f1bb3c414cf012ccd7d268b4e0c7fefe)
       #07 pc 00000000001c8669  /data/local/tmp/VtsHalAudioCoreTargetTest/x86_64/VtsHalAudioCoreTargetTest (main+137) (BuildId: f1bb3c414cf012ccd7d268b4e0c7fefe)
       #08 pc 00000000000547e9  /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+89) (BuildId: e5ef3cc48c1e014ffb7dbbcfc7f9d475)

Bug: 308687042
Change-Id: I2d528dd9cf0f59bcd6b0e485b4f6141320d89a81
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-11-07 13:12:35 -08:00
Shunkai Yao
95732c6cb9 Add defaults for audio AIDL interfaces
- with defaults user don't have to change their Android.bp when there is
  a update
- update AIDL audio interfaces with android.media.audio.common.types
- update Spatialization and HeadTracking AIDL usage

Bug: 273373363
Bug: 293370815
Test: m
Test: lunch panther-trunk_staging-userdebug; m; test Bluetooth Audio
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:1977a4a664cc71e1d9841a01573b63793f88ae59)
Merged-In: Ic9d8afc1d4e19e4243c66065b0a5d29156632851
Change-Id: Ic9d8afc1d4e19e4243c66065b0a5d29156632851
2023-11-07 18:18:24 +00:00
Bart Van Assche
0fde783476 audio: AudioHalBinderServiceUtil: Make a log message more informative
If a timeout happens, report the name of the service for which the
timeout happens.

Change-Id: Iad0076071f06f0ca5e53e07b1ef97e25e7bae887
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-11-06 16:14:15 -08:00
Bart Van Assche
17b3201259 audio: Change mDeathHandler from a member into a local variable
Since no data is retained in mDeathHandler across member function calls,
it should be a local variable instead of a member variable.

Change-Id: I58d6cc511a21e0e7f430b3cf528faba072e02ec7
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-11-06 16:01:16 -08:00
Bart Van Assche
a76d4d8899 audio: Simplify AudioHalBinderServiceUtil::waitForFired()
Return the std::condition::wait_for() return value instead of reading
the variable 'fired' again. See also
https://en.cppreference.com/w/cpp/thread/condition_variable/wait_for.

Change-Id: I48c270f5446f61b2ad828b19a1fc294737a123dd
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-11-06 16:01:16 -08:00
Shunkai Yao
195d3d6915 Add defaults for audio AIDL interfaces
- with defaults user don't have to change their Android.bp when there is
  a update
- update AIDL audio interfaces with android.media.audio.common.types
- update Spatialization and HeadTracking AIDL usage

Bug: 273373363
Bug: 293370815
Test: m
Test: lunch panther-trunk_staging-userdebug; m; test Bluetooth Audio
Change-Id: Ic9d8afc1d4e19e4243c66065b0a5d29156632851
Merged-In: Ic9d8afc1d4e19e4243c66065b0a5d29156632851
2023-11-06 19:14:32 +00:00
Mikhail Naganov
3143e6930b Merge changes Ic51d603d,Ia50def0d,I22f65b8b,I8ce9f230,Id8455eb1, ... into main
* changes:
  audio: Query minimum buffer size before opening streams
  audio: Implement getters for hardware mixer controls
  audio: Clean up and fix the bluetooth HAL module
  audio: Provide a way for Module to specify nominal latency
  audio: Fix default remote submix HAL implementation and VTS
  CSD: Add default AIDL HAL implementation
2023-11-06 17:01:00 +00:00
Mikhail Naganov
95f2277730 audio: Query minimum buffer size before opening streams
The proper way to obtain the minimum buffer size when
opening a stream is to retrieve it from the patch. Thus,
a patch must be established prior to opening a stream.
This step was often skipped by VTS tests, they were
providing a fixed stream buffer size which might not
work for all HAL module implementations.

Created a helper class `StreamFixture` which handles
all necessary steps for opening a stream. Overhauled
tests to use this class.

Also, remove special treatment of remote submix devices
by ModuleConfig.

Bug: 300735639
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ic51d603d2bb8ff0fd62434bd16fc02c51326fc42
2023-11-03 14:11:09 -07:00
Mikhail Naganov
49bcb92670 audio: Implement getters for hardware mixer controls
The VTS test for volume accessors first determines whether
the accessor is supported by calling the getter. The getter
must return `UNSUPPORTED_OPERATION` if the control is not
supported. For this reason, wire the getter to the hardware
mixer implementation.

Bug: 302132812
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ia50def0d076b6d3c46db55123186eab34bbbb954
2023-11-03 13:57:36 -07:00
Mikhail Naganov
55045b5fce audio: Clean up and fix the bluetooth HAL module
Fix the issue with retrieving BluetoothA2dp and BluetoothLe
instances access.

In 'Module::connectExternalDevice', always call
'populateConnectedDevicePort' to allow the module implementation
to cancel device connection.

Move frame count calculation into Utils.
Clean up includes and 'using' directives.

Bug: 302132812
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I22f65b8bcdcdd9bcd67a8290520eb4a465d4c720
2023-11-03 13:57:20 -07:00
Mikhail Naganov
1350187c6b audio: Provide a way for Module to specify nominal latency
The latency figure depends on the module implementation.
Instead of using a hardcoded value, each module should be
able to specify its own value. This value is then used
for calculating the minimum buffer size.

Set the nominal latency of the primary (CF) module to a high
value since the virtual device implementation fails CTS tests
if it attempts to pretend that it provides low latency.

Bug: 302132812
Test: atest CtsMediaAudioTestCases --test-filter=".*AudioTrackTest.*"
Test: atest CtsMediaAudioTestCases --test-filter=".*AudioRecordTest.*"
Change-Id: I8ce9f230378eea787c9b3c7ce3660c1e4e7bc895
2023-11-03 13:50:07 -07:00
Mikhail Naganov
2aab766d05 audio: Fix default remote submix HAL implementation and VTS
The implementation had duplicated code in 'transfer', which already
present in 'outWrite'.

Cleaned up delay calculations and logging.

Fixed the VTS to send 'prepareToClose' before attempting to join
the worker. Otherwise, the worker could be stuck on a blocking
operation due to inactivity of the other party and join would never
happen.

Bug: 302132812
Test: atest VtsHalAudioCoreTargetTest --test-filter="*AudioModuleRemoteSubmix*"
Change-Id: Id8455eb12d1d2999dc0bc7b64f0d70a61a177598
2023-11-03 13:49:59 -07:00
Vlad Popa
7c6c214049 CSD: remove unused library
Test: manual build
Bug: 209491695

Change-Id: I4eabeb92c0882db61bb530b438e59fb990d3c351
Merged-In: I4eabeb92c0882db61bb530b438e59fb990d3c351
2023-11-01 02:40:25 +00:00
Mikhail Naganov
3c8b6ce171 CSD: Add default AIDL HAL implementation
** Partial upstream of ag/24854732. Only the interface part is
** included.

This should enable the sound dose gts on cuttlefish devices. The sound
dose HAL uses the internal MelProcessor to compute the MELs which are
reported to the framework.

Test: atest GtsAudioTestCases:SoundDoseTest
Bug: 301527435
Change-Id: Ifc505a0171bc8b4d3f5cf65d950fa5c0f812087f
Merged-In: Ifc505a0171bc8b4d3f5cf65d950fa5c0f812087f
2023-10-31 11:38:43 -07:00
Treehugger Robot
309d65f0c4 Merge "LoudnessEnhancer: Added test cases to validate effect processing." into main 2023-10-31 17:04:05 +00:00
Sneha Patil
496e4415b0 LoudnessEnhancer: Added test cases to validate effect processing.
Added test to verify increase in loudness with gains.
Added test to verify that outputs are 0 for INT_MIN gain value.

Bug: 305866207
Test: atest VtsHalLoudnessEnhancerTargetTest
Change-Id: I6e87f5bf6f268980b6cc9af4b7a191657f117eb5
2023-10-31 11:58:02 +05:30
Shunkai Yao
4a0e25ba6f Merge "audio: Add VTS execution tracer" into main 2023-10-30 16:13:44 +00:00
Sadaf Ebrahimi
0fd834c749 Merge "Edit tests to adjust with changes in libxml2 upgrade" into main 2023-10-30 15:06:55 +00:00
Sadaf Ebrahimi
8029a0567c Adjust with changes in libxml2 upgrade
Bug: http://b/307806447
Test: TreeHugger
Change-Id: I474ca3539a2443ad0b1f590f27aa53a7279798e1
2023-10-30 15:06:32 +00:00
Sadaf Ebrahimi
351f681ec8 Edit tests to adjust with changes in libxml2 upgrade
Bug: http://b/307806447
Test: TreeHugger
Change-Id: I5978fb6b11538ac254b971fada17cfbbcc5360cf
2023-10-30 15:06:26 +00:00
Jaideep Sharma
7449841dc5 audio: Add VTS execution tracer
Add Execution listener in VTS tests to get information
about test execution steps like, start, stop and failure messages
in logcat message.

Bug: 287168985
Test: run vts-hal-audio

Change-Id: Ie69a7bf78076c17d7b623d75748fa0fdbdba6b1e
2023-10-27 20:02:42 +00:00
Shunkai Yao
48415986d9 Merge "Fix cts Pre/post Processing failures on Cuttlefish aidl" into main 2023-10-18 23:01:54 +00:00
Shunkai Yao
12179c335f Fix cts Pre/post Processing failures on Cuttlefish aidl
Bug: 295055755
Test: atest android.media.audio.cts.AudioPreProcessingTest
Test: atest android.media.audio.cts.DynamicsProcessingTest
Change-Id: Ia887a6c51ec13b9bb01581065c9272a7e02dad1f
2023-10-18 15:46:05 +00:00
Mikhail Naganov
fc35ca3d32 audio: Use hardcoded r_submix configuration with XML
There are several reasons why parsing the canonical XML
configuration for the remote submix module will not work
correctly (see the commend in the code).

Since de facto all vendors use the canonical configuration
XML for the remote submix, substitute parsing it with
a correct hardcoded version.

Bug: 205884982
Test: atest VtsHalAudioCoreTargetTest
(cherry picked from commit ea604d50de)
Change-Id: Ib9d9da25d315ff4ce36c1870241fb61d95fcca88
2023-10-17 19:54:38 -07:00
Lorena Torres-Huerta
f7492518c7 audio: Set connectedProfiles for non-attached device ports.
For external (non-attached) device ports that have dynamic
profiles, 'connectedProfiles' must be provided. They are
used when 'ModuleDebug.simulateDeviceConnections' is enabled.

Bug: 205884982
Test: atest VtsHalAudioCoreTargetTest
(cherry picked from commit a29393db39)
Change-Id: I69707d610c34f8f1eae9ef81768b76c40e985c0f
2023-10-17 19:54:29 -07:00
Lorena Torres-Huerta
533cc78aab audio: Populate MicrophoneInfo with vendor data
Added a virtual method Module::getMicrophoneInfos
so that vendor implementations can provide actual
data about device microphones. This information
is not part of the APM config file.

Bug: 205884982
Test: atest VtsHalAudioCoreTargetTestTest
(cherry picked from commit dc9d1a4b42)
Change-Id: I3ea9ba8da79fd29f8d69c5a575a57851d73df7b8
2023-10-17 19:54:13 -07:00
Mikhail Naganov
cc21b6f2e6 audio: Implement proper parsing of masks in XsdcConversion
Since the parsed XML uses compliant separator for lists
in attribute values, there is no need to use legacy
'maskFromString' function.

Bug: 305281224
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ib257fd010b923ac651931e5976f9b1363d693f1b
2023-10-17 19:53:55 -07:00
Lorena Torres-Huerta
394e2527b5 audio: Parse module configurations from the APM XML files
The default implementation now loads the HAL configuration
from the legacy XML configuration file which was previously
consumed by the framework directly.

Note that errors in the config file will lead to crash
of the XML parser, pointing out to the source of the problem.

IMPORTANT NOTES:
  - Never use untested legacy config files with production
    devices.
  - Make sure that all possible configurations (for example,
    BT offload on/off) are tested.

Bug: 205884982
Test: atest VtsHalAudioCoreTargetTest
(cherry picked from commit 00a7307862)
Change-Id: Id1002cb065e7cc19bdd520aca15b3fe5d39e5853
2023-10-17 19:48:24 -07:00
Mikhail Naganov
af75a679c9 Revert "audio: Parse module configurations from the APM XML files"
Revert submission 2770886-AidlAudioHalModuleConfig

Reason for revert: Breaks BluetoothInstrumentationTests on main downstream

Reverted changes: /q/submissionid:2770886-AidlAudioHalModuleConfig

Bug: 305291602
Change-Id: I0076c88877943d9498f90c477e78a2be5d390150
2023-10-13 23:38:25 +00:00
Mikhail Naganov
5eea7fb0d7 Revert "audio: Populate MicrophoneInfo with vendor data"
Revert submission 2770886-AidlAudioHalModuleConfig

Reason for revert: Breaks BluetoothInstrumentationTests on main downstream

Reverted changes: /q/submissionid:2770886-AidlAudioHalModuleConfig

Bug: 305291602
Change-Id: I01a4d22056507f9047c4fead21c9a75bfa153a46
2023-10-13 23:38:25 +00:00
Mikhail Naganov
006a136ea7 Revert "audio: Set connectedProfiles for non-attached device ports."
Revert submission 2770886-AidlAudioHalModuleConfig

Reason for revert: Breaks BluetoothInstrumentationTests on main downstream

Reverted changes: /q/submissionid:2770886-AidlAudioHalModuleConfig

Bug: 305291602
Change-Id: Id325171baeabd61d244e5f15c37f7d14402bd426
2023-10-13 23:38:25 +00:00