summaryrefslogtreecommitdiffstats
path: root/media/libmedia/AudioSystem.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* rename audio policy output flagsEric Laurent2012-04-181-1/+1
| | | | Change-Id: I27c46bd1d1b2b5f96b87af7d05b951fef18a1312
* audio policy: add configuration fileEric Laurent2012-04-031-47/+33
| | | | | | | | | | | removed outputs to stream mapping cache in audio system: the output for a given stream type must always be queried from audio policy manager as the cache is not always updated fast enough by audioflinger callback. removed AudioFlinger::PlaybackThread::setStreamValid() not used anymore if stream to output mapping is not cached. Change-Id: Ieca720c0b292181f81247259c8a44359bc74c66b
* Whitespace and indentationGlenn Kasten2012-03-131-5/+4
| | | | | | | | | | | | | | Fix indentation to be multiple of 4. Make it easier to search: sp< not sp < to "switch (...)" instead of "switch(...)" (also "if" and "while") Remove redundant blank line at start or EOF. Remove whitespace at end of line. Remove extra blank lines where they don't add value. Use git diff -b or -w to verify. Change-Id: I966b7ba852faa5474be6907fb212f5e267c2874e
* Merge "audio policy: use audio_devices_t when appropriate"Eric Laurent2012-03-081-2/+2
|\
| * audio policy: use audio_devices_t when appropriateEric Laurent2012-03-081-2/+2
| | | | | | | | Change-Id: I1b3a5879e81c789fb53d356af3d3a1ee2dca955f
* | IAudioFlingerClient::ioConfigChanged param2 constGlenn Kasten2012-03-061-5/+5
|/ | | | | | | | | The 3rd parameter (param2) to AudioFlingerClient::ioConfigChanged is used as an input. So changed it from void * to const void *. It is then cast to const OutputDescriptor * or const audio_stream_type_t * depending on the event. Change-Id: Ieec0d284f139b74b3389b5ef69c7935a8e5650ee
* Use audio_io_handle_t consistently instead of intGlenn Kasten2012-02-081-3/+6
| | | | | | | | Other: - add a comment to nextUniqueId - made ThreadBase::mId const, since it is only assigned in constructor. Change-Id: I4e8b7bec4e45badcde6274d574b8a9aabd046837
* Use NULL not 0 for raw pointersGlenn Kasten2012-02-031-6/+6
| | | | | | Use if (p != NULL) instead of if (ptr) Change-Id: Iaec3413a59ccbf233c98fcd918cc7d70ac5da9fa
* More audio_stream_type_tGlenn Kasten2012-01-271-3/+4
| | | | Change-Id: I1260259efe0aa3fc1ef13de69758aaa592e1f815
* Use audio_source_t consistentlyGlenn Kasten2012-01-261-1/+1
| | | | | | | | | | | | | | | | Was a mix of audio_source_t, uint8_t, and int. Related fixes: - fix comments in MediaRecorder.java - AudioPolicyService server side was not checking source parameter at all, so if the client wrapper was bypassed, invalid values could be passed into audio HAL - JNI android_media_AudioRecord_setup was checking source for positive values, but not negative values. This test is redundant, since already checked at Java and now checked by AudioPolicyService also, but might as well make it correct. Change-Id: Ie5e25d646dcd59a86d7985aa46cfcb4a1ba64a4a
* Use audio_format_t consistently, continuedGlenn Kasten2012-01-201-4/+4
| | | | | | | | | | | | Was int or uint32_t. When AudioFlinger::format can't determine the correct format, return INVALID rather than DEFAULT. Init mFormat to INVALID rather than DEFAULT in the constructor. Subclass constructors will set mFormat to the correct value. Change-Id: I9b62640aa107d24d2d27925f5563d0d7407d1b73
* Merge "Remove redundant get()"Glenn Kasten2012-01-201-2/+2
|\
| * Remove redundant get()Glenn Kasten2012-01-201-2/+2
| | | | | | | | | | | | | | get() is almost always unnecessary, except in a LOG. Also no need to check for != 0 before calling get(). Change-Id: Ib06e7a503f86cf102f09acc1ffb2ad085025516d
* | Merge "Remove dead setRingerMode(mode, mask)"Glenn Kasten2012-01-201-7/+0
|\ \ | |/ |/|
| * Remove dead setRingerMode(mode, mask)Glenn Kasten2012-01-181-7/+0
| | | | | | | | Change-Id: Ia4cc8be8424a40b3dcb7ebd0264fdff4e5247f7f
* | Merge "Simplify range check for audio_mode_t (continued)"Glenn Kasten2012-01-191-0/+1
|\ \
| * | Simplify range check for audio_mode_t (continued)Glenn Kasten2012-01-181-0/+1
| |/ | | | | | | | | | | Missed one place in earlier CL of same name Change-Id: I0dd25364d0b8d5d731c02d352f139a0c8d4df1a8
* | Temporarily restore AudioSystem/AudioTrack APIs with their former signaturesAndreas Huber2012-01-181-0/+10
|/ | | | | | until we get updated prebuilts from vendor. Change-Id: I8aae81d2513edca0ab268053a11c8c4206879e61
* Merge "audio framework: manage stream volume per device"Eric Laurent2012-01-171-4/+8
|\
| * audio framework: manage stream volume per deviceEric Laurent2012-01-171-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improve volume management by keeping track of volume for each type of device independently. Volume for each stream (MUSIC, RINGTONE, VOICE_CALL...) is now maintained per device. The main changes are: - AudioService now keeps tracks of stream volumes per device: volume indexes are kept in a HashMap < device , index>. active device is queried from policy manager when a volume change request is received initalization, mute and unmute happen on all device simultaneously - Settings: suffixes is added to volume keys to store each device volume independently. - AudioSystem/AudioPolicyService/AudioPolicyInterface: added a device argument to setStreamVolumeIndex() and getStreamVolumeIndex() to address each device independently. - AudioPolicyManagerBase: keep track of stream volumes for each device and apply volume according to current device selection. Change-Id: I61ef1c45caadca04d16363bca4140e0f81901b3f
* | Merge "Use audio_mode_t consistently"Glenn Kasten2012-01-171-2/+2
|\ \ | |/ |/|
| * Use audio_mode_t consistentlyGlenn Kasten2012-01-121-2/+2
| | | | | | | | | | | | | | It was int or uint32_t. Also make getMode() const. Change-Id: Ibe45aadbf413b9158e4dd17f2b3bcc6355288d37
* | Use audio_stream_type_t consistentlyGlenn Kasten2012-01-131-14/+14
|/ | | | | | | | | At native level it was a mixture of audio_stream_type_t, int, uint32_t, and uint8_t. Java is still int. Also fixed a couple of hard-coded -1 instead of AUDIO_STREAM_DEFAULT, and in startToneCommand a hard-coded 0 instead of AUDIO_STREAM_VOICE_CALL. Change-Id: Ia33bfd70edca8c2daec9052984b369cd8eee2a83
* Merge "Fix race in AudioSystem::getInputBufferSize"Glenn Kasten2012-01-111-9/+14
|\
| * Fix race in AudioSystem::getInputBufferSizeGlenn Kasten2012-01-101-9/+14
| | | | | | | | | | | | It was caching the recording parameters without a mutex. Change-Id: Ic4b9f621cbc080d224c2233cf3ca3454fc0f19bd
* | Simplify range check for audio_mode_tGlenn Kasten2012-01-101-1/+1
|/ | | | | | | | | | AudioSystem::setMode previously allowed negative modes, but these were then rejected by AudioFlinger. Now negative modes (including AUDIO_MODE_INVALID and AUDIO_MODE_CURRENT) are explicitly disallowed. Change-Id: I0bac8fea737c8eb1f5b6afbb893e48739f88d745
* Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGESteve Block2012-01-081-1/+1
| | | | | | | See https://android-git.corp.google.com/g/#/c/157220 Bug: 5449033 Change-Id: Ic9c19d30693bd56755f55906127cd6bd7126096c
* Rename (IF_)LOGW(_IF) to (IF_)ALOGW(_IF) DO NOT MERGESteve Block2012-01-061-6/+6
| | | | | | | See https://android-git.corp.google.com/g/157065 Bug: 5449033 Change-Id: I00a4b904f9449e6f93b7fd35eac28640d7929e69
* Rename (IF_)LOGD(_IF) to (IF_)ALOGD(_IF) DO NOT MERGESteve Block2012-01-031-2/+2
| | | | | | | See https://android-git.corp.google.com/g/156016 Bug: 5449033 Change-Id: I4c4e33bb9df3e39e11cd985e193e6fbab4635298
* Rename (IF_)LOGV(_IF) to (IF_)ALOGV(_IF) DO NOT MERGESteve Block2011-10-261-13/+13
| | | | | | | See https://android-git.corp.google.com/g/#/c/143865 Bug: 5449033 Change-Id: I0122812ed6ff6f5b59fe4a43ab8bff0577adde0a
* Fix issue 5252593: any app can restart the runtimeEric Laurent2011-09-021-1/+7
| | | | | | Replace null device address string by empty sting. Change-Id: I285c35f3345334e6d2190493b1a8a5aca1a361a4
* 226483: A2DP connected, but music out to speakerEric Laurent2011-08-301-0/+8
| | | | | | | | | | | | | | | | When the A2DP headset is connected, there is a possible race condition when the audio tracks are moved from the mixer thread attached to the speaker output to the thread attached to A2DP output. As the request to clear the stream type to output mapping cache in the client process is asynchronous, it is possible that the flag indicating to the client audio track to re-create the IAudioTrack on the new thread is processed before the cache is invalidated. In this case, the track will be attached to the old thread and music will continue playing over the device speaker instead of being redirected to A2DP headset. Change-Id: Ib2ce1eb5320eaff83287b93779061bf4e7a330df
* Audio effects: track CPU and memory use separatelyEric Laurent2011-08-111-0/+7
| | | | | | | | | | | | | | | | | | | | | | Before this change, CPU and memory usage for an audio effect were registered and checked against the limit by audio policy manager upon effect instantiation. Even if an effect was not enabled it would prevent another effect to be created if the CPU load budget was exceeded, which was too restrictive. This change adds a method to register/unregister CPU load only when an effect is enabled or disabled. It also adds a mechanism to place all effects on the global output mix in suspend state (disabled) when an effect is enabled on a specific session. This will allow applications using session effects to have the priority over others using global effects. Also fixes some issues with suspend/restore mechanism: - avoid taking actions when an effect is disconnected and was not enabled. - do not remove a session from the suspended sessions list when corresponding effect chain is destroyed. Change-Id: I5225278aba1ae13d0d0997bfe26a0c9fb46b17d3
* Keep effects sessions active when the caller dies.Marco Nelissen2011-08-091-0/+14
| | | | | | | | Don't remove effects until the session they are in goes away or all AudioEffects have been explicitly released. This allows the control panel process to die without stopping the effects. Change-Id: I4496e5df080230ca1af149dec95c1309ab8ea888
* Audio framework: support for audio pre processingEric Laurent2011-07-181-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | Audio effect framework is extended to suport effects on output and input audio path. AudioFlinger: Support for audio effects and effect chains is moved from PlaybackThread class to ThreadBase class so that RecordThread can manage effects. Effects of type pre processing are allowed on record thread only. When a pre processing is enabled, the effect interface handle is passed down to the input stream so that the audio HAL can call the process function. The record thread loop calls the effect chain process function that will only manage the effect state and commands and skip the process function. AudioRecord: The audio session is allocated before calling getInput() into audio policy serice so that the session is known before the input theead is created and pre processings can be created on the correct session. AudioPolicyService: default pre processing for a given input source are loaded from audio_effects.conf file. When an input is created, corresponding effects are created and enabled. Change-Id: Id17119e0979b4dcf189b5c7957fec30dc3478790
* Remove dead code related to gettidGlenn Kasten2011-06-031-7/+0
| | | | | | The gettid system call is always available now. Change-Id: Ib78b41781eda182dc8605daf456bbea7ff7c2dc0
* update for new audio.h header locationDima Zavin2011-05-121-1/+1
| | | | | Change-Id: Ic4c62c4037800802427eb7d3c7f5eb8b25d18876 Signed-off-by: Dima Zavin <dima@android.com>
* audio/media: convert to using the audio HAL and new audio defsDima Zavin2011-04-271-161/+46
| | | | | Change-Id: Ibc637918637329e4f2b62f4ac7781102fbc269f5 Signed-off-by: Dima Zavin <dima@android.com>
* libmedia: move AudioParameter out of AudioSystemDima Zavin2011-04-271-154/+0
| | | | | Change-Id: I9eb7e002d141936258050d4fa4f0ccd8202bfc54 Signed-off-by: Dima Zavin <dima@android.com>
* Bug 3352047 Wrong message when adjusting volumeGlenn Kasten2011-02-101-0/+7
| | | | | | Add hidden AudioManager.getDevicesForStream and output device codes. Change-Id: I4d1c1d3b6a077cd117720817d1f733dda557b947
* Fix issue 3371080Eric Laurent2011-02-031-9/+8
| | | | | | | | | | | | | | | | | | | | | | 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
* Add support for audio recording source in generic audio policy mgr.Jean-Michel Trivi2010-11-121-0/+1
| | | | | | | | | Update the platform-independent audio policy manager to pass the nature of the audio recording source to the audio policy client interface through the AudioPolicyClientInterface::setParameters() method. Change-Id: I6b4fd0f8a3acea0d7d30bbad98edd1977dc012bf
* resolved conflicts for merge of dd206093 to masterEric Laurent2010-07-201-4/+40
|\ | | | | | | Change-Id: I21dd2321a4839d034d49092baccbf40986f17dae
| * Audio policy manager changes for audio effectsEric Laurent2010-07-201-4/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added methods for audio effects management by audio policy manager. - control of total CPU load and memory used by effect engines - selection of output stream for global effects - added audio session id in parameter list for startOutput() and stopOutput(). this is not used in default audio policy manager implementation. Modifications of audio effect framework in AudioFlinger to allow moving and reconfiguring effect engines from one output mixer thread to another when audio tracks in the same session are moved or when requested by audio policy manager. Also fixed mutex deadlock problem with effect chains locks. Change-Id: Ida43484b06e9b890d6b9e53c13958d042720ebdb
* | am 030a1553: am 2ea200c5: Merge "Issue 2667801: [Audio Effect Framework] ↵Eric Laurent2010-06-041-0/+6
|\ \ | |/ | | | | AudioFlinger, AudioMixer AudioTrack modifications." into kraken
| * Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack ↵Eric Laurent2010-06-031-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
* | Fix issue 2712130: Sholes: problem when playing audio while recording over ↵Eric Laurent2010-05-261-1/+2
|/ | | | | | | | | | | | bluetooth SCO. The problem is that when an input stream is opened for record over bluetooth SCO, the kernel mono audio device should be opened in RW mode to allow further use of this same device by an output stream also routed to bluetooth SCO. This does not happen because of a bug in AudioSystem::isBluetoothScoDevice() that does not return true when the device is DEVICE_IN_BLUETOOTH_SCO_HEADSET (input device for blurtooth SCO). Change-Id: I9100e972931d8142295c7d64ec06e31304407586
* Fix issue 2416481: Support Voice Dialer over BT SCO.Eric Laurent2010-03-161-2/+13
| | | | | | | | | | | - AudioPolicyManager: allow platform specific choice for opening a direct output. Also fixed problems in direct output management. - AudioFliinger: use shorter standby delay and track inactivity grace period for direct output thread to free hardware resources as soon as possible. - AudioSystem: do not use cached output selection in getOutput() when a direct output can be selected. Change-Id: If44b50d29237b8402ffd7a5ba1dc43c56f903e9b
* Issue 2071329: audio track is shorter than video track for video capture on ↵Eric Laurent2010-03-021-0/+10
| | | | | | | | sholes Add API to retrieve number of frames dropped by audio input kernel driver. Submitted on behalf of Masaki Sato <masaki.sato@motorola.com>
* am 8978547f: am f5fe3949: Fix issue 2459650.Eric Laurent2010-02-221-1/+3
|\ | | | | | | | | | | | | Merge commit '8978547f254b6b6ba2e322794aa044803f3edc2a' * commit '8978547f254b6b6ba2e322794aa044803f3edc2a': Fix issue 2459650.