Commit Graph

600 Commits

Author SHA1 Message Date
Mikhail Naganov
10fc96386e audio: Implement more accurate timing for the stub stream
Stub output stream is like a /dev/null audio device, however
for synchronous transfers it must block for the duration of
the audio chunk being transferred. Implement more accurate
accounting for the blocking time using the same approach as
employed by the remote submix stream implementation.

Bug: 356719263
Test: atest CtsNativeMediaAAudioTestCases
      on aosp_cf_x86_64_auto target
Change-Id: I137aed397246bcf2b5ef6789aa4d2d27ead64467
2024-08-21 11:34:05 -07:00
Treehugger Robot
08c7c29c11 Merge "audio: Start Binder pool thread explicitly" into main 2024-08-19 22:46:05 +00:00
Mikhail Naganov
1840d35645 audio: Start Binder pool thread explicitly
It was noted that calling 'ABinderProcess_startThreadPool'
results in the audio HAL service having more Binder pool
threads than without it. This is preferred to having
just one thread via 'ABinderProcess_joinThreadPool'
as in the latter case clients may seemingly be blocked
instead of being served by a newly spawned thread from
the pool.

Bug: 357669241
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ia8ed52b3c5a95cea12d063a0e75ac908af9260f8
2024-08-19 14:48:28 -07:00
Mikhail Naganov
a6c2d43c79 Merge "audio: Fix stream cleanup sequence" into main 2024-08-19 16:30:45 +00:00
Mikhail Naganov
0413d077f7 audio: Fix stream cleanup sequence
Move the cleanup of the stream worker thread from '~StreamCommonImpl'
up to concrete stream implementations. This is because when
the worker thread is stopping, it calls 'DriverInterface::shutdown'
method of the stream. At the time when '~StreamCommonImpl' is
running, the concrete stream class has already been destroyed.

The cleanup actually only happens in the case when the client
did not close the stream properly via 'IStreamCommon.close', or
when the stream creation has failed in the middle.

Bug: 355804294
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ie86f682af202976ed48d24338b2dffcfd20d9a76
2024-08-15 14:18:51 -07:00
Yi Kong
e62f97fb5b audio: Remove unnecessary std::move
Moving a temporary object prevents copy elision, and could reduce
performance.

This fixes -Wpessimizing-move compiler warning.

Test: presubmit
Bug: 154270751
Change-Id: Idb1a4abf4da9eb6dbe1e9a8fd66461d60985c8e1
2024-08-14 01:52:25 +08:00
Shraddha Basantwani
0a981d36cf Audio Effect : Add base implementation of commandImpl method
Removing code repeatation and moving this method to base class.
Effect implementations can override enable, disable and reset methods.

Bug: 305866207
Test: atest --test-mapping hardware/interfaces/audio/aidl/vts:presubmit
Change-Id: Iceb7ad51185d6f6bd2b6d70a5a1dd51e7bd37276
2024-07-30 05:23:02 +00:00
Mikhail Naganov
657284d4ef audio: Use 'join' instead of 'stop' for stream workers
Calling 'stop' can cause the worker thread to terminate
before it handles the 'halReservedExit' command. This should
be avoided because a proper exit sequence may do cleanups.
Since all stream workers must handle the 'halReservedExit'
command, use of 'stop' should not be needed (if the thread
code gets stuck on a call to drivers, calling 'stop' will
not interrupt this), thus it is being replaced by 'join'.

Bug: 344482249
Test: atest CtsMediaAudioTestCases
Test: atest VtsHalAudioCoreTargetTest
Change-Id: If13f7239423657b80091239ff67e7fe350957e2e
Merged-In: If13f7239423657b80091239ff67e7fe350957e2e
2024-07-24 08:53:19 -07:00
Treehugger Robot
080d6b39ed Merge "audio: Prolong reading attempts from the remote submix pipe" into main 2024-07-22 18:08:07 +00:00
Mikhail Naganov
2be5078e25 audio: Prolong reading attempts from the remote submix pipe
In order to use the time interval for reading from the remote
submix pipe more efficiently, increase the deadline time
to the buffer duration minus a small amount. This should
minimize chances to have discontinuities in the remote submix
input.

Bug: 334363414
Test: atest --test-filter=".*RemoteSubmixTest#testRemoteSubmixRecordingContinuity" CtsMediaAudioTestCases
Change-Id: I02968d09afd8ecdad4d61e635393842d7280e55f
2024-07-22 16:04:23 +00:00
Mikhail Naganov
96c0123401 Merge "audio: Restrict reported channel masks to "mono" and "stereo"" into main 2024-07-22 14:34:22 +00:00
Mikhail Naganov
8c27e46bb9 audio: Restrict reported channel masks to "mono" and "stereo"
When translating supported channel counts into channel masks,
only use channel layouts for 1 and 2 channels: "mono" and
"stereo", while reporting all other counts via indexed
masks. This helps to support output to multichannel USB Audio
interfaces properly.

Bug: 329571487
Test: repro steps in the bug
Change-Id: Ibbbf71e7f04a6622cccaddeb3f4f140193d7f8fb
2024-07-18 17:03:53 -07:00
François Gaffie
ed095e62ab Restore Default Device Effects support with AIDL AudioHAL
Bug: 329395147
Test: atest CtsMediaAudioTestCases
Test: atest --test-mapping hardware/interfaces/audio/aidl/vts:presubmit

Change-Id: I0f4f680b4db4eaa69d6c6e9e7b897631ed94928b
Signed-off-by: François Gaffie <francois.gaffie@renault.com>
2024-07-18 23:16:43 +00:00
Treehugger Robot
f28b8e809c Merge "audio: fix mmap output" into main 2024-06-27 01:07:49 +00:00
Kuowei Li
53a8d4d62e audio: fix mmap output
1. add createMmapBuffer() for vendor to override and create mmap fd.
2. add refineMmapPosition() for vendor to override and update
latency in mmap case.
3. fix testcases position check in mmap case.

Bug: 274456992
Bug: 345591089
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ie63fdd47c0ddc563d84699dfdf6d4e9b72b5af43
2024-06-26 16:51:31 -07:00
François Gaffie
dab7ab0807 Migrate all related audio component to media.audio.common.types V4
-Change latest
-Unfreeze deps
-Update next compatibility matrix
-add opt sounddose v3 to fcm compat exclusions

Flag: EXEMPT HAL interface change
Bug: 307310023
Test: build & boot
Signed-off-by: François Gaffie <francois.gaffie@renault.com>
Merged-In: I3929603471d9543febca76ef6e2959063393194f
Change-Id: I3929603471d9543febca76ef6e2959063393194f
2024-06-26 18:13:56 +00:00
Shunkai Yao
d0dc9486c9 Merge "Update VTSHalAudioEffectTargetTest with frameSize" into main 2024-06-20 23:35:28 +00:00
Shunkai Yao
28aff3ddc0 Update VTSHalAudioEffectTargetTest with frameSize
- create buffer and check the fmq data with frameSize
- check effect state after open/close/command

Bug: 338040049
Test: atest --test-mapping hardware/interfaces/audio/aidl/vts
Change-Id: I45af2faec3cdcef5307fbdcf600a63d7da759261
2024-06-18 15:35:54 +00:00
Treehugger Robot
53e8ea6f82 Merge "EnvironmentalReverbTest: Add Tests to Validate Environmental Reverb Effect" into main am: 56e050362d
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/3088945

Change-Id: I0273c55317a36a8b359f49b9a92e1a695f4962fe
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-05-29 18:45:44 +00:00
Treehugger Robot
56e050362d Merge "EnvironmentalReverbTest: Add Tests to Validate Environmental Reverb Effect" into main 2024-05-29 18:27:25 +00:00
Sneha Patil
37f131c244 EnvironmentalReverbTest: Add Tests to Validate Environmental Reverb Effect
Compare energy values of auxiliary output for different parameters
Remove environmental reverb default implementation from the config file.

Bug: 305866207
Test: atest VtsHalEnvironmentalReverbTargetTest
Change-Id: I261c52ff25dd63d41213f0b40df8627dbb80a95d
2024-05-29 17:26:20 +05:30
Xin Li
64e598ce2b Merge Android 24Q2 Release (ab/11526283) to aosp-main-future
Bug: 337098550
Merged-In: I53a278f1317f5307441103dc42dc5be6f20d7075
Change-Id: I3a53ebf7339cdb886d3c1b733b8eee1847f8832a
2024-05-24 08:28:04 -07:00
Treehugger Robot
b5d5a9fa01 Merge "audio: Fix after aosp/2908743 (exit command handling)" into main 2024-05-14 00:49:27 +00:00
Mikhail Naganov
6a5748a02e audio: Fix after aosp/2908743 (exit command handling)
In aosp/2908743, the intended behavior of the "halReservedExit"
command (stream exit) was inadventedly changed. Instead of
exiting from the thread's loop only when the cookie has
the expected value, it was actually exiting when the cookie
value is any but zero. The intended behavior is as follows:

 - the cookie has expected value: do not send reply, exit loop;
 - the cookie has unexpected but non-zero value: ignore,
     do not send reply (that's the point of using the cookie);
 - the cookie has a zero value: ignore, send a reply (this is
     for VTS testing).

Bug: 300181540
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I9945eb0ba9042993adac8599b18f241c4f69ca7a
2024-05-13 16:38:11 -07:00
Shunkai Yao
e26729ae76 Merge "Improve effect AIDL HAL logging" into main 2024-05-10 01:43:23 +00:00
Shunkai Yao
fbb29ced9f Improve effect AIDL HAL logging
Bug: 333407024
Test: atest --test-mapping hardware/interfaces/audio/aidl/vts:presubmit
Change-Id: Ie983c4360488a6047bd284c20bf9899d38b4273e
2024-05-09 22:34:10 +00:00
Shunkai Yao
61f9dd21bd Update VTS to open Spatializer with supported input channel layout
Bug: 338040049
Test: atest --test-mapping hardware/interfaces/audio/aidl/vts
Change-Id: I2e3457771617ff9425672f4db5e151658e47c827
2024-05-09 20:28:08 +00:00
Mikhail Naganov
2222e7d599 Merge "audio: Abort on data FMQ pointer corruption" into main 2024-05-09 16:54:31 +00:00
Shunkai Yao
ef683a9c60 Use customized event flag for data FMQ not_empty to avoid conflict
also update VTS data path test skipping for offload effects

Bug: 335547630
Test: atest --test-mapping hardware/interfaces/audio/aidl/vts:presubmit
Change-Id: Ie92f04091658e210dccb7a2d60ebbab14c49fb58
Merged-In: Ie92f04091658e210dccb7a2d60ebbab14c49fb58
2024-05-09 01:07:34 +00:00
Mikhail Naganov
7b6951eed8 audio: Abort on data FMQ pointer corruption
Issue a fatal error when the data FMQ detects internal pointers
corruption. This condition indicates some low level problems
and should be diagnosed as fast as possible.

Bug: 338974476
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I962eba620149c7169f0f0a2dad4c4064232966d7
2024-05-08 16:50:01 -07:00
Mikhail Naganov
66351e5a9f audio: Align bluetooth start behavior
When staring data transfer, if resuming of BT session fails,
the legacy implementation does not indicate an error, thus
causing an automatic retry on next transfer. The AIDL
implementation was switching the stream into an error state
instead. This could cause audio mute when the BT stack is
slow on resuming. This CL aligns AIDL with legacy behavior.

Bug: 333307789
Test: repro steps in the bug
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:3f4c7fca29db4b82d597bb56478f40a75cef618c)
Merged-In: I5080a7275671287f188930f041c5ff2215ed2e1e
Change-Id: I5080a7275671287f188930f041c5ff2215ed2e1e
2024-04-16 16:27:10 +00:00
Treehugger Robot
0f141d1967 Merge "PresetReverb: Add test to validate PresetReverb Effect" into main 2024-04-11 17:25:34 +00:00
Sneha Patil
94abce0998 PresetReverb: Add test to validate PresetReverb Effect
Added tests to verify increase in energy with decrease in room and hall size.
Remove preset reverb default implementation from the config file.

Bug: 305866207
Test: atest VtsHalPresetReverbTargetTest
Change-Id: I565612d90b7c7e52cb23bd5dbfaf02235f65cc67
2024-04-11 09:25:56 +05:30
Mikhail Naganov
efb45bc792 audio: Allow to inherit Binder RT priority in AIDL
This option is on by default for HIDL interfaces, however
in AIDL it needs to be enabled explicitly.

Bug: 331469541
Test: m
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:d975a9e6ec0b6f0eeac99673b9b06e11146874ba)
Merged-In: I971185a46da4222160fb04b8b77f805ef0396562
Change-Id: I971185a46da4222160fb04b8b77f805ef0396562
2024-03-27 16:20:33 +00:00
Mikhail Naganov
a41ff5134d audio: Implement blocking in remote submix when there is no sink
The HIDL implementation blocked for the audio buffer duration
when the output side of the remote submix pipe does not have
the sink connected. This behavior was accidentally removed
when fixing b/327220024.

Also, limit the amount of the debug messages displayed when
the sink is shutdown to avoid spamming the syslog.

Bug: 328347445
Test: repro steps from the bug
Test: atest VtsHalAudioCoreTargetTest
Test: atest --test-filter=".*AudioPlaybackCaptureTest.*" CtsMediaAudioTestCases
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:6507376fb940198e8c39ad6d5345d132b1dd7219)
Merged-In: Ia66cb7b4567d42a41bf4715b7d725d36510ac50c
Change-Id: Ia66cb7b4567d42a41bf4715b7d725d36510ac50c
2024-03-25 16:04:27 +00:00
Mikhail Naganov
222d034461 Merge "audio: Adjust stream buffer size calculation" into main 2024-03-22 03:36:44 +00:00
Mikhail Naganov
cbb2976223 audio: Adjust stream buffer size calculation
When calculating buffer size, use powers of two
for "large" buffers only on SRs >= 44100 Hz.
With lower SRs, sizes rounded up to a multiple
of 2 give too high latency.

Bug: 328432688
Test: repro steps from b/328432688#comment3
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I605ef8507fef030d349e85c33ed0229c9566ddb5
2024-03-21 16:40:30 -07:00
Mikhail Naganov
df65834372 audio: Do not use A2DP/LE status when populating device port
The events about the status of A2DP and LE are sent by
the framework asynchronously with attempts to connect
an external device. As a result, the connection attempt
may be rejected by the bluetooth HAL module.

Bug: 327711955
Test: atest VtsHalAudioCoreTargetTest
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:a46d52771a3e4a7816ea722088153ee6b65f59c3)
Merged-In: Iecef0ee6a66cd290237fdcccd6a7016e9622c4b0
Change-Id: Iecef0ee6a66cd290237fdcccd6a7016e9622c4b0
2024-03-20 16:48:08 +00:00
Shunkai Yao
bb35effe0d Audio effect aidl log reduce and level adjust
Bug: 329334917
Test: atest AudioEffectTest
Test: atest CtsMediaAudioTestCases
Test: atest CtsEffectTestCases
Test: audio use cases on pixel AIDL audio hal
Change-Id: I49876924b230f2ac834d3b0e494a03b814c4bb6e
Merged-In: I49876924b230f2ac834d3b0e494a03b814c4bb6e
2024-03-16 00:00:12 +00:00
Treehugger Robot
1d9bf983a3 Merge "audio:aidl: Use module type in log prints" into main 2024-03-11 17:21:23 +00:00
Jaideep Sharma
559a491dc1 audio:aidl: Use module type in log prints
Module base class can be used by multiple module,
to identify the module in use from logs, use mType in the logs as well.

Change log type for getVendorParameter and setVendorParameters,
as all parameters might not be supported by each module and unsupported parameter does not mean an error.

Change-Id: I0f46f8a9be733edd11186140bc9c3f51ea8d0969
2024-03-08 10:21:31 +05:30
Shunkai Yao
7a0eb7b7a7 Effect AIDL: remove placeholder effect from default implementation
Bug: 328330990
Test: atest --test-mapping hardware/interfaces/audio/aidl/vts:presubmit
Change-Id: Icf15e349a2ad36eeefa1e3eb46428c04ae164ad1
2024-03-07 21:37:02 +00:00
Shunkai Yao
530235c8dc Revert "Effect AIDL: remove placeholder effect from default implementation"
This reverts commit d0a6d52d6e.

Reason for revert: b/328548875

Change-Id: I240831d8c417ea95e42ab5faa592a57ed97d475c
2024-03-07 20:25:13 +00:00
Xin Li
c4b2f5b564 Merge "Merge Android 14 QPR2 to AOSP main" into main 2024-03-07 06:41:02 +00:00
Mikhail Naganov
b06a492bd9 audio: Preserve 'usecase' for in IModule::setAudioPortConfig
The field AudioPortConfig.ext.mix.usecase is provided by
the client, thus is needs to be treated the same way as
'.handle'.

Bug: 302736184
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I45050e8530cd236f5e582585f583df477fc7ae8a
2024-03-06 16:39:50 -08:00
Shunkai Yao
124bdd282f Merge "Effect AIDL: remove placeholder effect from default implementation" into main 2024-03-06 21:43:30 +00:00
Shunkai Yao
d0a6d52d6e Effect AIDL: remove placeholder effect from default implementation
Also add two missing test class to postsubmit

Bug: 328330990
Test: atest --test-mapping hardware/interfaces/audio/aidl/vts:presubmit
Test: atest --test-mapping hardware/interfaces/audio/aidl/vts:postsubmit
Change-Id: I9f9b9feda9ca99e6a065e837fa77dc621ad35bb1
2024-03-06 18:48:52 +00:00
Mikhail Naganov
55e0afa49a audio: Fix glitching of remote submix
Align behavior with the HIDL implementation. This helps
to prevent glitches in the scenarios that use remote
submix for sending audio externally: Auto and Cast.

Bug: 322247032
Bug: 327220024
Test: Repro steps in b/327220024#comment14
Change-Id: If2e4ebd7145375a268ee5f0e4ab656bb3748b2fe
Merged-In: If2e4ebd7145375a268ee5f0e4ab656bb3748b2fe
2024-03-06 10:09:16 -08:00
Mikhail Naganov
4120b99ab6 audio: Align HAL buffer size logic with the framework
When the framework uses mixers, it rounds up the buffer
size to the frame count which is a multiple of 16.
In the HIDL implementation, this adjustment was done after
the framework thread was already created, and FMQ was
created on the first transfer, using adjusted size. In
the AIDL implementation, the FMQ is created together with
the stream, using the size suggested by the HAL.

Bug: 321233946
Test: verify audio playback over S/W A2DP
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:f2f9ae08c2ee4e396bbe4b8c7e955bad725ce545)
Merged-In: I35a5479bfc87a290aff09d51415381948857a146
Change-Id: I35a5479bfc87a290aff09d51415381948857a146
2024-03-06 10:09:00 -08:00
Mikhail Naganov
46c433aabd audio: Set correct priority for the SPATIALIZER stream thread
To align with the framework, the thread serving SPATIALIZER
stream I/O must use SCHED_FIFO and realtime priority.
The latter can be set via `audio.spatializer.priority`
property.

Bug: 321233946
Test: adb shell ps -Tl -p <HAL PID>
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:81a14293f4f26bf3af740cc1682c1111d7e1e29d)
Merged-In: I80107c9aa7d86cbfc2f79c2ad05959fc9f7913f7
Change-Id: I80107c9aa7d86cbfc2f79c2ad05959fc9f7913f7
2024-03-06 10:08:50 -08:00