Workaround for a recent change in the build that made command line apps
incompatible with O.
Test: adb shell aaudio_loopback -?
Test: should print help and not crash
Change-Id: If2a2288249a33c16fa5004b6b7db1a5ff9e22745
Make silence detector less sensitive to noise by setting the
threshold proportional to the measured pulse level.
Make glitch detector less sensitive to noise by setting the
threshold proportional to the measured noise level.
Report signal to noise ratio.
Improved printed messages, show state as text.
Bug: 117834966
Test: aaudio_loopback -pl -tm
Change-Id: I5593cd1ade93ecbcb05f42af07626013d036f29a
The C API interface to these was swapped internally, meaning that
setChannelCount would actually invoke setSamplesPerFrame.
Bug: 117985878
Change-Id: I2e7f4b5ec01323c1df1aa6c34b849a63ec9ba936
This can be used to reproduce the wrap around bug
in the MMAP FIFO in OC_MR1.
Bug: 78139448
Test: aaudio_loopback -tm -pl -Pl -z120
Change-Id: I923e60432f1c9777355d12d76609f2d70393f61b
Improve support for AudioEffects in LOW_LATENCY mode.
If a Session is requested then it is likely that effects will
be used so do not set the RAW flag. RAW flag could interfere with
creating effects on some devices.
Bug: 80203192
Test: Native Oboe Tester
Change-Id: I9e7ac8689de71b376b750259da36d5879fe4898d
Construct a flowgraph based on the source and destination
format and channelCount. This is groundwork for supporting 24-bit
PCM formats.
Also cleaned up handling of device related format.
This CL removes more code than it adds.
Bug: 65067568
Test: write_sine_callback.cpp -pl
Test: write_sine_callback.cpp -pl -x
Test: input_monitor -pl
Test: input_monitor -pl -x
Change-Id: Ia155bff0164912011d09b61b54f983ccf4490bd1
Implement a simple data flow model that can be used to
chain various processing modules including:
data format conversion
volume ramping
channel conversion
Bug: 65067568
Test: test_flowgraph.cpp
Change-Id: I81a5655406cfa8c1c7d7cef4d933879f823939a5
Remove unused methods and fields.
Better code format and alignment.
Use unique_ptr for mFifo.
Remove getFifoController() method that exposed pointer.
Updates tests and calling code as needed.
Test: test_atomic_fifo.cpp
Change-Id: I1ea66beaadeb74083307835858b757e4753affda
That was causing us to not get a FAST track.
Bug: 112186931
Test: adb shell aaudio_loopback -te -pl -Pl -m1 -n2
Test: should get PerformanceMode 12 on INPUT
Change-Id: Ib8b00585a80bdd86f752a5ee37aacd92f06db347
They have been replaced with .bp files.
Bug: http://b/32019064
Test: mmm frameworks/av/media/libaaudio
Change-Id: I34d20c09f36f79929c0878a62673bd2a3c8ef610
Check to make sure input capacity is large enough.
Add -B option to set input capacity.
Handles variable callback size better when setting up the
loop for Legacy mode.
Narrower impulse.
Bug: 80230720
Test: this is a test
Change-Id: I9349cf8248b65850073bfb8178bbb802a93fd684
The wrong monotonic frame counters were being reset.
A reset is needed because the service resets it 32-bit counter.
Bug: 79497298
Test: NativeOboeTest app, see bug report for repro steps
Change-Id: Iee1797b4dee47ec08142c9ddb199b861e4db5ded
Loopback test was still reporting some glitches.
These were false alarms due to:
* starting input before output causing an overflow
* not waiting for the input to reach equilibrium with the output
* detecting slow drift in magnitude as a glitch
I changed the logic for setting up a test
and track slow changes in magnitude.
Now the rare glitch seems to be a real glitch.
Bug: 78139448
Test: this is a test
Change-Id: Id16d7dc59c0f2e040fe1dfb0337e9ed987d4fd02
This prevents NaN from creating noise that does not respond to
Volume changes.
Bug: 69224661
Test: adb shell aaudio_loopback -c2 -C2 -tm -m2 -s20 -Pl -pl
Change-Id: I8604f5af42cbf5637f7ea4e975f53db990cdf9de
Support both I16 and FLOAT format.
Silence output at beginning when skipping buffers. Was sometimes spewing noise.
Print more information when it fails so we can debug the failure.
Fix getting framesPerBurst from wrong stream.
Track when read gets too few frames.
Bug: 38268031
Bug: 78139448
Test: this is a test
Change-Id: If562856ab2eac607a8bb15da1cc587ae631f7a1d
Write data, read it back and verify.
Try to trigger wrap-around conditions.
Bug: 78139448
Test: this is a test
Change-Id: I4247fcf57a25c97c6ab8ce9671d0f61556ecef6a
The number of frames in the second part was incorrect
when it wrapped past the end of the FIFO.
Bug: 78139448
Test: adb shell aaudio_loopback -c2 -C2 -tm -m2 -Pl -pn
Change-Id: Ib6a22f30f0ee5321444c6d6137d9488943c34f3d
Needed for silencing specific input streams.
Pass AAudioService reference into AAudioServiceEndpointMMAP.
Use it to find a specific stream by PortHandle then
stop it and disconnect it.
Bug: 72134552
Test: b/72134552#comment10
Change-Id: Ibdf242f834c83b47c967c3cc634ed1083b019d4a
Counters will give us some history for AAudio.
Removed some unneeded logs.
Added log to help debug intermittent volume problem.
Bug: 64310586
Test: adb shell logcat
Test: adb shell dumpsys media.aaudio
Change-Id: I012361bb4d0d0bfdedfe5ceef856b59282c8d3f0
This allows an app that requests a LOW_LATENCY FLOAT INPUT stream
to get a FAST track when using Legacy mode.
This is needed because Legacy AudioRecord does not allow FAST for FLOAT
streams.
Bug: 38268031
Test: adb shell input_monitor -m1 -pl -f2
Test: adb shell input_monitor_callback -m1 -pl -f2
Test: On Pixel phones you should get actual performanceMode=12
Change-Id: Ia5879ff4904f50bbb5009a3fc058800e53770710
The localPosition was used even if it was not set by another
function. Now we only use it if OK.
Bug: 77659012
Test: input_monitor.cpp -m1 -pn
Change-Id: I10648c5c17d42bb31d83fb14c1bda3ec527a3924
New symbols involve SessionID, ContentType, Usage and InputPreset.
For example AAudioStream_getUsage(),
and AudioStreamBuilder_setContentType()
Bug: 77632550
Test: Look at auto-docs for new functions.
Change-Id: If56529bab218c4aeb42022ec02ce8fdaa45795a4
Select format using -f0, -f1 or -f2.
Add support for float format to input_monitor.cpp
Bug: 38268031
Test: these are tests
Change-Id: Idd7dc6c0cc268126d4ea008bcb49693b73a8f81f
Use __func__ more often.
Show thread entry and exit.
Log illegal state transitions.
Remove some unnecessary logs.
Bug: 64310586
Test: use AAudio then look at the logs
Change-Id: I2e289698efc897640588ba534b5513ac39b15043
This is to ensure that validate() is always called
in the future.
Bug: 74558178
Test: run AAudio CTS
Test: on Marlin, adb shell write_sine_callback -pl
Change-Id: I661f3c4e690be2268ca61b80a98bbdf9a7368c1b
MMAP hardware streams are often stereo.
But apps often want to output a mono stream.
Since converting from mono to stereo is easy,
we can go ahead and open a stereo hardware stream
and then just convert the apps mono data to stereo for the HW.
Add getDeviceChannelCount().
Test: adb shell write_sine_callback -pl -s10 -c1 -m3
Test: adb shell write_sine_callback -pl -s10 -c1 -m3 -x
Change-Id: I444a38c6f5cd32d1d6113f16aacec68285a1bc82
Create an MMAP stream at 48000 Hz.
Then try to create a second MMAP stream at 44100 Hz,
which will open on the Legacy path.
The bug will cause the first stream to be killed.
Bug: 73369112
Test: this is a test
Change-Id: Ibc7ef78b6bfd67114d6d2f47519e2a9113e75855
Now it will be the same number of msec at any rate.
Bug: 68804159
Test: write_sine_callback -pl -s60
Test: then change volume. Should be smooth.
Change-Id: I1f375e5a680198d0f8c6c398b22faf8b092e94fd
Was not handling negative IDs correctly.
Update test to allow negative IDs.
Bug: 72333892
Test: CTS has test_session_id
Change-Id: I1ca57026d6202f7d54c8efd51b14854be6cc69e4
Now requestStop() and requestPause() do the appropriate thing
based on state.
Flush is allowed when OPEN, PAUSED or STOPPED because there might
be pre-roll data.
Bug: 69810494
Test: test_various.cpp
Change-Id: Ie1b306b17734a58fa71b1742bb186482893656b7
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>
Using the legacy HAL interface was not needed. Only the system audio
header types are used by aaudio.
Test: compile
Bug: 38184704
Change-Id: I321635ef79732eb20864d1349e6a13911ece8da5
Signed-off-by: Kevin Rocard <krocard@google.com>
If a sessionID other than AAUDIO_SESSION_ID_NONE is requested
then legacy data path will be forced.
SessionID is implemented for MMAP data path but not used.
It is easier to implement it now then try to figure
it out later.
Bug: 33268927
Test: test_session_id.cpp will be moved to CTS when stable
Change-Id: I3ea67f57c1cbe24a512980f1352b917ab3cb6387
Test AAUDIO_SESSION_ID_NONE.
Test AAUDIO_SESSION_ID_ALLOCATE then use the allocated ID
for both input and output.
Bug: 33268927
Test: this is a test
Change-Id: Ia70670259137e715e75a497ef910a231b638e877
The session ID can be associated with a group of audio effects.
The effects can be controlled from the Java API.
Bug: 33268927
Test: test_session_id.cpp
Change-Id: Ifaec4d48e33428221ef4f7dd2c61067554527197
These docs apply to O and P release.
Say POWER_SAVING not supported on input.
Emphasize that error callback should not stop or close directly.
Fix some incorrect function names in comments.
Bug: 62291775
Bug: 72036879
Test: read the autodocs to see if they make sense
Change-Id: Id03a7733735b856499dd944eb9e3c1523f8b6650
Set callback enable flag before starting AudioTrack callback.
Bug: 72115512
Test: Repeat: adb shell write_sine_callback -pn -s4
Test: 20 times and make sure framesWritten is advancing.
Change-Id: I670fde46da0dccf8a6d03478fe2aa8b7ad596a3b
The attributes were not propagating all the way down for MMAP
streams.
Bug: 72046612
Bug: 72049948
Test: adb shell aaudio_loopback -te -pl -n1 -x -X -i6
Change-Id: I41b592d0c3a9daef5070ad299198c8d6cd890cfc
Name them "AAudio_#" where # is an increasing index.
For example AAudio_1, AAudio_2, etc.
Also name threads that are used for sending timestamps.
Test: run write_sine_callback then dump the threads for that process.
Change-Id: Ibd8c7be1109f6c15a4601ef154038cdce2e65e11
Needed to keep track of when functions were added to an API.
Bug: 68052449
Test: CTS test_aaudio_attributes.cpp
Change-Id: I7c325e9ca71ff92550cd743c456745569dd6a40d
Pass these audio attributes to AudioFlinger.
Bug: 68052449
Bug: 62104146
Test: test_attributes.cpp will be moved to CTS when ready
Change-Id: Ib8804614d95dcf1b85e51ec1f5569892e017a991
Pass these audio attributes to AudioFlinger.
Also test for default behavior.
Bug: 68052449
Bug: 62104146
Test: this is a test
Change-Id: I3bef65fb7b7da6eeb670f53aa9e5bf7d237ea714
These correspond to audio attributes already supported in the Java API.
Bug: 68052449
Test: test_attributes.cpp will be moved to CTS when it is ready
Change-Id: I29de99b3e815d4de3eca769da9106b792bce80bb
Save recording in a WAV file instead of a RAW file.
Add a test mode that reads a WAV file, for debugging auto-correlation.
Cleanup printed reports.
Discard more input buffers at beginning.
Test: this is a test
Change-Id: Ib5ea63882eda325b02716a448897007a945f7312
The compiler was complaining because a pointer was printed after it was
freed. The compiler folks agree this is OK and recommended a technique that
prevents the warning.
Test: any AAudio program, look at log for close
Change-Id: I49c005b48edc4a5dcb5c85da2a9e875befc37206
Test whether functions are illegal from a callback.
Also test AAUDIO_CALLBACK_RESULT_STOP
Test: this is a test
Change-Id: I0e91b08951f7f29f6fa317a8b3c4a69f14e58483
Detect whether AAudioStream_requestStop() is being called
from a data or error callback and return error.
Also for start(), pause(), flush() and close().
Honor AAUDIO_CALLBACK_RESULT_STOP in Legacy callback.
Bug: 65560631
Bug: 62943389
Bug: 63096718
Test: test_various.cpp callback_blocker_none and callback_blocker_lowlat
Change-Id: I29a685cd42910f70d16e23db0f9ec00b72451cfc
Was calling setDeviceId(), which is overwritten by set().
Bug: 70512693
Test: write_sine_callback, see bug for details
Test: input_monitor, see bug for details
Change-Id: I484f47e898a0e92a6f88e099a115f3d091c174c2
Randomly start, stop, pause, flush audio streams
to see if we can trigger unexpected bugs.
Test: this is a test
Change-Id: I52a62c247f8c94de024aed63764e8d6b50c59343
The service knows when an actual xrun occurs so we pass
that value to the client.
Bug: 38512417
Test: write_sine_callback -pl -n1 -s20 -c2 -u
Change-Id: I9e5ff1edd2e9378957309280162d7cda855f5adb
It was using numSamples instead of numFrames.
So timing was off.
Bug: 68804159
Test: raise and lower volume without clicking
Test: test_linear_ramp.cpp
Change-Id: I18b10dadbc47ab9cbe9c5aefd4e6197c50a0bedc
Test: I solemnly swear I tested this conflict resolution.
Exempt-From-Owner-Approval: simple merge conflicts
Change-Id: I32cd6ce0eca9b74b20554f20bcf410d76612c47a
-- replace 'loopback' with 'aaudio_loopback', since this is how
the executable is called;
-- remove "-f" argument, as it's not implemented;
-- in the example, replace "-b2" to "-n2" ("-b2" doesn't seem correct);
-- brush up text layout.
Change-Id: Ifae87380d0c9378f936f661ad77cb94a944c05fc
Test: make and run
This fixes a problem with intermittent severe distortion
and variable latency after restarting a stream.
Bug: 68003241
Test: write_sine_callback -pl -m2 -n2 -s5 -c2 -l100
Merged-In: Id7418adb86f2869ac74936cfbd365815a0a0e923
Change-Id: Id7418adb86f2869ac74936cfbd365815a0a0e923
This CL should not change any code behavior except for log text.
Mostly it removes redundant class names from the log.
Test: CTS nativemedia/aaudio
Change-Id: I6a6d01da080f536d5345f2b0deb32e92ed1e3d47
These will actually get installed as tests in /data/nativetest{,64}/...,
instead of into the /system/bin directory.
Test: mmma frameworks/av/media/libaaudio
Change-Id: I41e077e21e3d5c76f0fd5b4f21f7377a0c293740
This fixes a problem with intermittent severe distortion
and variable latency after restarting a stream.
Bug: 68003241
Test: write_sine_callback -pl -m2 -n2 -s5 -c2 -l100
Change-Id: Id7418adb86f2869ac74936cfbd365815a0a0e923
Loop while starting and stopping or pausing/flushing.
Check framesWritten - framesRead.
Blip so we can tell if the beginning of the sound was cut off.
Add -t option for the high pitched prefix tone.
Test: this is a test
Change-Id: I2a642be67f4e80caad015254d006a0153b46e3f7
See build/soong/README.md for more information about Soong.
I didn't translate the examples, since they appear to be NDK build
files, not platform build files.
Test: mmma frameworks/av/media/libaaudio
Change-Id: Icf228c701afe37dd3c7f00ea9e6fb740b0d450f1
Merged-In: Icf228c701afe37dd3c7f00ea9e6fb740b0d450f1
Exempt-From-Owner-Approval: simple backport
(cherry picked from commit 0230b1ac4a)
See build/soong/README.md for more information about Soong.
I didn't translate the examples, since they appear to be NDK build
files, not platform build files.
Test: mmma frameworks/av/media/libaaudio
Change-Id: Icf228c701afe37dd3c7f00ea9e6fb740b0d450f1
Merged-In: Icf228c701afe37dd3c7f00ea9e6fb740b0d450f1
See build/soong/README.md for more information about Soong.
I didn't translate the examples, since they appear to be NDK build
files, not platform build files.
Test: mmma frameworks/av/media/libaaudio
Change-Id: Icf228c701afe37dd3c7f00ea9e6fb740b0d450f1
Just start a new stream without stopping or closing the old disconnected
stream.
Bug: 67664976
Test: this is a test
Change-Id: I674626d0d365ed3a72e079212c6aceed9b0c85fc
Maintain strong pointer to service stream during service calls.
Use simple AAudioStreamTracker instead of complex HandleTracker.
Bug: 65280854
Test: affects all MMAP streams, run all CTS tests, etcetera
Change-Id: I3d2ed8b588ea39c216dacd4dea503b11c33f36f3
Simplify registration. Reduce use of virtual methods.
This CL, plus some CLs in AudioManager, should fix
crashes involving RefBase::decStrong
Bug: 65450109
Test: CTS or "write_sine_callback -m2 -pl"
Change-Id: Ie1decd20f8d44bdefb0faf92e6b74de4f72e86bd
but include the associated names in the global symbol export list, so
that apps that receive AAudioTesting.h outside of NDK can access the
symbols without dlsym().
Test: builds OK
Change-Id: If68f35145d68f359ebb7995ffcf9c9b8f9be6eb1
(cherry picked from commit 4257fd9aba)
Also clean up the state machine handling in the data callback.
Prevent error callback sometimes being called twice for the same error.
Bug: 63342351
Bug: 63087953
Test: add sleep(2) to write_sine_callback.cpp before the requestStop()
Change-Id: I27737bcb0371052741f50bda9f65c5994ccf6fd9
Should be AAUDIO_ERROR_INVALID_STATE if no timestamp available.
Bug: 65447871
Test: test_timestamps.cpp should only print AAUDIO_ERROR_INVALID_STATE
Change-Id: Id9e211ef8fce078514f4348a434e0c003372369c
CTS test was crashing because of a multiple inheritance
problem involving PlayerBase.
We now implement separate PlayerBase class that sits between
AudioStream and the system.
Bug: 65450109
Test: CTS nativemedia/aaudio
Change-Id: I424663acc1eeacc9544769991495cb48f4110359
Start the client after we get valid timing data from the server.
That can take a while because of the long cold start times.
The client is synced with the current position of the service.
Now the client can start clean with no underruns.
Bug: 63918065
Test: test_timestamps.cpp
Change-Id: I5d01eb844e4b14cd5477d56ea1dd9e309abc1c52
Use MonotonicCounter for timestamp position.
Bug: 63918065
Test: write_sine_callback.cpp and test_timestamps.cpp
Change-Id: Iea58384e2d96adcfad586e8c522024baaecccb8c
Automatically reopen the stream if we get disconnected.
Add a futex based signaling class so that the error callback can
immediately inform a waiting thread.
This can be used to prevent the system from playing an unpleasant sound
after the stream is disconnected.
Bug: 63342351
Test: plug and unplug headphones while running write_sine_callback
Change-Id: I3ea4fb24106156a29d2f302f3eb614f25f1b758a
This removes the manually rolled IPlayer implementation and instead uses
an aidl generated implementation. The IPlayer aidl file is moved from
frameworks/base/.
Test: run cts --module CtsMediaTestCases
Bug: 64223827
Change-Id: Ia609f7ba1cc6f71ce919d6174dd8b5e0e1b05575
Note that this uses the -d option, which used to be for durationSeconds.
We now use the -s option for seconds.
Bug: 64981153
Test: this is a test
Change-Id: I9789a1f520dc93bfb26143582dacb9619650abf7
Fix timeout detection so that callback thread can die.
Prevent AAudioBinderClient singleton from getting deleted,
which caused a subsequent lock on a dead object to hang.
Bug: 64988439
Test: "write_sine -m2 -pl" and "adb shell killall audioserver"
Change-Id: I044bce385b66e69007d1997f051c9d6c042b7871
AAudio was setting the stream to PERFORMANCE_MODE_NONE
if we got the FAST mixer but did not get the RAW flag.
We now consider FAST flag by itself to be LOW_LATENCY.
Bug: 63004643
Test: see bug for repro case using NativeOboe app
Change-Id: Id4643d20926a8e983cd28408f70e176976c02195
The MMAP endpoints were not tracked by the EndpointManager
so it could not broker EXCLUSIVE access. To fix this the MMAP stream
was refactored to use a per-client stream and a per-device endpoint.
Cleanup close() of MMAP stream.
Add AAudioServiceEndpointShared.cpp.
Extract AAudioServiceEndpointMMAP from AAudioServiceStreamMMAP.
Track MMAP endpoints so we can manage EXCLUSIVE and SHARED access.
Bug: 64494572
Bug: 64310586
Test: see bug, use write_sine to play a shared stream and a excl stream
Change-Id: I5053193abfd9b8a69a2f7e1110739d65e2af5d64
Merged-In: I5053193abfd9b8a69a2f7e1110739d65e2af5d64
The MMAP endpoints were not tracked by the EndpointManager
so it could not broker EXCLUSIVE access. To fix this the MMAP stream
was refactored to use a per-client stream and a per-device endpoint.
Cleanup close() of MMAP stream.
Add AAudioServiceEndpointShared.cpp.
Extract AAudioServiceEndpointMMAP from AAudioServiceStreamMMAP.
Track MMAP endpoints so we can manage EXCLUSIVE and SHARED access.
Bug: 64494572
Bug: 64310586
Test: see bug, use write_sine to play a shared stream and a excl stream
Change-Id: I5053193abfd9b8a69a2f7e1110739d65e2af5d64
Prevent AudioEndpoint from being configure()d twice.
Check return value of AudioEndpoint.configure().
Prevent AudioStreamInternal from being open()ed twice.
Bug: 64522125
Test: adb shell dumpsys media.audio_flinger --unreachable
Change-Id: I3ae07af5610fd1f9e539f884923f781eefcd645f
Use unique_fd to track file descriptors.
Fix extra close of file descriptor in SharedMemoryParcelable.cpp.
This bug was causing unrelated file descriptors to be closed!
Bug: 64311216
Test: write_sine.cpp, FD should survive aaudio close
Change-Id: I4f38c83510a49ea22b79b96d970ee48153417249
Merged-In: I4f38c83510a49ea22b79b96d970ee48153417249
Use unique_fd to track file descriptors.
Fix extra close of file descriptor in SharedMemoryParcelable.cpp.
This bug was causing unrelated file descriptors to be closed!
Bug: 64311216
Test: write_sine.cpp, FD should survive aaudio close
Change-Id: I4f38c83510a49ea22b79b96d970ee48153417249
Use AIDL to generate the IAudioRecord interface rather than using
a manually implemented interface.
Bug: 64223827
Test: Ran the AudioNativeTest and CtsMediaTestCases CTS tests.
Change-Id: Iade23c73253a97c358050bbd697ebe592b89a4c0
When a stream is disconnected, clear the MMAP memory
buffer to prevent the hardware from looping on stale data
and making a buzzing sound.
Bug: 63342351
Test: play GStomper with AAudio through headphones and then unplug them
Change-Id: I6372b0a031dea242e3830cc2d226a4c043d4467e
This restores some deprecated functions that some released apps
were calling. Restored:
AAudioStreamBuilder_setSamplesPerFrame()
AAudioStream_getSamplesPerFrame()
Bug: 64346279
Test: put GStomper in AAudio mode using its Settings on Marlin
Change-Id: I2749a06cded9fc3863d233713efda2674cf7f5e3
Report when INVALID_STATE returned.
This was used to debug monkey test errors.
Cleanup some log messages.
Improve "dumpsys media.aaudio"
Bug: 64310586
Test: CTS nativemedia/aaudio
Change-Id: Ifbcac4794cda22cccbacff6352243c0ef4589c53
Add logging to the loopback test.
Update state in the callback.
Implement AAudioStreamRecord::getFramesWritten().
Bug: 62781173
Bug: 64214193
Test: aaudio_loopback.cpp, look for STARTED state while running
Change-Id: Iba867d048dcfcafe6db1d095abe2766f1aabe608
Legacy streams could return EXCLUSIVE from getSharingMode()
if requested by caller. But that is not supported.
To avoid misleading developers, we force it to SHARED mode.
Bug: 63355841
Test: setprop aaudio.mmap_exclusive_policy 2 && write_sine -x -pn
Change-Id: I91c82b63293752c6aa2c4933cd2bfe8c6d41a5d3
but include the associated names in the global symbol export list, so
that apps that receive AAudioTesting.h outside of NDK can access the
symbols without dlsym().
Test: builds OK
Change-Id: If68f35145d68f359ebb7995ffcf9c9b8f9be6eb1
(cherry picked from commit 4257fd9aba)
Mixer was not advancing FIFO when underflowed so the client could not
detect the xrun.
Also underruns could cause the stream to drift in time relative to other
streams.
Bug: 64033855
Test: trigger underruns by sleeping in a callback
Change-Id: Ia038f5048ffbff3b82e9d86e6807483dfe6879d0
Also improve automatic loop gain control for latency testing.
Use ArgParser to parse command line options.
Bug: 38178592
Test: this is a test
Change-Id: Idfe8f25544a3e7c74ee15be008bf34e3a0741455
Use CLOCK_MONOTONIC instead of AAUDIO_CLOCK_MONOTONIC
Bug: 63915257
Test: Look at the generated autodocs.
Change-Id: I856da9ba4139833bcaef6873e87a3ef58e6ace69
ALways sleep a minimum time to avoid busy wait in real-time thread.
Account for wakeup jitter in threads on the other side of a FIFO.
Avoid race condition that caused a longer sleep than necessary.
Fix calculation of mFreeRunning for capture mode.
Also added systrace logging, which was used to debug this.
Bug: 63814792
Test: Run GStomper on Walleye with MMAP on, see bug
Change-Id: I7b20098580ff454365425bd21e43c17ade532a0a