This is based on the code from test-resampler.cpp. I simplify out some
bits and use the data from LibFuzzer as the input audio.
Test: ran fuzzer locally on-device
Change-Id: I1ed732698feccd4a644a1a8eea4e3862a025e11a
Split AudioMixer into the base part which doesn't rely on
the framework and can be used in vendor code and the derived part
which is intended to be used by Audioflinger.
Test: A/B compare output from test scripts, manual testing on the phone
Merged-In: I24c390f67f20baa8109902099359ca6e34eebcfd
Change-Id: I24c390f67f20baa8109902099359ca6e34eebcfd
- Remove unused dependencies on libnbaio and libnblog;
- Move dependencies on libaudiohal and libsonic to libaudioprocessing
as AudioMixer implementation does not use them.
Test: make
Merged-In: I258a450725bdacb4fcf437b6f86582d51d40e622
Change-Id: I258a450725bdacb4fcf437b6f86582d51d40e622
Required to ensure the RecordThread understands the true
number of frames consumed / available. Otherwise the RecordThread
thinks there are more frames than actually present, causing
a buffer provider underrun in the AudioResampler and the
resampler to reset.
Test: BT phone call, Tee sink
Bug: 130419319
Change-Id: I96fac6f52233e8519c0cc098329e5b9b89c1dd89
Combine adjust channels buffer provider and adjust channels non-destructive
buffer provider.
When contracting mono + haptic channels to mono, do not use
adjust_channels to avoid mixing haptic channel into audio channel.
Bug: 125915810
Test: play audio-haptic coupled files
Change-Id: I39916a3e0628a44ed4a148c265564af7135a2176
Use the constant from IExternalVibratorService.
Bug: 124318236
Test: play audio-haptic coupled file
Change-Id: Ice2ac13d0f6a6a749bb6243230524336144fa5f4
Use the same logic in VibrationEffect.scale to control the intensity of
haptic playback in audio framework. Note that as the maximum amplitude
of vibrator is 255, convert the haptic data to pcm_8_bit before doing
scaling.
Test: Manually
Change-Id: I6136d27c9255a215834b6e3092aa8ad696fbae04
It will make the track data disordered when adjusting channels non
destructive if the track is a static track.
Bug: 121047798
Test: Manually
Change-Id: Ibd9bc012ac9d36e0f19f6f6796753f9355cd3c97
When trying to play with haptic channel mask, use adjust channels
buffer provider to make the haptic channel the same as the output one.
If haptic playback is supported, use adjust channel non destructive
buffer provider to output haptic data to the end of the sink buffer.
Otherwise, haptic data will be ignored.
Test: Manually
Bug: 111454766
Change-Id: Ic5f780de48c1e71de6ba5c4774d1ed2e9c8c51a0
1. Add adjust channels buffer provider, which will expand or contract
sample data from one interleaved channel format to another. Expanded
channels are filled with zeros and put at the end of each frames.
Contracted channels are omitted from the end of each audio frame.
2. Add adjust channels non destructive buffer provider, which could
expand or contract sample data from one interleaved channel format to
another while not destructing the buffer. Extra expanded channels are
interleaved in from the end of the input buffer. Contracted channels are
copied to the end of the output buffer. Contracted channels could be
written to an output buffer with certain audio format.
Test: Manually
Bug: 111454766
Change-Id: I3f963307e73b3f7aa662d4127f78f0c61ac84510
See build/soong/README.md for more information
Test: cd frameworks/av/media/libaudioprocessing; mma
Test: atest resampler_tests
Change-Id: Icae927b3d4692f7cf15b296e6bf5529329b22325
Currently it gets included through utils/Log.h which includes
log/log.h which will usually be taken as:
system/core/liblog/include/log/log.h.
If on the other hand system/core/liblog/include_vndk/log/log.h gets
included instead, pthread.h will not be included.
Test: Manual - builds OK
Bug: 119390863
Change-Id: I64255f0812367a55996a7b64da65646fdf1743c2
Add FALLTHROUGH_INTENDED for clang compiler.
Bug: 112564944
Test: build with global -Wimplicit-fallthrough.
Change-Id: I8875bc7ed073aae84d5df97eb39c8c745ca627ef
Error found with clang static analyzer after
making ALOGV_IF to use its parameters.
Bug: 111850071
Test: build with WITH_TIDY
Change-Id: I35bdfd6583a106d82f30063cbd629bcff1d58289
Merged-In: I35bdfd6583a106d82f30063cbd629bcff1d58289
(cherry picked from commit 09f9c02372)
Error found with clang static analyzer after
making ALOGV_IF to use its parameters.
Bug: 111850071
Test: build with WITH_TIDY
Change-Id: I35bdfd6583a106d82f30063cbd629bcff1d58289
the Resampler is recreated only if mixer channel count has changed.
I removed the criteria since resampler need recreation when
track channel count has changed.
This issue is due to the previous resampler still working with
the previous channel mask settings.
Test: self-tested more then 50 times when a voice call ended
and there is an incoming Skype/LINE ringtone.
Bug: 78199280
Change-Id: I042fb9214d07f198704cef3c96bf290c7d203461
Always prepareForReformat() when channelmask has changed,
no matter needing a downmix or not.
Since ReformatBufferProvider would need to reset when
channelmask has changed.
Test: self-tested more then 50 times when a voice call ended
and there is an incoming Skype/LINE ringtone.
Bug: 78199280
Test: bug is fixed.
Change-Id: I08c74b00fcbaf8aacef7b1d1c1e840cae347accb
Signed-off-by: Yung Ti Su <andysu@google.com>
For security reason, float buffers provided by application must be
clamped to FLOAT_NOMINAL_RANGE_HEADROOM.
With the new all float pipeline, float are no longer clamped by their
conversion to fixed point.
This patch adds a float buffer provider that clamps float samples
as they are copied to audio pipeline.
Test: Play music, play video in chrome (opensles format float),
play float pcm audio file specially crafter with >> 1 samples.
Bug: 68099072
Change-Id: I220b436d9982bc43a75715a030efd0e6a0c79fa3
Signed-off-by: Kevin Rocard <krocard@google.com>
As part of change:
Remove track name offset by TRACK0.
Move track name management to the Tracks class.
Sync mixer track name to FastMixer track index.
Fixes regression introduced by commit 8ed196a.
Test: SoundPool, AudioTrack CTS, Usability
Bug: 72937362
Bug: 73004420
Change-Id: I2f1a33f6f0da66bcd7aa91e2a4b663ff822df645
Client apps can have 40 tracks, up from 14 tracks
Related code cleanup:
a) Removed State nested class
b) Moved static functions to Track member functions
c) Moved static function hooks to pointer-to-member-function hooks
d) Some reorganization of touched code for recent C++ style
Test: test-mixer native mixer test
Test: SoloTester effect test
Test: SoundPool with many tracks
Test: CTS AudioTrackTest
Bug: 64161002
Change-Id: I0d09620acd715d577e776bb6f76e94e87e554520
audio.h and its dependencies (audio-effect.h, sound_trigger.h...)
used to be shared between system and vendor code.
This led to multiple problems:
1) Such sharing contradicts the Treble policy of
strict independence of framework and vendor code.
2) When audio.h was changed, every vendor needed to update
its code in the next release. This meant that audio*.h
headers were mostly changed in backward compatible manner.
Nevertheless, for P the HIDL interface and thus the audio.h
interface are changed in backward incompatible way.
(Some enum are becoming 64 bit long).
3) As the headers were common, some API used only by the framework
needed to be visible to the vendors (mostly enum values).
4) Treble policy is to support at least one previous HAL version
As a result the audio*.h headers are now duplicated,
one set for the framework, and one for the vendor.
Each set will evolve independently. After this split,
the framework-only APIs will be removed from the vendor headers
and vice versa.
The split is implements as such:
+ for system code
- NOT moving the libaudio_system_headers
Eg: system/audio.h and system/audio_effects/effect_equalizer.h
are still in system/media/audio
- the legacy audio HAL API that were in libhardware headers
are now in libaudiohal_legacy_headers
Eg: hardware/audio.h and hardware/audio_effect.h
are now in frameworks/av/media/libaudiohal/legacy/
+ for vendor code
- moving libaudio_system_headers and the legacy audio HAL API
that were in libhardware_headers in
android.hardware.audio.common.legacy@2.0
Note that those headers are now versioned, so migrating to a @4.0
HIDL HAL will mean changing the legacy dependency too.
Eg: system/audio.h, system/audio-effect.h, hardware/audio.h
are now in hardware/interfaces/audio/common/2.0/legacy
- the legacy audio effect HAL API that was in libaudioeffects
is now moved in android.hardware.audio.effect.legacy@2.0
Eg: audio_effects/effect*.h are now in
hardware/interfaces/audio/effect/2.0/legacy
- the legacy sound trigger HAL API that were in libhardware_headers
is now moved in android.hardware.soundtrigger.legacy@2.0
Eg: hardware/sound_trigger.h is now in
hardware/interfaces/audio/effect/2.0/legacy
libaudioutil being used by both system and vendor, had
to be renamed for system to libaudioutil_system.
Vendor libs that now depend on the audio.h of a specific
version and are not extensively referenced in non google code,
append @2.0 to their name.
Note that headers that are not expected to change in the 4.0 HAL are
left in all-versions folder to avoid duplication.
This is an implementation detail as the versioned libraries export
the all-versions headers.
Note that strict vendor-system separation is enforced by the
build-system. The system headers are not available for vendor
libs and vice-versa.
Note that this patch is split between numerous git repository (>10),
all the commits having the same Change-id for searchability.
Note that audio_policy.h is no longer exposed to vendors
as the legacy audio policy HAL API was never officially supported.
As a result the audiopolicy stub implementation has been removed.
Test: compile taimen-userdebug walleye-userdebug
sailfish-userdebug marlin-userdebug
gce_x86_phone-userdebug gce_x86_phone
full-eng aosp_arm aosp_x86-eng
Test: check that the emulator booted and played audio
Test: full QA on sailfish-userdebug and taimen-userdebug
Bug: 38184704
Change-Id: I950f4e0a55613d72e32eba31bd563cb5bafe2d1a
Signed-off-by: Kevin Rocard <krocard@google.com>
Both core and effect Hal now have one single point of entry.
This point of entry is their respective factories:
- DevicesFactoryHalInterface::create
- EffectsFactoryHalInterface::create
Each entry point looks for their respective services supported
version, starting from the highest (currently only 2.0) and
returning the subclass wrapping this version to the most recent audio.h
framework api.
Note that EffectBufferHalInterface were previously created from static
methods (mirror and allocate) which broke the single point of entry
requirement.
As a result, buffers have now to be created from the factory like the
other classes.
Note that the death handler also need to be its own library as it is
used by versioned code and is version independent.
Bug: 38184704
Test: compile
Change-Id: Iac9b1fda561bb486193d5b9e025a870f50cda530
Signed-off-by: Kevin Rocard <krocard@google.com>
When the desired number of frames is not a multipler of blocksize,
process__genericNoResampling will ask for 0 frames and crash.
Fix it.
BUG: 70902559
Test: cts-tradefed run cts -m CtsMediaTestCases -t
android.media.cts.AudioTrackLatencyTest#testOutputLowLatency
Change-Id: Id2ce771ee8a4e49fe6ea82e500017324c8918a73
(cherry picked from commit e38b72e410def6c44f090d149879cb620fcc7955)