summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/AudioFlinger.h
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Explicitly include Configuration.h"Glenn Kasten2014-05-131-0/+1
|\
| * Explicitly include Configuration.hGlenn Kasten2014-05-131-0/+1
| | | | | | | | | | | | | | | | Must include Configuration.h in any source file with #ifdef or #if that depends on Configuration.h. This avoid inconsistencies that could result in subtle bugs. Change-Id: I99fdf19d56e7c73de4e7d672b937336b932a2a00
* | AudioFlinger: add specific mutex for client listsEric Laurent2014-05-131-9/+8
|/ | | | | | | | | | | | | Add a specific mutex to protect access to mClients and mNotificationClients lists. This avoids locking the main AudioFlinger mutex from inside thread loops and allows not to worry about cross deadlocks when sending a config event with status reply while keeping the ThreadBase or AudioFlinger mutex locked. As a way of consequence, remove notification client list passed to processConfigEvents_l() and audioConfigChanged() as the list can now be accessed by locking client mutex only. Change-Id: I228022204b6709a8bb60cc96d9514a6ffe59b62e
* Merge "Remove obsolete IAudioRecord::getCblk()"Glenn Kasten2014-05-091-1/+0
|\
| * Remove obsolete IAudioRecord::getCblk()Glenn Kasten2014-05-091-1/+0
| | | | | | | | Change-Id: Id20b5efd765b9796b0e391610e06dc928a829ebf
* | Merge "audioflinger: refactor thread config events"Eric Laurent2014-05-091-2/+7
|\ \ | |/ |/|
| * audioflinger: refactor thread config eventsEric Laurent2014-05-091-2/+7
| | | | | | | | | | | | | | | | | | | | | | Merge config events and set parameters messaging mechanism. - setting parameters now uses the config event mechanism - config event now allow to wait for a condition and synchronize caller binder thread with execution thread and return an execution status. - simplify locking mechanism to avoid unlocking the thread mutex while processing events. Change-Id: Ia49cb3e617abec4bacb6c1f9a8cb304c4ed3902e
* | IAudioFlinger::openRecord returns IMemory(s)Glenn Kasten2014-05-091-0/+2
|/ | | | | | | | openRecord() now explicitly returns the control block and data buffer as separate IMemory references. If the IMemory for data buffer is 0, this means it immediately follows the control block. Change-Id: Ic098f88f0e037f8fbe30006689e18cacacf09d06
* Document AudioFlinger::nextUniqueId()Glenn Kasten2014-03-251-1/+12
| | | | Change-Id: Iafe96f1c10bd85cb23a2553945ca68aa601dc2eb
* Remove name output parameter from createTrackGlenn Kasten2014-03-141-1/+0
| | | | | | | It was only used for one log. A better solution will be a per-track unique ID. Change-Id: Ia440e02ae4a5a4019a9a2d08970e1ee93ac4c3a3
* Rename setStreamOutput to invalidateStreamGlenn Kasten2014-02-281-1/+1
| | | | | | And simplify by removing the unused I/O handle parameter 'output'. Change-Id: Ie9c4df17a7378066312d4ed8790fda7a9125c95e
* Merge "Make tee sink work again"Glenn Kasten2014-02-211-1/+1
|\
| * Make tee sink work againGlenn Kasten2014-02-211-1/+1
| | | | | | | | | | | | | | | | | | | | It was broken by this earlier change to NBAIO: > Change-Id: I5eda412648b094358f5eefc38300e9ec8a734cd3 But the code was not being compiled, so the error was not caught earlier. Also increase the default size of per-track pipe to a reasonable value. Change-Id: Ica05017e6c6533e1fea9df379a9b204eebed4a1f
* | audioflinger: fix race condition in SyncEvent callbackEric Laurent2014-02-201-4/+4
|/ | | | | | | | | | | | | Now that the SyncEvent callback is implemented by the RecordTrack instead of the RecordThread, there is a possibility that the callback is called after the track deletion. SyncEvent callback now uses a weak pointer instead of a raw pointer as cookie. This allows the callback implementer to acquire a strong reference on the object pointed to by the cookie. Bug: 13114128. Change-Id: Id61b8f06044ed1e52c6f7e7c666cdede68340de2
* Track pid for each sessionMarco Nelissen2014-02-111-2/+2
| | | | | | so they can be properly freed. Change-Id: I6f389035bc29e74e7c367c1c6d0252b180f666b3
* resolved conflicts for merge of 566be7c3 to masterNarayan Kamath2014-02-111-1/+1
|\ | | | | | | Change-Id: I7b1cc71057b2bd4f771e7bcf508a8c3abd6017ce
| * Make frameworks/av 64-bit compatibleKévin PETIT2014-02-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Contains the necessary changes to make frameworks/av build and work on a 64-bit machine. Signed-off-by: Craig Barber <craig.barber@arm.com> Signed-off-by: Kévin PETIT <kevin.petit@arm.com> Signed-off-by: Ashok Bhat <ashok.bhat@arm.com> Signed-off-by: Marcus Oakland <marcus.oakland@arm.com> Change-Id: I725feaae50ed8eee25ca2c947cf15aee1f395c43
| * Assign blame for playback wakelocks.Marco Nelissen2013-10-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | Set a work source for the playback wakelock, so that playback is counted against the requesting app instead of the media server. Cherrypicked from master. b/9464621 Change-Id: I7329f88a288a95a582a78005a1c3d16a5a611e31
* | Merge "Fix clang warnings in AudioFlinger"Glenn Kasten2014-02-101-2/+2
|\ \
| * | Fix clang warnings in AudioFlingerGlenn Kasten2014-02-101-2/+2
| | | | | | | | | | | | Change-Id: I0fa61025c979709ad7d655bc717df5f194b6089e
* | | Pretty up audioflinger dumpsysMarco Nelissen2014-02-101-0/+2
|/ / | | | | | | Change-Id: I57e44b4c36b99f7149542bbcf9645521c6152dfa
* | Merge "Replace control block frameCount_ by explicit in/out parameter"Glenn Kasten2014-01-241-2/+2
|\ \
| * | Replace control block frameCount_ by explicit in/out parameterGlenn Kasten2013-12-201-2/+2
| | | | | | | | | | | | | | | | | | in IAudioFlinger::createTrack and IAudioFlinger::openRecord Change-Id: I09c644c80e92c8e744b1b99055988a2588b2a83d
* | | AudioRecord::getInputFramesLost() cleanupGlenn Kasten2014-01-141-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed bug that if the binder call failed (for example if the IAudioFlinger binder is dead), then getInputFramesLost was returning garbage. Now it correctly returns zero, which is the error value for this method. The type declarations for getInputFramesLost were inconsistent: a mixture of unsigned int, size_t, and uint32_t. Now it returns uint32_t everywhere, which is what the underlying HAL API returns. Added a FIXME about the side effect behavior. This will need review for multi-client. Change-Id: Ifa2e117a87dbd0c1f2c892a31d1c3dd919bf1a0a
* | Add RecordThread media.log and deferred deallocationGlenn Kasten2013-12-051-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change allows a media.log buffer for RecordThread. Unlike playback threads which stick around forever, the RecordThread comes and goes for every capture session. This means that the media.log buffer for a RecordThread would disappear too, and so was useless. Now when a thread exits, it's associated media.log buffer is just marked for deferred deallocation. It is only actually freed when the memory is needed. Other changes: - Fix bug in unregistering comparison, it was comparing the wrong pointers - Increased size of log area so we can log for RecordThread also Change-Id: If45d4c03a793b86390a0112ec3acc5d41b2e3635
* | Use const more placesGlenn Kasten2013-11-041-2/+2
| | | | | | | | Change-Id: Ibc068d319d6fff26f2d11248e17481d8f7f027e0
* | Assign blame for playback wakelocks.Marco Nelissen2013-10-251-0/+1
| | | | | | | | | | | | | | Set a work source for the playback wakelock, so that playback is counted against the requesting app instead of the media server. Change-Id: I7329f88a288a95a582a78005a1c3d16a5a611e31
* | am 3424d6e1: am 1adf20ce: Merge "fix volume and effect enable delay on ↵Eric Laurent2013-10-011-0/+1
|\ \ | |/ | | | | | | | | | | offloaded tracks" into klp-dev * commit '3424d6e17637e0743ddf3bf4688af8ee36e69264': fix volume and effect enable delay on offloaded tracks
| * fix volume and effect enable delay on offloaded tracksEric Laurent2013-09-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Volume: add a method to wake up the mediaserver playback thread when a volume command is received on an offloaded track. Effects: call effect chain process on offloaded playback threads asynchronously from writes to allow effect state updates while waiting for async write callback. Bug: 10796540. Change-Id: Id2747ae88783575d1d7ffd6fc86fbd054ab2c739
* | am bf5e2397: am 5baf2af5: more support for audio effect offloadEric Laurent2013-09-181-4/+2
|\ \ | |/ | | | | | | * commit 'bf5e23979a03da96ce1d63126c480103232f174b': more support for audio effect offload
| * more support for audio effect offloadEric Laurent2013-09-181-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Offloading of audio effects is now enabled for offloaded output threads. If an effect not supporting offload is enabled, the AudioTrack is invalidated so that it can be recreated in PCM mode. Fix some issues in effect proxy related to handling of effect commands to offloaded and non offloaded effects. Also fixed a bug on capture index in software Visualizer effect. Bug: 8174034. Change-Id: Ib23d3c2d5a652361b0aaec7faee09102f2b18fce
* | am 8a910716: am 6ca83fad: Merge "audioflinger: no effects on offloaded ↵Eric Laurent2013-09-091-0/+6
|\ \ | |/ | | | | | | | | | | tracks" into klp-dev * commit '8a910716892d17a2ac62c7e9884af0e9d75b26bc': audioflinger: no effects on offloaded tracks
| * audioflinger: no effects on offloaded tracksEric Laurent2013-09-091-0/+6
| | | | | | | | | | | | | | | | | | | | | | Invalidate offloaded tracks when an effect is enabled so that the track is recreated in PCM mode and the effect can be applied. This is temporary until effect offloading is implemented. Bug: 8174034. Change-Id: I77b8b54a10db6cb8334be76d863ea7e720eaad09
* | am f94b2946: am 56b59224: Merge "Add IAudioTrack::getTimestamp()" into klp-devGlenn Kasten2013-08-291-0/+1
|\ \ | |/ | | | | | | * commit 'f94b2946a511c5cbb6b9001449ca8278cb332bda': Add IAudioTrack::getTimestamp()
| * Add IAudioTrack::getTimestamp()Glenn Kasten2013-08-291-0/+1
| | | | | | | | | | | | | | | | | | | | with dummy implementation in AudioFlinger::TrackHandle, and implement AudioTrack::getTimestamp() using IAudioTrack. Also document invariant that mAudioTrack and control block are always non-0 after successful initialization. Change-Id: I9861d1454cff7decf795d5d5898ac7999a9f3b7e
* | Status pointer passed by caller is always non-NULLGlenn Kasten2013-08-121-3/+3
|/ | | | | | | in createTrack, openRecord, createEffect, createTrack_l, createRecordTrack_l, and createEffect_l. Change-Id: I2e459e4de9c78145f4d496e6abf289479a2f0941
* IAudioFlinger::openRecord track_flags_t flags is in/outGlenn Kasten2013-08-021-1/+1
| | | | | | This will allow AudioFlinger to tell client it is denying a request. Change-Id: Iff2be3ad6636371bbda9c9899a283c94620c1f06
* Move control block mName to createTrack() outputGlenn Kasten2013-07-301-0/+1
| | | | | | | This is part of a series of CLs to clean up the shared memory control block, by removing any fields that don't have to be there. Change-Id: I6e51003a1293b6800258c31b22cff2eba42162e7
* Declare methods in binder opcode orderGlenn Kasten2013-07-291-1/+2
| | | | Change-Id: I5f624b7a51ffe1a17a67c056cf984f74e4c56eac
* AudioFlinger: offload playback, non-blocking writeEric Laurent2013-07-251-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | - Added specialized playback thread class for offload playback, derived from directoutput thread. This thread type handles specific state transitions for offloaded tracks and offloading commands (pause/resume/drain/flush..) to audio HAL. As opposed to other threads, does not go to standby if the track is paused. - Added support for asynchronous write and drain operations at audio HAL. Use a thread to handle async callback events from HAL: this avoids locking playback thread mutex when executing the callback and cause deadlocks when calling audio HAL functions with the playback thread mutex locked. - Better accouting for track activity: call start/stop and release Output methods in audio policy manager when tracks are actually added and removed from the active tracks list. Added a command thread in audio policy service to handle stop/release commands asynchronously and avoid deadlocks with playback thread. - Track terminated status is not a state anymore. This condition is othogonal to state to permitted state transitions while terminated. Change-Id: Id157f4b3277620568d8eace7535d9186602564de
* Use AudioSystem::setLowRamDevice() to configure memoryGlenn Kasten2013-07-191-0/+11
| | | | | Bug: 9798886 Change-Id: I9321e3f369f1ed9429ae222e3926ebdeb012b8b0
* Revert "Fix Audioflinger crash when TeeSink is enabled"Glenn Kasten2013-07-191-3/+2
| | | | | | | This reverts commit 84e391686d7eced293913d1d7993721224ee0ba1. Bug: 8834855 Change-Id: I8211ef5ea5d87d97ada115723df31c8057f38ca8
* Public API changes for audio offload support.Richard Fitzgerald2013-06-271-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NOTE: this does _not_ include all private member variables added to classes as part of offload support. Only public/protected functions and stubs functions/variables needed to make the changes buildable. - isOffloadSupported() added to audio policy service A stub implementation is required to build, this always returns false - setParameters() added to IAudioTrack A stub implementation is required to build, this always returns INVALID_OPERATION - CBlk flag for stream end - Change AudioSystem::getRenderPosition() to take an audio_output_t so caller can specify which output to query - Add AudioSystem::isOffloadSupported() This is fully implemented down to the AudioFlinger function AudioPolicyServer::isOffloadSupported() which is just a stub that always returns false. - Add EVENT_STREAM_END to AudioTrack interface. STREAM_END is used to signal when the hardware has actually finished playing all the data it was sent. - Add event type enumeration to media player interface AudioSink callbacks so that the same callback can be used to handle multiple types of event. For offloaded tracks we also have to handle STREAM_END and TEAR_DOWN events - Pass audio_offload_info_t to various functions used for opening outputs, tracks and audio players. This passes additional information about the compressed stream down to the HAL when using offload. For publicly-available APIs this is an optional parameter (for some of the internal and low-level APIs around the HAL interface it is mandatory) - Add getParameters() and setParameters() API to AudioTrack Currently dummy implementations. - Change AudioPlayer contructor so that it takes a set of bitflags defining what options are required. This replaces the original bool which only specified whether to use deep buffering. - Changes to StageFright class definition related to handling tearing-down of an offloaded track when we need to switch back to software decode - Define new StageFright utility functions used for offloaded tracks Currently dummy implementations. - AudioFlinger changes to use extended audio_config_t. Fills in audio_offload_info_t member if this info is passed in when opening an output. - libvideoeditor changes required to add the new event type parameter to AudioSink callback functions - libmediaplayerservice changes required to add the new event type parameter to AudioSink callback functions Change-Id: I3ab41138aa1083d81fe83b886a9b1021ec7320f1 Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com> Signed-off-by: Eric Laurent <elaurent@google.com>
* New control block for AudioTrack and AudioRecordGlenn Kasten2013-06-121-0/+1
| | | | | | | | Main differences between old and new control block: - removes the mutex, which was a potential source of priority inversion - circular indices into shared buffer, which is now always a power-of-2 size Change-Id: I4e9b7fa99858b488ac98a441fa70e31dbba1b865
* make libaudioflinger symbols visibility hiddenMathias Agopian2013-05-091-2/+4
| | | | | | | we export only symbols needed by clients of this library. this saves about 130KB (1/3rd of the lib size) Change-Id: Id81f3ecb299ee3abc0811915cf6efe87180bf15c
* Fix Audioflinger crash when TeeSink is enabledGlenn Kasten2013-05-061-2/+3
| | | | | Bug: 8834855 Change-Id: I54665f16d79901970348a8247d9a354da2990f42
* Remove tee sink debugging at compile timeGlenn Kasten2013-02-261-0/+6
| | | | | Bug: 8223560 Change-Id: Iddbfb06c45d43d9f20bb428215dd4094931e19a7
* Update tee sinkGlenn Kasten2013-02-221-0/+17
| | | | | | | | | | Implement rotation to reduce long-term storage use. Implement optional per-track tee. Dynamically enable at runtime based on property, instead of at compile-time. Dynamic frame count not yet implemented. Bug: 8223560 Change-Id: I3706443c6ec0cb0c6656dc288715a02ad5fea63a
* Revert "Temporary additional logging to investigate bug"Glenn Kasten2013-02-151-1/+1
| | | | | | This reverts commit 32584a7d672864b20ab8b83a3cb23c1858e908b7 Change-Id: I9dc680578b955b1af462eeb7a49d61a0d45eb81b
* Temporary additional logging to investigate bugGlenn Kasten2013-02-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bug appears related to continuing to use an invalid buffer provider in fast mixer after track destruction, so focus the added logs in that area. Also includes a bug fix: was calling log in an unsafe place near Threads.cpp AudioFlinger::PlaybackThread::createTrack_l line 1250. Details: - include caller pid or client pid where appropriate - increase log buffer size - log mFastIndex when AudioMixer sees an invalid bufferProvider. - log both potentially modified and actually modified tracks in FastMixer. - fix benign bug where sq->end() was called more than once. - log StateQueue push() call and return. - increase StateQueue size from 4 to 8 entries - log mixer->enable(), bufferProvider, and currentTrackMask - log buffer provider addresses - increase fast mixer log buffer again - check logf format vs. argument list compatibility - add logging to AudioMixer - add checking of magic field in AudioMixer to detect overwrites - add bool AudioMixer::enabled() - increase log buffer sizes yet again - enable assertion checking without ALOGV - improve a few log messages - check for corruption in more places - log in all the process hooks - add new mixer APIs so we can check for corruption of mixer state - fix a build warning Bug: 6490974 Change-Id: Ib0c4a73dcf606ef9bd898313b3b40ef61ab42f51