summaryrefslogtreecommitdiffstats
path: root/services
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Non-blocking audio I/O interface, WIP"Glenn Kasten2012-04-0525-0/+2046
|\
| * Non-blocking audio I/O interface, WIPGlenn Kasten2012-04-0225-0/+2046
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Yet another abstraction similar to AudioTrack::Buffer and AudioBufferProvider, but with support for streaming, non-blocking, and eventually PTS. This is intended to be used as follows: - primary HAL output stream implements a Sink - primary HAL input stream implements a Source - Pipe implements a Sink - PipeReader implements a Source or TimedSource (not shown yet), which supports "read at PTS" - fast AudioTrack on server side will implement a Source using cblk - normal AudioTrack on server side will not be changed initially - fast AudioRecord on server side will implement a Sink using cblk - normal AudioRecord on server side will not be changed initially - fast mixer thread will read from Sources and write to a Sink, or (unlikely) implement a Source and multiple Sinks - Visualization and PCM logger will read from Source or TimedSource - A2DP normal mixer will be connected directly to its output stream and there will be a kind of OutputTrack for duplication that will read from a Sink with non-blocking write fed by the fast mixer. Patch set 3 changes: - Add more implementations of NBAIO interfaces: added SourceAudioBufferProvider, MonoPipe, MonoPipeReader. - Added Format_sampleRate and Format_channelCount. - Extract out the roundUp() method. - Respond to most comments from previous code review. - The new classes are untested. Patch set 4 changes: - Fix bugs in MonoPipe::write() and MonoPipeReader::read() - Fix bug initializing mFrameBitShift too early - renamed roundUp() to roundup() - Fix Android.mk - Add LOG_TAG an LOG_NDEBUG, use ALOG_ASSERT and utils/Log.h instead of assert - Fix build warnings - Move constructor and destructor bodies from .h to .cpp - Line length 100 - Following naming conventions for #include double-include protector macros - Include what you use - More NBAIO logging - MonoPipe write can be blocking Patch set 5 changes: - Address code review comments - Use a static library so unused implementations don't take memory - Comment out libsndfile dependency - Remove debugging LOGV and LOG_NDEBUG Patch set 6 changes (would be 6 at old location, actually 2 at new location): - Address code review comments on patchset 5 - For MonoPipe, allow the full pipe to be used, no need to omit one slot - Don't do atomic releasing stores unless needed Still to do: - I'm not happy with the Pipe class names - Update build/ for new static library? Change-Id: Ie6c61f05ce06b676b033be448a8ef9025a2ffcfd
* | audio policy: load audio hw modules.Eric Laurent2012-04-043-169/+279
| | | | | | | | | | | | | | | | | | | | | | Audio HW modules are now loaded upon request from audio policy manager according to the configuration in audio_policy.conf. Removed hard coded HW module loading by AudioFlinger at init time. Added methods to IAudioFlinger and AudioPolicyInterface to control the loading of audio HW modules. Added methods to open an output or input stream on a specific hw module. Change-Id: I361b294ece1a9b56b2fb39cc64259dbb73b804f4
* | audio policy: add configuration fileEric Laurent2012-04-033-30/+4
| | | | | | | | | | | | | | | | | | | | | | 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
* | AudioFlinger track flags and server's fast policyGlenn Kasten2012-04-022-9/+63
| | | | | | | | Change-Id: I72358c8e6829d173b3e60ced8a8babc089869fac
* | const methods and commentsGlenn Kasten2012-04-022-22/+26
| | | | | | | | Change-Id: Ifd16750174fdb15b72507787502b587562ffc99e
* | AudioMixer default track parametersGlenn Kasten2012-04-011-23/+33
|/ | | | | | | | | | Move the default initialization of track parameters from the AudioMixer constructor to getTrackName(). This fixes a bug where the defaults were only valid the first time a name was allocated. Also added a switch case for parameter FORMAT. Change-Id: I07abd3aaf7f4efe9825a761d2bc662aaee2c6db0
* Make AudioTrack/AudioRecord handle more than 2^32 framesMarco Nelissen2012-03-301-4/+14
| | | | | b/6160363 Change-Id: I471815012c6a113ec2c4dd7676e8fa288a70bc76
* implemented synchronous audio captureEric Laurent2012-03-292-20/+312
| | | | | | | | | | | | | | Added the infrastructure to support the synchronization of playback and capture actions on specific events. The first requirement for this feature is to synchronize the audio capture start with the full rendering of a given audio content. The applications can further be extended to other use cases (synchronized playback start...) by adding new synchronization events and new synchronous control methods on player or recorders. Also added a method to query the audio session from a ToneGenerator. Change-Id: I51f1167290d9cafdf2fbcdf9e4785156973af44c
* Fix deadlock in camera destruction after client app's crashKeun young Park2012-03-282-18/+60
| | | | | | | | | | | | | | | | | | | | | | | * why deadlock happened: when an app (CTS camera test) crashes while using camera, its binder is closed and reference counter is decreased. If camera is inside callback, sp<Client> inside callback will hold the Client instance, and Client instance is destroyed when the callback ends as sp<Client> to hold it no longer exists. The destructor of Client instance tries to clean up camera H/W which tries to stop threads created by camera HAL including the thread context where the callback is running. This causes deadlock where the callback thread itself is waiting for itself to terminate. Note that the deadlock will not happen if camera callback is not active. In that case, closing of binder will force the destruction of Client instance, and the destruction happens in binder thread. * Fix: Forces Client descruction in binder thread - remove sp<Client> from callbacks to prevent destruction in callback context - add client lock to allow callback to use raw pointer safely. This prevents the destructor from deleting the instance while callback is using it. - add status change inside destructor with client lock to safely destroy Client Bug: 6214383 Change-Id: Ic6d6396d4d95ce9e72a16ec2480ae65c100fe806
* AV Android make files changesJames Dong2012-03-281-1/+1
| | | | | | | o plus a few file relocation: ActivityManager.cpp/h, SoundPool.h, etc o remove some runtime dependencies to libandroid, libandroid_runtime, etc Change-Id: I047a47c5fb361dd5cf85cd98798c39f629a75d10
* Merge "IAudioFlinger::createTrack and openRecord flags"Glenn Kasten2012-03-262-8/+5
|\
| * IAudioFlinger::createTrack and openRecord flagsGlenn Kasten2012-03-192-8/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | createTrack and openRecord don't need the "old" flags parameter, which was either audio_policy_output_t or audio_in_acoustics_t shifted left by 16 bits. But they do need "new" flags, which are defined by the application use case. Initially, the only application use case flag is timed output, but others are planned. For output, the audio_policy_output_t flags are passed to AudioSystem::getOutput, which returns an audio_io_handle_t, and that handle is then passed to createTrack. So createTrack doesn't need the old flags parameter. For input, the audio_in_acoustics_t flags are passed to AudioSystem::getInput, which returns an audio_io_handle_t, and that handle is then passed to openRecord. So openRecord doesn't need the old flags parameter. Change-Id: I18a9870911846cca69d420c19fe6a9face2fe8c4
* | Revert "AudioFlinger does not need libmedia any more"Glenn Kasten2012-03-231-0/+1
| | | | | | This reverts commit c920dee060ac69684be33210ee44b99a5fc3e8b2
* | AudioFlinger does not need libmedia any moreGlenn Kasten2012-03-221-1/+0
| | | | | | | | Change-Id: Ifd2c61882109ec36ca68072a2bf6506e08c8cf34
* | Merge "Clean up Track constructor"Glenn Kasten2012-03-212-12/+16
|\ \
| * | Clean up Track constructorGlenn Kasten2012-03-202-12/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 'thread' parameter can never be NULL. Use constructor initialization list when possible. Make more members const. Only put the relevant code under "if (mCblk != NULL)". Add comment about track name leak. Change-Id: Ib963390a69bed1999638cc982a759edd1d5f4712
* | | Merge "AudioMixer can be configured for fewer max tracks"Glenn Kasten2012-03-212-4/+14
|\ \ \
| * | | AudioMixer can be configured for fewer max tracksGlenn Kasten2012-03-202-4/+14
| |/ / | | | | | | | | | Change-Id: I371b17cef071d083eecf35cd3627a3adff907a33
| * | Add libmedia_nativeGlenn Kasten2012-03-162-0/+2
| |/ | | | | | | Change-Id: Ib8cff8abd73723b793f08da99ad59549f219e0e7
* | Merge "Update comments"Glenn Kasten2012-03-214-3/+14
|\ \
| * | Update commentsGlenn Kasten2012-03-194-3/+14
| |/ | | | | | | Change-Id: I327663a020670d0a72ff57bd0b682e2ce0528650
* | Merge "Whitespace"Glenn Kasten2012-03-212-17/+18
|\ \
| * | WhitespaceGlenn Kasten2012-03-192-17/+18
| |/ | | | | | | | | | | Fix indentation, and add blank lines in key places for clarity Change-Id: I57a0a8142394f83203161aa9b8aa9276abf3ed7c
* | Merge "new doesn't fail on Android"Glenn Kasten2012-03-211-8/+1
|\ \
| * | new doesn't fail on AndroidGlenn Kasten2012-03-191-8/+1
| |/ | | | | | | Change-Id: I5079a3bf31097dd0807b2d806d5f8d3cff2077ab
* | am a48285c4: am 165ee4c5: am 14958e21: Merge "audioflinger: fix issue with ↵Eric Laurent2012-03-201-1/+2
|\ \ | | | | | | | | | | | | | | | | | | camcorder and A2DP" into ics-mr1 * commit 'a48285c4f22ffc43f1771ebd1ff35dcec48db2c7': audioflinger: fix issue with camcorder and A2DP
| * \ am 14958e21: Merge "audioflinger: fix issue with camcorder and A2DP" into ↵Eric Laurent2012-03-191-1/+2
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | ics-mr1 * commit '14958e21c12f922d7501d32c3bec05109eb342d5': audioflinger: fix issue with camcorder and A2DP
| | * | audioflinger: fix issue with camcorder and A2DPEric Laurent2012-03-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some audio HALs do not support well a device selection of 0 (no device) received on an input stream. This can happen because of a problem in the audioflinger code that handles the forwarding of the output device selection to the record thread for use by the pre processing modules that need it. If the output device is 0 (meaning no op, which happens when stopping playback over A2DP) audioflinger could not detect it was an output device selection and would forward it to the input stream (see AudioFlinger::setParameters() and RecordThread::checkForNewParameters_l(). Issue 6179641. Change-Id: Idae534521866538e0d12ba259a2834f402a922e2
* | | | Add libmedia_nativeGlenn Kasten2012-03-192-0/+3
| |_|/ |/| | | | | | | | Change-Id: I3ac357c78fb89f108d15c6e5b9fa317de0e9fb9a
* | | Merge "Add a new camera open API that allows taking the ownership."Wu-cheng Li2012-03-152-34/+130
|\ \ \
| * | | Add a new camera open API that allows taking the ownership.Wu-cheng Li2012-03-152-34/+130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The purpose is to let face unlock always get the camera successfully. What happened was the camera applications may have opened the camera in onResume under the lock screen. This API lets face unlock take the camera from the camera application. A new permission will be added, so other applicatoins won't be able to take the camera from the face unlock. bug:5584464 Change-Id: Ib3d9dcbc2161815b68db42327dc01148453704c6
* | | | Remove dependency on audio_* locationGlenn Kasten2012-03-141-2/+2
|/ / / | | | | | | | | | Change-Id: I4bc66115fcb9ba22b057bd72db3f561dcb18a0d8
* | | Merge "AudioFlinger playback thread CPU measurement in Hz"Glenn Kasten2012-03-141-22/+82
|\ \ \
| * | | AudioFlinger playback thread CPU measurement in HzGlenn Kasten2012-03-141-22/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Log statistics on CPU usage in Hz in addition to wall clock time Use CPU statistics for all playback threads, not just MIXER (but they are disabled by default by a compile-time debug macro). ThreadCpuUsage library: - Move statistics out of the library and leave that up to the caller - Add API to determine a CPU's frequency Change-Id: Ia1011123146e641fcf210ef26e78ae2b4d3b64ad
* | | | Merge "audioflinger: more info in dumpsys"Eric Laurent2012-03-141-0/+4
|\ \ \ \
| * | | | audioflinger: more info in dumpsysEric Laurent2012-03-141-0/+4
| |/ / / | | | | | | | | | | | | | | | | | | | | Added TID and io handle to AudioFlinger threads dump. Change-Id: Ib1a856f3bad55c73e4c395b5e59d57435f4b9a4c
* | | | Break circular dependency on media player serviceGlenn Kasten2012-03-131-0/+16
|/ / / | | | | | | | | | | | | Bug: 6165157 Change-Id: I3c85bbcaf31f3cb9a009e273f7b6284015eb3bd8
* | | Whitespace and indentationGlenn Kasten2012-03-138-142/+143
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 "Clean up assertion checks"Glenn Kasten2012-03-132-27/+25
|\ \ \
| * | | Clean up assertion checksGlenn Kasten2012-03-122-27/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use ALOG_ASSERT instead of assert. Use compile-time asserts where appropriate. Fix typo in an ALOGV. Change-Id: I58f1c1ffc14319a022c88b5a88b8d0368660da8b
* | | | Fix bug where mMixerStatus was set to IDLEGlenn Kasten2012-03-121-2/+1
|/ / / | | | | | | | | | Change-Id: I55df1738fb7ba17ba6caeea6a17557526eac17a7
* | | Inline applyVolume() into threadLoop_mix()Glenn Kasten2012-03-122-80/+73
| | | | | | | | | | | | | | | | | | Also the declaration of applyVolume in PlaybackThread was dead. Change-Id: I4b1a9848d07d3d7f340baea05b17f667c78df868
* | | Merge "Remove unnecessary friend declarations"Glenn Kasten2012-03-121-42/+10
|\ \ \
| * | | Remove unnecessary friend declarationsGlenn Kasten2012-03-091-42/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add comments to the remaining friends, so we know what is left if we decide to remove them later. Change-Id: I1de929257dc4700960f77902cda3d303177c72cf
* | | | Merge "Remove virtual from methods that don't need it"Glenn Kasten2012-03-121-3/+4
|\ \ \ \
| * | | | Remove virtual from methods that don't need itGlenn Kasten2012-03-091-3/+4
| |/ / / | | | | | | | | | | | | Change-Id: I30e17e61aae25b036436c0e270313c80c43e5f06
* | | | Merge dup code at thread entry and param changeGlenn Kasten2012-03-122-52/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL is mostly just cleanup, but there are a couple of fixes marked "FIX" below. Merge the duplicate code that was at the beginning of threadLoop() and after a parameter change. cacheParameters_l() is now called at entry to threadLoop() and after any parameter change. It re-calculates all values that are derived from parameters, and caches them in instance variables. updateWaitTime_l(): - FIX activeSleepTime depends on mWaitTimeMs, which was initially set to infinity. updateWaitTime_l() was not called at entry to threadLoop(), so activeSleepTime was not set correctly before the first parameter change. - FIX reversed the order of calls after parameter change for the same reason so that updateWaitTime_l() is called before calculating values that are derived from wait time. - marked it private since now it's only called from DuplicatingThread Change-Id: If2607d2ed66c6893d910433e48208a93c41fb7e9
* | | | Use audio_policy_output_flags_t consistentlyGlenn Kasten2012-03-092-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This affects: - IAudioFlinger::openOutput - AudioTrack::AudioTrack - AudioTrack::set - apps that call these Change-Id: I26fb281bac6cb87593d17697bc9cb37a835af205
* | | | Merge "Replace hard-coded 3 by FCC_2 to simplify searches"Glenn Kasten2012-03-092-4/+13
|\ \ \ \ | |/ / / |/| | |