Chromebook sometimes runs 32 and 64-bit code together.
That caused messages between the code to be rejected because the
struct sizes did not match.
So we used alignas(8) to force members to 8 byte boundaries.
Bug: 155901581
Test: Launch OboeTester
Test: Tap TEST OUTPUT
Test: Tap OPEN and START
Test: You should get "MMAP YES" if MMAP is supported by the device.
Change-Id: I0cd6a59a974888ef17b06b38fa78f032d602cd57
An app (B) that asks for an exclusive stream can steal
an exclusive stream from an earlier app (A).
App B will be given the MMAP resource as a SHARED stream.
The stream for app A will be disconnected and released
by the service.
If app A reopens a stream then it will get a SHARED
stream.
The order of the opening of the streams is controlled by using a
recursive_mutex in AAudioService::openStream().
Bug: 129846760
Test: media/libaaudio/tests/test_steal_exclusive.cpp
Test: also
Test: Launch AudioTroubleMaker. It should say "EXCLUSIVE".
Test: Press Home button.
Test: Siren sound from AudioTroubleMaker should continue.
Test: Launch OboeTester
Test: TEST OUTPUT, then Open, Start
Test: You should get an MMAP SHARED stream on Pixel.
Test: Go back to AudioTroubleMaker. It should say "SHARED".
Change-Id: I7f8339d8ed62546520a9b46ed398418b41ca2832
This test starts an exclusive stream.
Then a few seconds later it starts a second exclusive stream.
The first stream should get stolen and they should both end up
as SHARED streams.
See comment at start of test_steal_exclusive.cpp for more information.
Bug: 129846760
Test: this is a test
Test: adb shell test_steal_exclusive
Change-Id: Idff0c394ccee2310dd2d38e7715f823e50955e73
Add missing "Added in API level 29 annotation" to
AAUDIO_INPUT_PRESET_VOICE_PERFORMANCE input preset.
Bug: 138776432
Test: make
Change-Id: I2362ebd1520c95e81dfe8ea43105ea7b39cc04eb
Old assert was for debugging. No longer needed.
Caused a CTS failure in MediaMetrics logging.
Bug: 155188361
Test: atest CtsNativeMediaAAudioTestCases
Test: adb shell dumpsys media.metrics
Change-Id: I592937d6a0683faf6835d3f0d5a982d02f59e7a9
And also to AudioRecord.
Then log the callerName using MediaMetrics from the destructor.
This can be used to tell whether AAudio or OpenSL ES
or Java created the object.
Bug: 154543374
Test: adb shell dumpsys media.metrics --clear
Test: Run an app that uses audio.
Test: adb shell dumpsys media.metrics
Test: Look for "callerName" in the dump.
Change-Id: I000346e72f581d2e40ef4fd0410b579d2a1224e2
Log events from service.
Log start, stop, disconnect and other events.
Log underruns and bufferSize.
Bug: 154543374
Test: adb shell dumpsys media.metrics --clear
Test: run an app that uses MMAP, like OboeTester
Test: adb shell dumpsys media.metrics
Test: Expect to see lots of "audio.stream" events.
Change-Id: I690e5226b695d53d038d644f4438c759e08f9fbb
Call various functions after calling AAudioStream_release().
Bug: 154274446
Bug: 154274027
Test: this is a test
Change-Id: Ia0938362502b15a4ae5608f0619e0bc5ce78ca22
Free the AudioEndpoint and check for nullptr to
prevent accessing shared memory that had been freed.
This is to protect against calls to the stream after
AAudioStream_release() has been called.
Bug: 154274446
Bug: 154274027
Test: libaaudio/tests/test_various.cpp
Change-Id: I194d502fd48c4d31602ffce76aca6b28753ad7d2
This can prevent some loud noises during unit tests.
Also use std::unique_ptr
Bug: 154342174
Test: libaaudio/tests/test_various.cpp
Change-Id: I1c1dc0f4a6a29cf7d7a656392a81a325847de22d
Do not systematically request a stream disconnect upon
EVENT_NEW_IAUDIOTRACK received AudioTrack but only if the new
audio Track properties have changed in such a way that the initial
contract is broken.
Bug: 139763500
Test: OboeTester TEST DISCONNECT
Test: OboeTester TEST OUTPUT while enabling/disabling Live Caption
Change-Id: I3b43275a888e23471fcd1ce20725f5731a77a255
The old minimum was zero, which minimized latency
but was probably too aggressive for some devices.
It is better to avoid glitches.
Because of other changes in AAudio MMAP, this will
have the same latency as earlier version,
but better immunity from glitches.
Bug: 153589709
Test: launch OboeTester
Test: tap TEST OUTPUT
Test: tap OPEN and START
Test: notice that actual buffer size will be 1 * burstSize
Change-Id: Ie53352a0589c710be11f74e995bd12be4f7c45a8
In aaudio, when adding tracks to mixed stream, it is needed to update
audio attributes to HAL whenever the tracks are added or removed.
Currently, only the audio attributes used to open the stream will be
sent to the HAL. In that case, adding audio attributes of the clients
when starting the stream can help solve the problem. In audio flinger,
the client's audio attributes will be used to create MmapTrack.
Test: play multiple aaudio tracks, add log
Bug: 77279923
Change-Id: Ic1c536049e194a2bb7513425ee4828d52769d27f
Set the size of the callback buffer based on the device format
instead of the app format.
Bug: 149249791
Test: atest CtsNativeMediaAAudioTestCases
Change-Id: I0dc5724109a802eea15100782c18986a64e6acd2
Bug: 80192689
Test: adb logcat | grep MMAP
Test: run OboeTester, TEST OUTPUT, perfMode: None, OPEN
Test: should see "MMAP not available because
Test: AAUDIO_PERFORMANCE_MODE_LOW_LATENCY not used"
Change-Id: I164902abcfafb53a34685b9ef9ec5346842e1dda
Binder code was calling readInt32() but not checking the return code.
Bug: 139473816
Test: see bug for proof of concept
Test: atest CtsNativeMediaAAudioTestCases
Change-Id: I9246382b657c2a1213d27c66fc006578553f7b1e
This was added to be able to test on O, but the proper change for O
compatibility would be to say `sdk_version: "26"` and let the build
system adjust everything that needs changing.
Remove these so we can remove `pack_relocations` entirely.
Bug: http://b/147452927
Test: treehugger
Change-Id: I4096209180c67128499e0850f2f21762e520b99a
Split close into close and release phases.
Release() will release hardware and service resources.
Close() will delete the stream object.
This allows us to defer the deletion and avoid race conditions.
The CLOSING state is used to indicate that a stream has been released.
Added some test cases to test_various.cpp.
A lone call to close() will automatically call release() so we should
have good code coverage for testing.
Bug: 136288001
Test: adb shell test_various
Test: atest CtsNativeMediaAAudioTestCases
Change-Id: Ia648838f30c521ba101f55259dbcd4594c1263cd
Add missing symbols for new APIs added to control if an input stream
is privacy sensitive or not.
Also add tests for these new APIs.
Bug: 137850106
Test: test_attributes
Change-Id: Iab6e37a312dd295f705a3dfb69acddd131dc9142
Integrate with aaudio_loopback.
Eventually this could be used in the CTS Verifier for latency testing.
Pass std:string back from analyze().
General cleanup.
Test: adb shell aaudio_loopback
Test: check the latency.msec value
Change-Id: Ibf7128d78d47d91e0bf314344ca450d7f70b3ceb
Player type AAudio are always initialized with AUDIO_USAGE_MEDIA. Added
fix to initialize with assigned usage.
Bug: 143578354
Test: ran native application with usage of AUDIO_USAGE_NOTIFICATION
Test: atest CtsNativeMediaAAudioTestCases
Change-Id: I170e0b55d7f90b59d9b5129b22f4a9080957994b
Merged-In: I170e0b55d7f90b59d9b5129b22f4a9080957994b
Player type AAudio are always initialized with AUDIO_USAGE_MEDIA. Added
fix to initialize with assigned usage.
Bug: 143578354
Test: ran native application with usage of AUDIO_USAGE_NOTIFICATION
Test: atest CtsNativeMediaAAudioTestCases
Change-Id: I170e0b55d7f90b59d9b5129b22f4a9080957994b
Add the possibility for apps to indicate that their
capture use case is private and that a privileged Assistant
should not be able to capture concurrently.
This allows to override the default behavior tied to the audio
source (e.g VOICE_COMMUNICATION is private by default but
UNPROCESSED is not).
- Add AAudio API to set and get privacy sensitive mode on input stream
- Add MediaRecorder API to set and get privacy sensitive mode
- Modify AudioSource constructor to accept audio attributes instead of an
audio source to specify the use case.
- Modify audio policy concurrent capture logic to use audio attributes
flag instead of audio source to decide of a capture client has
requested privacy mode or not.
Bug: 137850106
Test: CTS AudioRecordTest and MediaRecorderTest, manual audio smoke tests
Change-Id: I250ea5da4c1da809ceac0da22ae9bee15b937001
Used built in arithmetic overflow checking function in areas where integer overflow sanitizer exposed bugs with native test test_atomic_fifo.
Bug: 143307218
Test: Ran the following native tests:
test_atomic_fifo
test_aaudio_recovery
test_aaudio_marshalling
test_n_streams
test_bad_disconnect
test_various
test_session_id
test_aaudio_monkey
test_attributes
test_interference
test_flowgraph
test_return_stop
test_stop_hang
test_full_queue
test_histogram
Ran the following Cts tests:
CtsNativeMediaAAudioTestCases
Change-Id: Ie20ffc1a535dec22d81ec27918e2d3eadda21be2
Turned on sanitizer flags for integer overflow and bound checking for libaaudio and libaaudio_internal.
Bug: 143307218
Test: Ran the following native tests:
test_aaudio_recovery
test_aaudio_marshalling
test_n_streams
test_bad_disconnect
test_various
test_session_id
test_aaudio_monkey
test_attributes
test_interference
test_atomic_fifo
test_flowgraph
test_return_stop
test_stop_hang
test_full_queue
test_histogram
Ran the following Cts tests:
CtsNativeMediaAAudioTestCases
CtsMediaTestCases
CtsMediaHostTestCases
Change-Id: Ie6af19a5b9618f89f5416bc253ed69351911a359