getOtuput() was long replaced by getOutputForAttr() for the purpose of
querying an appropriate HAL output stream for a given playback use case.
It is now only used internally by AudioSystem to find an existing output
corresponding to a given stream type in limited cases.
This CL simplifies getOutput() by removing unused arguments and just
returning an output from already opened outputs.
This is in preparation of limiting access to audio policy binder calls
to what is strictly needed by apps.
Test: test main playback, capture and call use cases.
Change-Id: I137c5526aa7e82303b43948326c77ec798f432f5
Bug: 64038649
Test: Run cts in RoutingTest
Switch output device when playing music/video with MediaPlayer
Change-Id: I5b5c288e6557199b0a6986785f9335a18a80ab89
If client requests a fast track and this request is denied, then don't
allow notification period to exceed FMS_20. FMS_20 is the minimum task
wakeup period in ms for which CFS operates reliably. This reduces
glitching when an app uses a buffer size that is too small for the endpoint.
The theory is that if the app wanted a fast track but couldn't get it,
then at least wake it up as often as possible (while still not waking
up so often than CFS can't handle it).
Also clarify in the log when the denial is by client vs server.
Test: as described in bug
Bug: 63040475
Change-Id: I2c171bda7929a8f309c2286d868e09887680d234
Ringtone and call waiting tone for Ireland are not
following ITU-T specification.
This patch implements them as per ITU-T specification.
Bug: 68294204
Test: Build and test ringback tone for Ireland
Change-Id: I2cf3f425aec47b9dbc6ecf2ffb3aef44ca4f783c
If dual sim device has two SIM cards inserted,
in airplane mode it sets "gsm.operator.iso-country" prop
to a single comma, which prevents ToneGenerator to access
prop for "gsm.sim.operator.iso-country" - SIM provider
country code. When VoWifi is used to make a call,
incorrect ringback tone is being played (generic one),
instead if one being read from gsm.sim.operator.iso-country.
This patch fix this, and allows ToneGenerator to correctly
recognize SIM country code.
Bug: 65859291
Test: Check ringback tone during SIM2 VoWiFi in flight mode
Change-Id: Ibb57d38432f3d99f2eac568aec2a949af5e2a9cd
Bug: 65292224
- Audio policy manager should not use an unavailable device when an explicit
route is requested. This causes a device selection made by a client to
become sticky after device disconnection.
Bug: 64945845
- Remove spurious device change callback occuring after registering a
new client to audio server by creating a specific configuration event
for client registration.
- Do not keep strong references to device callback interfaces in
AudioTrack, AudioRecord and AudioSystem.
- Do not update selected device in AudioTrack and AudioRecord when
not active as the new device selection on the stream is because of other
clients activity which is not relevant to an inactive client.
Bug: 65693340
- Fix missing increment of SessionRoute ref count in getInputForAttr() for
MMAP inputs
Test: AAudio CTS tests
Change-Id: I2a01b02e8b064d352004f6065495fd99aee55745
Force 64 bit arithmetic to avoid integer overflow on 32 bit
platforms.
Test: CTS AudioTrackTest
Bug: 65536481
Change-Id: I774a7811fce08c7cbe59f0a062fd2c2d72220203
nbaio is an acronym for "non-blocking audio I/O", and nblog means
"non-blocking logger" so nblog does not belong with nbaio.
There are a lot of improvements planned for nblog, and having the
restructuring done will make it clearer as more files are added.
Test: builds OK
Change-Id: Ib28bada2566c1d64bdbe9f5d7a5ce40e080178ef
After cold start, running the test will cause failure. The reason is
that with cold start, the buffer is being processed faster than the
position callback.
Calling the callback earlier at the very start will fix this issue.
Bug: 63056426
Test: adb shell am instrument -e class 'android.media.cts.AudioTrack_ListenerTest#testAudioTrackCallback'
-w 'android.media.cts/android.support.test.runner.AndroidJUnitRunner'
Change-Id: I7416cecb2837fac4a966e832412948c357e7b8dc
The extended timestamp server and kernel location positions
need the proper client side delta offset for native AudioTrack API calls.
The client location position is unaffected along with the legacy timestamp.
Test: test_timestamp, Photos, kill audioserver
Bug: 65386236
Change-Id: Idd71b6a31e0e86a323d0e5e343a2836e34c08673
Added the conditions that determine the region for HK,
then support Hong Kong specific ring tone and busy tone.
Bug: 63120797
Test: Build and test ringback tone for Hong Kong
Change-Id: Ifc836321ca1ac1f670d4640305727f4ea3800716
Singapore use CEPT standard supervisory tones except
for busy and ringtone. The Singapore mapping will be
used if gsm.operator.iso-country == "sg".
Bug: 63120560
Test: Build and test ring back tone for Singapore
Change-Id: I86076b0799a741ad8c54968799e400622d223ccd
The change in "Australia Supervisory DIAL tone"
seems not following ITU-T specification.
This patch implements TONE_AUSTRALIA_DIAL as per ITU-T
specification.
Bug: 63120712
Test: Build and test ringback tone for Australia
Change-Id: I7409732e57cf8d39ac2248e7e3e10217e30a118e
Modified gb's SupervisoryTone
when the following ToneType is selected to cover
GB market/operators requirement.
- TONE_SUP_DIAL
- TONE_SUP_BUSY
- TONE_SUP_CONGESTION
Bug: 63121347
Test: Build and Test ringback tone for UK.
Change-Id: I248b1b27f4156de37fd07bc878be719e3f6d6b95
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
The cause of frequent "EffectModule 0xxx destructor called with unreleased
interface" messages was due to not releasing the effects when purging
stale effects.
The cause of "Effect handle 0xxx disconnected after thread destruction"
message was due to late binder call for disconnecting already purged
effect handle.
Also improved logging to communicate uuids of the effects causing
these issues.
Bug: 62267926
Test: no aforementioned warnings in the log when opening the Effects
panel in Play Music
Change-Id: I6ec6f60c46dc704226931fb59a641e4cd74c2fd1
(cherry picked from commit 424c4f5b76)
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
The cause of frequent "EffectModule 0xxx destructor called with unreleased
interface" messages was due to not releasing the effects when purging
stale effects.
The cause of "Effect handle 0xxx disconnected after thread destruction"
message was due to late binder call for disconnecting already purged
effect handle.
Also improved logging to communicate uuids of the effects causing
these issues.
Bug: 62267926
Test: no aforementioned warnings in the log when opening the Effects
panel in Play Music
Change-Id: I6ec6f60c46dc704226931fb59a641e4cd74c2fd1
This releaves reviewing burden from the frameworks/av owners.
Note that the lists of owners are inherited from the parent
directories thus the people listed in these files are owners
*in addition* to people listed in frameworks/av/OWNERS,
and frameworks/av/{media|services}/OWNERS.
Change-Id: I5e2db1c40cb807b906b2701fe446c874a8d19983
Test: not needed
Implement correct indication of client UID and PID to audio flinger
for AAudio MMAP streams in both exclusive mode and shared mode.
- Add start/stop client methods on MMAP streams used only when the MMAP
stream is in AAudio service and carries a mix of shared streams.
- Add "In Service'" indication from "client" side to AAudioServiceStreamMMAP
so that the behavior can be adapted accordingly.
- Modify logic on audio flinger side with regard to mmap tracks and
audio HAL stream activity:
- use same audio session for all clients on a same stream to match
audio policy logic to share same direct output stream for clients on same
session. This is also more consistent with current volume and effect
handling as all MMAP clients sharing the same output stream have the
same volume and use case.
- start/stop the HAL when the stream is started/stopped with the initial client
handle (returned when the stream is opened) but do not create a track.
AAudioService implementation will always send an additional start command before
first client starts and a stop command after last client stops,
in both shared and exclusive mode.
- start/stop a track only if the start/stop stream command is received
with a handle different from the initial handle.
- Allow more than one active client from the same UID on a MMAP input in audio policy.
Bug: 62950008
Test: verify playback and capture in mmap mode
Merged-In: I86151bbb637ff172d2fd5f813056eab13a7bcd3c
Change-Id: I86151bbb637ff172d2fd5f813056eab13a7bcd3c
Implement correct indication of client UID and PID to audio flinger
for AAudio MMAP streams in both exclusive mode and shared mode.
- Add start/stop client methods on MMAP streams used only when the MMAP
stream is in AAudio service and carries a mix of shared streams.
- Add "In Service'" indication from "client" side to AAudioServiceStreamMMAP
so that the behavior can be adapted accordingly.
- Modify logic on audio flinger side with regard to mmap tracks and
audio HAL stream activity:
- use same audio session for all clients on a same stream to match
audio policy logic to share same direct output stream for clients on same
session. This is also more consistent with current volume and effect
handling as all MMAP clients sharing the same output stream have the
same volume and use case.
- start/stop the HAL when the stream is started/stopped with the initial client
handle (returned when the stream is opened) but do not create a track.
AAudioService implementation will always send an additional start command before
first client starts and a stop command after last client stops,
in both shared and exclusive mode.
- start/stop a track only if the start/stop stream command is received
with a handle different from the initial handle.
- Allow more than one active client from the same UID on a MMAP input in audio policy.
Bug: 62950008
Test: verify playback and capture in mmap mode
Change-Id: I86151bbb637ff172d2fd5f813056eab13a7bcd3c
Bug: 62090113
Test: run AAudio test and verify a valid device is reported just
after opening playback or capture streams in legacy mode.
Merged-In: Ic8be42e1735690eb00c811ef0cb8b5abb36172d6
Change-Id: Ic8be42e1735690eb00c811ef0cb8b5abb36172d6
Bug: 62090113
Test: run AAudio test and verify a valid device is reported just
after opening playback or capture streams in legacy mode.
Change-Id: Ic8be42e1735690eb00c811ef0cb8b5abb36172d6
Also for AudioRecord
Bug: 62692443
Test: write_sine.cpp
Change-Id: I5b281476af4703798129df66584d813b9a8db8bb
Signed-off-by: Phil Burk <philburk@google.com>
Make AudioStreamInternal derive from PlayerBase to
provide playback and volume control via IPlayer interface.
Bug: 62027849
Test: verify aaudio playback in MMAP mode and registration of aaudio
players in AudioService when active
Change-Id: Ia0878d46637c0a954d8a6259868a2d3bccf19119
Pass uid of recording session along with other existing information
in the recording monitoring callback.
Define new structure, record_client_info, to group uid (new),
session id (existing) and source (existing) and simplify
method signatures and marshalling code.
Test: run cts -m CtsMediaTestCases -t android.media.cts.AudioRecordingConfigurationTest#testAudioManagerGetActiveRecordConfigurations
Bug 62579636
Change-Id: I18f66d7e55640a21f31021416a12a3e8094c3690
Make AudioStreamTrack derive from PlayerTrackBase to
provide playback and volume control via IPLayer interface.
Bug: 62027849
Test: verify aaudio playback regressions and registration of aaudio
players in AudioService
Change-Id: I5c04110f1554233eae3f1bc357a64a584d7303d1
Generalized the IPlayer implementation done for OpenSL ES
so that it can be used by other native audio players
Created two classes:
- PlayerBase implementing the interfacin native AudioManager and
IPlayer methods
- TrackPlayerBase, a derived class specialized for AudioTrack.
Bug: 62027849
Test: verify regressions with OpenSL ES buffer queue player
Change-Id: If5ad21a3c1a243fba0b312001c5034102e6d6672
AudioTrack needs to query latency from the output descriptor each
time it uses mAfLatency to calculate timestamp or return the track
latency. Until now, the output descriptor latency was queried and
stored when a track is created. On a device switch, IO descriptors
table saved in AudioSystem is updated to reflected the latest
latency values. Unless a device switch lead to a track teardown,
AudioTrack will be unaware of the latest latency value. Therefore
explicitly check the latest mAfLatency value on each getTimeStamp
call.
Test: Podkicker 2.2x, Photos 240fps and BT
Bug: 35075600
authored-by: Aniket Kumar Lata <alata@codeaurora.org>
Change-Id: I06282182364703574a7d66d2b5cd1301679dfade
Implement device switch detection on legacy path (AudioTrack and
AudioRecord) based on audio routing callbacks forcing the stream state
to disconnected.
Bug: 33355262
Bug: 62090113
Test: tested with write_sine and input_monitor command line tools.
Change-Id: I9e0421fee233964b1bf318acb640569196a00f13
1) Limit number of VolumeShapers that can be created.
a) 16 system VolumeShapers
b) 16 application/client VolumeShapers
2) Return proper volume before VolumeShaper is started.
3) Consistent xOffset definition used internally:
a) this is now always the position on the volumeshaper curve
which can go backwards if in REVERSE.
b) normalized time is always forward going and is scaled
to 0.f and 1.f depending on progress relative to
the curve's duration.
4) Fix replace method.
5) Add comments.
Test: Use updated CTS VolumeShaperTest
Bug: 37536598
Change-Id: I837ab2a481adc0abbd3f1338bfe2cb79831b11fa
Functions in headers that are not static inline will cause duplicate
symbol errors when linking if the header is ever included twice
into different compilation units of the same module. It also causes
-Wunused-function warnings if they are not used in the cpp file, which
were hidden by the use of -isystem frameworks/av/include.
Bug: 31751828
Test: m -j checkbuild
Change-Id: I36f258bb4f5c3df54e874280beab344e63c519d5
(cherry picked from commit 413adafb04)
Functions in headers that are not static inline will cause duplicate
symbol errors when linking if the header is ever included twice
into different compilation units of the same module. It also causes
-Wunused-function warnings if they are not used in the cpp file, which
were hidden by the use of -isystem frameworks/av/include.
Bug: 31751828
Test: m -j checkbuild
Change-Id: I36f258bb4f5c3df54e874280beab344e63c519d5
The libc_malloc_debug_backtrace includes the log functions so there
is no need to also add the libc log library.
Test: Built and booted a bullhead device.
Change-Id: I00457ad0c321b385e68232ee87575588a8188db7
Consider whether VolumeShaper has been started or not when
restoring (position). If the VolumeShaper hasn't been started
we restore in that state. If it has been started already,
we advance to the end assuming the duration has been played out.
Test: CTS and headset / kill audioserver
Bug: 37536598
Change-Id: I4b55dca6f6a859563fd20bad4c8f67d2c92321c0
This will help debuging errors linked the associated bug.
Test: compile
Bug: 36509278
Change-Id: I3034a8a40d20cee15dc394baf0743be3d996a155
Signed-off-by: Kevin Rocard <krocard@google.com>
Make the binder opcode names match the method names
Test: builds OK, this does not change behavior
Change-Id: I7c56ddd1efabc81b5d0ab2d1979ba1001ec76994
This is needed for AAudioStream_getFramesPerBurst(),
which is needed for callbacks to work correctly.
Bug: 34716038
Bug: 36489240
Test: CTS test_aaudio.cpp
Change-Id: I0e3f3f18a22bf6da8c288f0d2caec0bff0153f2f
Signed-off-by: Phil Burk <philburk@google.com>
Include mFrameCount in shared memory corrupt error log.
Fix typo in log for primary audio interface.
Include the new server frame count in logs for fast tracks.
Always log when fast is successful for output tracks, as it helpful
(was already there for input).
Cleanup dumpsys for threads.
Bug: 37153050
Test: builds OK, and logs contain more information
Change-Id: I2b5b4d700e8eb7c261a3125fb03ddc00bf08537e
(cherry picked from commit 1bfe09a0b1)
Include mFrameCount in shared memory corrupt error log.
Fix typo in log for primary audio interface.
Include the new server frame count in logs for fast tracks.
Always log when fast is successful for output tracks, as it helpful
(was already there for input).
Cleanup dumpsys for threads.
Test: builds OK, and logs contain more information
Change-Id: I2b5b4d700e8eb7c261a3125fb03ddc00bf08537e
This is needed for AAudioStream_getFramesPerBurst()
Bug: 34716038
Test: CTS test_aaudio.cpp
Change-Id: I0e3f3f18a22bf6da8c288f0d2caec0bff0153f2f
Signed-off-by: Phil Burk <philburk@google.com>
Changed type of ToneGenerator::WaveGenerator constructor parameter
samplingRate from unsigned short to uint32_t to permit output
sample rates such as 96000 Hz.
Bug: 33969539
Test: dialer tones work when output sink operates at 96000 Hz
Change-Id: I5551409c467a4fd98ea4d5c9703b120a526a443e
include/camera -> camera/include/camera
include/media/audiohal -> media/libaudiohal/include
include/media/AudioResampler*.h -> media/libaudioprocessing/include
include/media/Audio*.h,IAudio*.h,IEffect*.h,ToneGenerator.h -> media/libaudioclient/include
include/media/EffectsFactoryApi.h -> media/libeffects/include
include/media/stagefright -> media/libstagefright/include
include/media/nbaio -> media/libnbaio/include
include/media/<rest of files> -> media/libmedia/include
include/cpustats -> media/libcpustats/include/cpustats
Added symlinks from old location to new ones
Bug: 33241851
Test: VNDK linked modules will need to add explicit lib dep.
All other modules should compile the same
Change-Id: I0ecf754a2132640ae781a3cc31428fb8c0bd1669
The VolumeShaper is used to apply a volume
envelope to an AudioTrack or a MediaPlayer.
Test: CTS
Bug: 30920125
Bug: 31015569
Change-Id: I42e2f13bd6879299dc780e60d143c2d465483a44
Protect the Audio Policy Manager by adding extra checks
for data.readCString() strings when parsing / decoding
a Binder transaction.
Also:
* Moved audio_is_output_device() / audio_is_input_device() checks
inside handleDeviceConfigChange()
from the AudioPolicyInterface to the AudioPolicyManager
* Removed similar redundant checks inside
AudioPolicyService::setDeviceConnectionState()
Test: code compilation
Change-Id: Ib32a28ba2669b73aaf32b31bb18f41c8dd7d2605
* Since system/bt depends on this library, it needs to be converted to
Android.bp before the conversion in system/bt can be continued.
* Majority of work is done by androidmk Android.mk > Android.bp
* Fixed sanitize arguements
* Removed LOCAL_EXPORT_C_INCLUDE_DIRS as Android.bp only supports
exporting sub-directories of current Android.bp file
* Removed frameworks/av/media/libmedia/aidl include path as it no longer
exists and Android.mk failed to check that
* Removed include path for audio-utils as it is being automatically
included when we link against libaudioutils
* Android.mk file must be deleted as a library of the same name can only
be defined once in either Android.bp or Android.mk
* A library defined in Android.bp can be used by either Android.bp or
Android.mk files. However, a library defined in Android.mk cannot be
used by Android.bp file. Therefore, for system/bt to link against this
library in the Android.bp, this library must be converted first
Bug: 32958753
Test: Code compilation, no user visible effect
Change-Id: I2ae87a1151ed4235122c7774096c2dbff8b1fc62
* Added new call handleDeviceConfigChange() to the Media Framework.
That call can be used when there are device configuration changes
(e.g., Bluetooth A2DP codec configuration has changed).
* Added new method AudioPolicyManager::handleDeviceConfigChange().
That method toggles the UNAVAILABLE/AVAILABLE connection state of the
device, so it can be reconfigured as appropriate - e.g., the audio
feeding parameters can be updated.
* Fix ALOGVV compilation errors when extra logging is enabled.
Test: A2DP streaming to headsets
Bug: 30958229
Change-Id: I388abbbb3ec4d1a003b441cb0c77e00d80cad668
In case of error during openRecord_l(), there is a possibility
that a newly created AudioRecordThread is resumed by requestExit()
just after entering the Thread class _threadLoop() but before
entering the class threadLoop(). In this case, processAudioBuffer()
is executed once with mCblk == 0 and we assert.
Test: test case at bug
Bug: 29993798
Change-Id: I15d4f138218f6f01a020c4fc568a5b4831cb92a7
This will allow to track activity at the track level instead of
at audio session level as only possible with current implementation.
AudioTracks and AudioRecords will receive a unique audio port ID the
first time they register to audio policy with
getOutputForAttr()/getInputForAttr() and keep this ID for their
lifetime.
This CL is the first partial change and just updates the
audio policy and audio flinger APIs used at track creation time.
Test: basic regression test of audio playback and capture use cases
Change-Id: I8d612e67738e120494f61e3f7c60bfd0b2c6a329
In case of error during openRecord_l(), there is a possibility
that a newly created AudioRecordThread is resumed by requestExit()
just after entering the Thread class _threadLoop() but before
entering the class threadLoop(). In this case, processAudioBuffer()
is executed once with mCblk == 0 and we assert.
Test: test case at bug
Bug: 29993798
Change-Id: I15d4f138218f6f01a020c4fc568a5b4831cb92a7
This makes it so audioserver doesn't need to link against the entire libmedia,
which has dependencies on camera, ICU, OpenGL and other things that aren't
needed for audio.
Test: build/boot
Change-Id: I99ba1a3dc3b33ca9b3abd98e7519dbf228ee62af
This makes it so audioserver doesn't need to link against the entire libmedia,
which has dependencies on camera, ICU, OpenGL and other things that aren't
needed for audio.
Test: build/boot
Change-Id: I99ba1a3dc3b33ca9b3abd98e7519dbf228ee62af