109 Commits

Author SHA1 Message Date
Dima Zavin
290029d19a audio: update for audio/audio_policy header names/locations
Change-Id: I36c49352eee57559403cd1597f56a8485a360289
Signed-off-by: Dima Zavin <dima@android.com>
2011-06-13 18:16:26 -07:00
Glenn Kasten
6af763bec7 Remove dead code related to gettid
The gettid system call is always available now.

Change-Id: Ib78b41781eda182dc8605daf456bbea7ff7c2dc0
2011-06-03 16:12:37 -07:00
Jean-Michel Trivi
5439223b56 Use channel mask instead of channel count for track creation
Record and playback objects (resp AudioRecord and AudioTrack)
are created using a channel mask, but this information is lost
in the mixer because only the channel count is known to
AudioFlinger. A channel count can always be derived from a
channel mask.

The change consists in:
- disambiguiting variable names for channel masks and counts
- passing the mask information from the client to AudioFlinger
 and the mixer.
- when using the DIRECT ouput, only verifying the format of
 the track is compatible with the output's for PCM.

Change-Id: I50d87bfb7d7afcabdf5f12d4ab75ef3a54132c0e
2011-06-01 10:55:29 -07:00
Eric Laurent
8f18cf5574 Removed interface to load audio effects libraries
Removed unused functions allowing dynamic loading of audio effects libraries
from effects factory API.

Change-Id: I06cc5a51dc10aca87c7a8687bbb874babd711eca
2011-05-27 17:51:52 -07:00
Eric Laurent
0fb66c2b83 New effect library API
Moved and renamed media/EffectApi.h to hardware/audio_effect.h
Modified the effect library API to expose a library info structure
containing an interface functions table.
Also removed enums for audio channels, audio format and devices
from effect API and use values from system/audio.h instead.

Modified effects factory to support new library interface format and
load libraries and efffects listed in audio_effects.conf file.
The file audio_effects.conf is first loaded from /vendor/etc and
then from /system/etc/audio_effects.conf if not found.

Modified existing effect libraries to implement the new library interface.

Change-Id: Ie52351e071b6d352fa2fbc06c3846686f8c45df9
2011-05-27 15:15:00 -07:00
Glenn Kasten
bdd8a16282 Merge "HAVE_ANDROID_OS AUDIOFLINGER_SECURITY_ENABLED dead" 2011-05-23 09:06:03 -07:00
Eric Laurent
6ebbc07740 Merge "Fix audio effect framework issues" 2011-05-13 10:24:24 -07:00
Eric Laurent
90681d6ad2 Fix audio effect framework issues
Fix two issues in audio effect framework reported by partners.

1 - Fixed duplicated audio buffer sent to effect process function when
pausing a track.
Modified Effectchain::process_l() function to clear the effect chain
input buffer before calling the effect process functions when no track
is active on the session. Previous code was clearing the buffer after
calling the process functions and  when transitioning from active
to inactive, the last processed buffer was passed again once to effect
process function before being cleared.

2 - Fixed potential mutex cross deadlock when disconnecting an effect
while playback is active. This is because EffectChain::process_l()
was calling PlaybackThread::hasAudioSession() thus creating an inversion
in the mutex lock order (EffectChain mutex locked before ThreadBase mutex).
The fix consists in removing the call to hasAudioSession() from process_l()
and requires each effect chain to keep count of the number of audio tracks
attached to it (previously only the active tracks were accounted for).

Change-Id: Iee4246694ea8c7a66c012120c629d72dd38f9c35
2011-05-13 08:34:45 -07:00
Dima Zavin
34bb419e59 update for new audio.h header location
Change-Id: Ic4c62c4037800802427eb7d3c7f5eb8b25d18876
Signed-off-by: Dima Zavin <dima@android.com>
2011-05-12 14:09:57 -07:00
Glenn Kasten
f0e95696c0 HAVE_ANDROID_OS AUDIOFLINGER_SECURITY_ENABLED dead
Remove dead code from the days when Android ran in emulator.

Change-Id: Ibadbbde0538239ad9b2811a3a2e8f8a6d3b6389c
2011-05-05 09:15:56 -07:00
Dima Zavin
2986f5bed3 audioflinger: don't do work in constructor, instead do it in onFirstRef
Change-Id: I22d9e01821816c3beb52b014330386c7fd2f0411
Signed-off-by: Dima Zavin <dima@android.com>
2011-04-27 16:20:22 -07:00
Dima Zavin
31f18889a2 audioflinger: enumerate all the possible audio interfaces
Keep track of the primary interface that handles the master volume,
etc.

Change-Id: Ib0701fccff8d8783a99035a241ab7c8ec75c00ac
Signed-off-by: Dima Zavin <dima@android.com>
2011-04-27 16:20:22 -07:00
Dima Zavin
24fc2fb1c5 audio/media: convert to using the audio HAL and new audio defs
Change-Id: Ibc637918637329e4f2b62f4ac7781102fbc269f5
Signed-off-by: Dima Zavin <dima@android.com>
2011-04-27 13:10:10 -07:00
Dima Zavin
5e20a3dd44 audioflinger: move legacy audio hw/policy out to libhardware_legacy
Change-Id: I4adcec73d3c08bcbe15bb19e1ba2ff18b195af45
Signed-off-by: Dima Zavin <dima@android.com>
2011-04-27 10:48:38 -07:00
Eric Laurent
17a650c111 am 48dca4de: am 969357e3: am 223995dc: Fix issue 4335692: HDMI media volume
* commit '48dca4de70890d324b5830a58bb9fa273164151a':
  Fix issue 4335692: HDMI media volume
2011-04-26 12:44:53 -07:00
Eric Laurent
48dca4de70 am 969357e3: am 223995dc: Fix issue 4335692: HDMI media volume
* commit '969357e31c93e168e7a4cb3b41c33a6ec26f4a26':
  Fix issue 4335692: HDMI media volume
2011-04-26 01:14:07 -07:00
Eric Laurent
223995dcf2 Fix issue 4335692: HDMI media volume
Forced music stream volume to max when not muted and output device is HDMI.

Change-Id: Ibd287cea8ae1d3f36fea6651a113bd5cf2dbad13
2011-04-25 13:34:51 -07:00
Brad Fitzpatrick
a944e591fc am 07c25b65: am 4430670f: am ca7ad44a: Merge "audioflinger: Enable ARMv5TE optimized resampler"
* commit '07c25b651216daac884bd503c02b788418165b50':
  audioflinger: Enable ARMv5TE optimized resampler
2011-04-11 17:32:37 -07:00
Brad Fitzpatrick
07c25b6512 am 4430670f: am ca7ad44a: Merge "audioflinger: Enable ARMv5TE optimized resampler"
* commit '4430670f48f75661293371dab8db55865f5f56e0':
  audioflinger: Enable ARMv5TE optimized resampler
2011-04-11 17:27:12 -07:00
Jim Huang
592a6d9768 audioflinger: Enable ARMv5TE optimized resampler
Previously, the optimized asm option is only enabled when
__ARM_ARCH_5E__ is defined, which is assigned in armv5te.mk
rather than armv7-a series targets.  This patch checks the ARM CPU
feature about half-word multiply instructions to enable ARMv5TE
resampler optimization routines properly.

Change-Id: I4c5a5d8c932416f23bedb0b389db958349f21ea4
2011-04-07 21:08:39 +08:00
Glenn Kasten
85b65f2008 Merge "Miscellaneous code cleanup in audio framework" 2011-04-06 13:03:11 -07:00
Glenn Kasten
ed0079dddd Miscellaneous code cleanup in audio framework
Changes:
 - Move declaration of kClassPathName to top of file so it can be used
   in more than one place, instead of "android/media/AudioSystem".
 - Make private methods static.
 - Add comment to stream_type, audio_mode, force_use types that they must match
   values in AudioSystem.java.
 - Add comment about unused types mp3_sub_format and vorbis_sub_format.
 - Fix typos.
 - Use @ in javadoc comments.
 - Delete dead APIs setMode, getMode, setRouting, getRouting in AudioSystem.java
   (they are all hidden, deprecated, and unused by rest of framework)
 - Delete unused private log method.
 - Fix pathname for android_media_AudioSystem.cpp.
 - Improve code formatting for space after == and !=.
 - Add logging of delta for changing audio policy manager ref count.

Change-Id: I18037c7beb8ab76d1fda08c11e589f6e591d36e1
2011-04-06 10:24:18 -07:00
Eric Laurent
ae29b7632e New fix for issue 4111672: control block flags
The first fix (commit 913af0b4) is problematic because it makes threads
in mediaserver process block on the cblk mutex. This is not permitted
as it can cause audio to skip or worse have a malicious application
prevent all audio playback by keeping the mutex locked.

The fix consists in using atomic operations when modifying the control
block flags.

Also fixed audio_track_cblk_t::framesReady() so that it doesn't block
when called from AudioFlinger (only applies when a loop is active).

Change-Id: Ibf0abb562ced3e9f64118afdd5036854bb959428
2011-04-05 12:05:41 -07:00
Eric Laurent
913af0b48f Fix issue 4111672: AudioTrack control block flags
Make sure that all read/modify/write operations on the AudioTrack
and AudioRecord control block flags field are protected by the
control block's mutex.

Also fix potential infinite loop in AudioTrack::write() if the
written size is not a multiple of frame size.

Change-Id: Ib3d557eb45dcc3abeb32c9aa56058e2873afee27
2011-03-18 08:56:45 -07:00
Eric Laurent
257b2d0b80 Improvement for issue 3489986: BT SCO volume
This change makes sure that the VOICE_CALL stream volume tracks
the BLUETOOTH_SCO stream volume when SCO audio is enabled.
The down link audio volume now reflects what is being displayed
when pressing volume hard keys on the device while in a video chat
with a BT SCO headset.

Volume settings on the headset and the device are still independent as
we do not support handsfree profile yet.

Change-Id: Ie0d2714730ea359b9318b9cbe6f0b2557ef0f976
2011-03-15 14:26:03 -07:00
Gloria Wang
396f6de660 Merge "- To track the usage of all audio output devices - To track the currently used audio device - The devices are separated as speaker and other audio devices - Provide the collected data to battery application through pullBatteryData()" 2011-03-02 19:51:04 -08:00
Gloria Wang
9b3f1521b5 - To track the usage of all audio output devices
- To track the currently used audio device
- The devices are separated as speaker and other audio devices
- Provide the collected data to battery application through pullBatteryData()

Change-Id: I374c755266b5ac6b1c6c630400f4daf901ea8acc
2011-03-02 16:53:24 -08:00
Eric Laurent
1254169260 Merge "Fix issue 3388775." 2011-03-02 15:19:38 -08:00
Eric Laurent
42b3de5833 Merge "Fix issue 3479042." 2011-03-01 11:46:15 -08:00
Eric Laurent
bbc9fd3aca Fix issue 3388775.
Do not select A2DP output for media strategy when it is suspended because
BT SCO is active. Media audio will be routed to speakers or SCO HS
(depending on phone state and activity on stream VOICE_CALL) which is less
confusing than not hearing anything while music progress bar is moving.

Change-Id: Iff8cc1ea9bf9bde0b33035c4d91398db0934b836
2011-03-01 11:42:43 -08:00
Eric Laurent
4bb21c496b Fix issue 3479042.
The problem is that when an AudioRecord using the resampler is restarted,
the resampler state is not reset (as there is no reset function in the resampler).
The consequence is that the first time the record thread loop runs, it calls the resampler
which consumes the remaining data in the input buffer and when this buffer is released
the input index is incremented over the limit.

The fix consists in implementing a reset function in the resampler.

A similar problem was also present for playback but unoticed because the track buffer is always
drained by the mixer when a track stops. The only problem for playback was that the initial
phase fraction was wrong when restarting a track after stop (it was correct after a pause).

Change-Id: Ifc2585d685f4402d29f4afc63f6efd1d69265de3
2011-02-28 16:52:51 -08:00
Jean-Michel Trivi
191ff092b8 Fix bug 3376700 Volume too loud at lowest setting
Change volume attenuation curve to provide more attenuation at
 low volume settings, and finer steps at high volume.
See bug entry for link to doc with curve values.

Change-Id: I750548b2161a4c550ef982ba793156e4518119e8
2011-02-27 16:41:21 -08:00
Eric Laurent
d0545f5334 Fix issue 3400751.
Add a delay before restoring output path when a notification ends so that
short sounds can be heard on proper device before the path is actualy switched.

Change-Id: I1d2dd8e7e28e15fbcab344256f88499b26297372
2011-02-11 14:53:23 -08:00
Eric Laurent
eab7b0bbb4 Merge "Fix issue 3425342." 2011-02-11 14:48:20 -08:00
Eric Laurent
ee5d4b8fc4 Fix issue 3425342.
Change the device selection order as follows to enable easier use of
A2DP while the device is docked:
1 - wired Headset
2 - A2DP Headset
3 - SPDIF/HDMI
4 - Dock

Also do not limit notifications volume when on dock.

Change-Id: I55ea6bea9f2d9ff284b54023e541b2788d0f1eb8
2011-02-11 14:42:13 -08:00
Glenn Kasten
8b4b97a14a Bug 3352047 Wrong message when adjusting volume
Add hidden AudioManager.getDevicesForStream and output device codes.

Change-Id: I4d1c1d3b6a077cd117720817d1f733dda557b947
2011-02-10 14:37:42 -08:00
Brad Fitzpatrick
987cc804bd am be806fe8: am cc8f87e9: am f664d6f9: am b083d3b8: Merge "Initialize resampling buffer per track."
* commit 'be806fe8c1c7bb3ae70ae27dce41d672410af26a':
  Initialize resampling buffer per track.
2011-02-07 13:44:12 -08:00
Glenn Kasten
7e54397b8f Merge "Bug 3366668 Use BinderService template" 2011-02-04 14:00:17 -08:00
Brad Fitzpatrick
be806fe8c1 am cc8f87e9: am f664d6f9: am b083d3b8: Merge "Initialize resampling buffer per track."
* commit 'cc8f87e9410dd4de9a2fda4738429e6c6087c789':
  Initialize resampling buffer per track.
2011-02-04 10:32:50 -08:00
Brad Fitzpatrick
f664d6f916 am b083d3b8: Merge "Initialize resampling buffer per track."
* commit 'b083d3b816378ef3b9dceb33b2c2e20510b2632b':
  Initialize resampling buffer per track.
2011-02-04 10:27:54 -08:00
Yuuhi Yamaguchi
681d818523 Initialize resampling buffer per track.
When resampling too short sound, AudioMixer uses previous
tracks buffer. So we re-initialize the temporary buffer per
loop to avoid it.

Change-Id: I55a59a3b14faa8445e09c450478fe79cef704760
2011-02-04 15:24:34 +01:00
Glenn Kasten
8adacd8e22 Merge "Bug 3366885 Remove LVMX switch" 2011-02-03 18:44:32 -08:00
Eric Laurent
2e8fbebff4 am 6f1bd261: am 9c0a1003: Merge "Fix issue 3371080" into honeycomb
* commit '6f1bd261b7fd86ac7817ca061dfb55b95150b836':
  Fix issue 3371080
2011-02-03 17:18:46 -08:00
Glenn Kasten
1570aff60f Bug 3366885 Remove LVMX switch
Change-Id: I0bf98c6f85f00b3296874571e1c049dcc4e2fcca
2011-02-03 17:18:19 -08:00
Glenn Kasten
3515a33599 Bug 3366668 Use BinderService template
Change-Id: I93d7f3fc9dc9b6a365723d8a51a73a5aabdb4f93
2011-02-03 17:05:22 -08:00
Eric Laurent
25101b0b9a Fix issue 3371080
Modified default volume control logic in AudioService:
1 IN_CALL volume if in video/audio chat
2 NOTIFICATION if notification is playing or was playing less than 5s ago.
3 MUSIC

Modified silent mode:
- now also affect MUSIC stream type
- entering silent mode when VOL- hard key is pressed once while selected
stream volume is already at 0 (except for VOICE_CALL stream).
- exiting silent mode when pressing VOL+ hard key while in silent mode

Play sound FX (audible selections, keyboard clicks) at a fixed volume.

Modified audio framework:
- isStreamActive() method now implemented in AudioPolicyManagerBase (previously AudioFlinger)
- iStreamActive() now specifies a time window during which the stream is considered
active after it actually stopped.

Change-Id: I7e5a0724099450b9fc90825224180ac97322785f
2011-02-03 09:26:24 -08:00
Jean-Baptiste Queru
80838d256d Merge 0ef57993 from gingerbread
Change-Id: If10fee1ae387a8130356dd62fe678495402d5edf
2011-01-29 11:04:41 -08:00
Jean-Baptiste Queru
b7a6563d17 am 4eeb1047: Merge 13212f83 from gingerbread-plus-aosp
* commit '4eeb10470ffafe8c508027f363ac66b58da5bf00':
  Fix issue 2988031.
2011-01-29 08:57:47 -08:00
Jean-Baptiste Queru
4eeb10470f Merge 13212f83 from gingerbread-plus-aosp
Change-Id: I9a8ee0c7e7896aea85e7a7c18ee82927091cb670
2011-01-29 08:54:06 -08:00
Eric Laurent
111df679af Fix issue 2988031.
Limit SYSTEM stream volume when a headset is connected and music is playing.

Change-Id: Ieb44ae5bb53ffa9cd5fe8e317798eed279b78df8
2011-01-27 11:32:34 -08:00