summaryrefslogtreecommitdiffstats
path: root/services
Commit message (Collapse)AuthorAgeFilesLines
* Fix ALOG_ASSERT in AudioFlingerEric Laurent2012-04-141-2/+2
| | | | | | | Fix broken ALOG_ASSERT in updateFramesPendingAfterTrim_l() introduced by commit 1c345196. Change-Id: Ie1b2653069283f23ff0367f2628828e37fb0749c
* Fix the buildJohn Grossman2012-04-121-14/+14
| | | | | | forgot to upload final fixup during merge. sry about that Change-Id: I2ddd2c08d8efa83c0a8d1e378ae4c28686145154
* TimedAudio: Track of the number of pending frames.John Grossman2012-04-122-39/+103
| | | | | | | | | | | | | | | | | This is a manual merge from ics-aah > TimedAudio: Track of the number of pending frames. > > Keep track of the number of frames pending in the timed audio queue so > we can implement framesReady in O(1) time instead of O(N). This > change partially addresses bug 6020970; the bug will be completely > addressed once this change has been up-integrated into master. > > Change-Id: I599eb15ea1f6d715b97b30e65214fb6fadd169df > Signed-off-by: John Grossman <johngro@google.com> Change-Id: I6cbbbc3afc8efd066fe94865326ede0c6b3db2bd Signed-off-by: John Grossman <johngro@google.com>
* TimedAudio: Fix a cause of audio popping.John Grossman2012-04-122-21/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a manual merge from ics-aah > TimedAudio: Fix a cause of audio popping. > > Fix an issue with buffer lifecycle management which could cause audio > pops on timed outputs. There were two issues at work here. > > 1) During trim operations for the queued timed audio data, buffers > were being trimmed based on their starting PTS instead of when the > chunk of audio data actually ended. This means that if you have a > very large chunk of audio data (larger than the mixer lead time), > then a buffer at the head of the queue could be eligible to be > trimmed before its data had been completely mixed into the output > stream, even though the output stream was fully buffered and in no > danger of underflow. > 2) The implementation of getNextBuffer and releaseBuffer for timed > audio tracks was not keeping anything like a reference to the data > that it handed out to the mixer. The original architecture here > seemed to be expecting a ring buffer design, but timed audio tracks > use a packet based design. Pieces of packets are handed out to the > mixer which then frequently will hold onto that chunk of data > across two mix operations, using the first part of the chunk to > finish a mix buffer and then using the end of the chunk for the > start of the next mix buffer. If the buffer that the mixer is > holding a piece of got trimmed before the start of the next mix > operation, it would return to its heap and could be filled with who > knows what by the time it actually got mixed. On debug builds, > they seem to get zero'ed out as they go back to the heap causing > obvious pops in presentation. > > This change addresses both issues. Trim operations are now based on > ending presentation time for a chunk of audio, not the start. Also, > when the head of the queue is in flight to the mixer, it can no longer > be trimmed immediately, merely flagged for trim by the mixer when the > mixer finally does call releaseBuffer. > > Signed-off-by: John Grossman <johngro@google.com> > Change-Id: Ia1ba08cb9dea35a698723ab2d9bcbf804f1682fe Change-Id: I2c5e2f0375c410f0de075886aac56ff6317b144c Signed-off-by: John Grossman <johngro@google.com>
* audio pre processing: test code for dual micEric Laurent2012-04-111-1/+1
| | | | | | | | | Added functional test code to validate effect API for multi mic simplementations. Also fixed warning in AudioFlinger. Change-Id: I07be4d2e4d17791d3626c804ba3e9f87ff26d05a
* AudioMixer uses downmix effect for multichannel contentJean-Michel Trivi2012-04-094-16/+269
| | | | | | | | | | | | | | In the AudioMixer structure associated with each track, add an object that acts as the buffer provider when the track has more than two channels of input in the mixer. This object, DownmixerBufferProvider, gets audio from the actual buffer provider of the track, and applies a downmix effect on it. The downmix effect is created and configured when the track gets created in AudioFlinger, which causes AudioMixer::getTrackName() to be called with the new track's channel mask. It is released when the track is disabled in the mixer. Change-Id: I05281ed5f61bef663a8af7ca7d5ceac3517c82db
* 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
|\ \ \