summaryrefslogtreecommitdiffstats
path: root/media/libmedia/IAudioFlinger.cpp
Commit message (Collapse)AuthorAgeFilesLines
* When passing a size_t via binder, use 64-bits unconditionallyGlenn Kasten2014-02-131-10/+10
| | | | | | | | | 64-bits is almost always over-kill. But it's easier and cleaner to change the binder code to be accurate, than to rename all the the API parameter types to be 32-bit. Bug: 12381724 Change-Id: Ib8f198d814a2027760ef24e9e3feacee21a973b1
* Make frameworks/av 64-bit compatibleKévin PETIT2014-02-111-4/+4
| | | | | | | | | | | | 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-1/+4
| | | | | | | | | | | 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 "Cleanup openRecord error handling" into klp-devGlenn Kasten2013-10-071-0/+12
|\
| * Cleanup openRecord error handlingGlenn Kasten2013-09-241-0/+12
| | | | | | | | | | Bug: 10888816 Change-Id: I84897dd7d30b370640b54e928f230604b873cb68
* | soundpool: allocate shared memory heap by clientEric Laurent2013-09-241-5/+22
|/ | | | | | | | | | | | | | | | | | | | | | | Current SoundPool implementation allocates the shared memory heap containing decoded PCM samples in mediaserver process. When mediaserver process crashes, the shared memory heaps allocated by AudioCache cannot be mapped anymore in the new instance of mediaserver. This causes a silent failure to end playback of new sounds because AudioFlinger believes the new AudioTracks are opened in streaming mode and not static mode: it sees a NULL shared memory pointer when the track is created. The fix consists in allocating the memory heap in the client process. Thus the heap is not lost when mediaserver restarts. The global memory usage is the same as this is shared memory. Also added a way to detect that a shared memory is passed when the track is created but cannot be mapped on mediaserver side. Also fix a crash in SoundPool when ALOGV is enabled. Bug: 10894793. Change-Id: Ice6c66ec3b2a409d75dc903a508b6c6fbfb2e8a7
* IAudioFlinger::openRecord track_flags_t flags is in/outGlenn Kasten2013-08-021-3/+9
| | | | | | 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-1/+5
| | | | | | | 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
* libmedia: offloaded playback supportRichard Fitzgerald2013-07-251-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | - start() returns a status so that upper layers can recreate a non offloaded track in case of error. - Added states to handle offloaded tracks specific: - waiting for stream end (drain) notification by audio flinger - allow pause while waiting for stream end notification - getPosition() queries the render position directly from audio HAL. - disable APIs not applicable to offloaded tracks - Modified track restoring behavior for invalidated offloaded tracks: just send the callback and wait for upper layers to create a new track. - Added wait for stream end management in audio track client proxy. Similar to obtainBuffer and should be factored in. Change-Id: I0fc48117946364cb255afd653195498891f622bd Signed-off-by: Eric Laurent <elaurent@google.com>
* Use AudioSystem::setLowRamDevice() to configure memoryGlenn Kasten2013-07-191-0/+16
| | | | | Bug: 9798886 Change-Id: I9321e3f369f1ed9429ae222e3926ebdeb012b8b0
* Explicitly compare raw pointers to NULLGlenn Kasten2013-07-021-18/+20
| | | | Change-Id: Id2c7828a36a6912333465475b21fa87e294c83c7
* Public API changes for audio offload support.Richard Fitzgerald2013-06-271-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Remove unnecessary parameterGlenn Kasten2012-12-181-12/+4
| | | | | | Just get the parameter on server side Change-Id: I433a63104dbb257e0d862be2ab61847cb36d1c15
* Remove last bits of IAudioFlinger::channel_countGlenn Kasten2012-11-301-19/+1
| | | | Change-Id: I9e13678e0aa32a86eb27367a4aff4b32b8aec8cc
* Fix time vs. bytes units bug in getRenderPositionGlenn Kasten2012-11-161-1/+1
| | | | | | | Rename correctLatency since it requires thread to be locked. Use size_t for byte and frame counts. Change-Id: I178fdd18bdb823813b9563927bdff8c0d28ca5a5
* Use size_t for frame countsGlenn Kasten2012-11-151-10/+10
| | | | | | Also fix typo: bufferCount should be frameCount. Change-Id: Ibed539504db75ef99dc21c8ff1bf2987122063a5
* Use uint32_t for sample rateGlenn Kasten2012-11-141-1/+1
| | | | Change-Id: Ie240b48fb54b08359f69ecd4e5f8bda3d15cbe80
* Fix build warningsGlenn Kasten2012-11-141-1/+1
| | | | Change-Id: Ic43bcca166a529a6431711b05a7fa21849b6a38b
* Remove CBLK_FAST from control block flagsGlenn Kasten2012-11-061-3/+9
| | | | | | This is part of a series to clean up the control block. Change-Id: Ic881a3560d9547cb63fcc0cefec87aa3da480e0d
* Line length 100Glenn Kasten2012-11-011-2/+4
| | | | Change-Id: Ib28fd7b9ce951a6933f006e7f8812ba617625530
* Implement android.media.AudioManager.getProperty()Glenn Kasten2012-09-251-1/+30
| | | | | Bug: 6635041 Change-Id: I3386a4a6c226bc4eceaf65556119e4fb15f73224
* Use audio_channel_mask_t for channel maskGlenn Kasten2012-07-171-1/+1
| | | | Change-Id: I1c1896da48983aa9f1462a4b471f910498816f60
* Add tid parameter to IAudioFlinger::openRecordGlenn Kasten2012-07-121-1/+4
| | | | | | Not yet implemented Change-Id: I35523fb15ad71727ecc9f4bb870f07e4b7397dc4
* Use audio_channel_mask_t more consistentlyGlenn Kasten2012-07-031-10/+15
| | | | | | | | | | | | | | | In IAudioFlinger::createTrack() and IAudioFlinger::openRecord(), declare input parameter to use correct type audio_channel_mask_t. In IAudioFlinger::getInputBufferSize(), input parameter is now channel mask instead of channel count. Remove unused IAudioFlinger::channelCount(audio_io_handle_t). In AudioRecord::getMinFrameCount() and AudioSystem::getInputBufferSize(), input parameter is channel mask instead of channel count. Change-Id: Ib2f1c29bea70f016b3cfce83942ba292190ac965
* Configure policy of mediaserver threadsGlenn Kasten2012-04-221-1/+4
| | | | Change-Id: Ifd825590ba36996064a458f64453a94b84722cb0
* rename audio policy output flagsEric Laurent2012-04-181-2/+2
| | | | Change-Id: I27c46bd1d1b2b5f96b87af7d05b951fef18a1312
* audio policy: load audio hw modules.Eric Laurent2012-04-041-43/+62
| | | | | | | | | | | 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
* IAudioFlinger::createTrack and openRecord flagsGlenn Kasten2012-03-191-9/+6
| | | | | | | | | | | | | | | | | | | | 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
* Whitespace and indentationGlenn Kasten2012-03-131-9/+9
| | | | | | | | | | | | | | 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
* Use audio_policy_output_flags_t consistentlyGlenn Kasten2012-03-091-3/+3
| | | | | | | | | | This affects: - IAudioFlinger::openOutput - AudioTrack::AudioTrack - AudioTrack::set - apps that call these Change-Id: I26fb281bac6cb87593d17697bc9cb37a835af205
* Upintegrate Audio Flinger changes from ICS_AAHJohn Grossman2012-02-161-1/+4
| | | | | | | | Bring in changes to audio flinger made to support timed audio tracks and HW master volume control. Change-Id: Ide52d48809bdbed13acf35fd59b24637e35064ae Signed-off-by: John Grossman <johngro@google.com>
* Follow raw pointer and sp<> conventionsGlenn Kasten2012-02-101-1/+1
| | | | | | | | Unconditional delete for raw pointers. Use "if (sp != 0)" not "if (sp.get() != 0)" or "if (sp != NULL)". Use "if (raw != NULL)" not "if (raw)". Change-Id: I531a8da7c37149261ed2f34b862ec4896a4b785b
* Use audio_io_handle_t consistently instead of intGlenn Kasten2012-02-081-75/+79
| | | | | | | | Other: - add a comment to nextUniqueId - made ThreadBase::mId const, since it is only assigned in constructor. Change-Id: I4e8b7bec4e45badcde6274d574b8a9aabd046837
* Effect UUID inputs passed by pointer are constGlenn Kasten2012-02-081-1/+1
| | | | Change-Id: I1f5c338bcb7368e3dd8cd5f804b2e6d9fbe087f8
* Declare more IAudioFlinger methods constGlenn Kasten2012-02-031-7/+8
| | | | | | | This is just documentation, as C++ method const-ness doesn't mean anything for a binder API. Instead, here const means "no side effects". Change-Id: Iaa9cd2fe477db10ae9a40cac4f79f0faa9b4e5e6
* Merge "Use audio_in_acoustics_t consistently"Glenn Kasten2012-02-031-4/+4
|\
| * Use audio_in_acoustics_t consistentlyGlenn Kasten2012-01-271-4/+4
| | | | | | | | Change-Id: I0a9dd668fb2e57b1c3ece3190588194974b99062
* | Use NULL not 0 for raw pointersGlenn Kasten2012-02-031-1/+1
|/ | | | | | Use if (p != NULL) instead of if (ptr) Change-Id: Iaec3413a59ccbf233c98fcd918cc7d70ac5da9fa
* Use audio_format_t consistently, continuedGlenn Kasten2012-01-201-16/+16
| | | | | | | | | | | | 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 "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-18/+18
|/ | | | | | | | | 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
* Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGESteve Block2012-01-081-3/+3
| | | | | | | See https://android-git.corp.google.com/g/#/c/157220 Bug: 5449033 Change-Id: Ic9c19d30693bd56755f55906127cd6bd7126096c
* Rename (IF_)LOGV(_IF) to (IF_)ALOGV(_IF) DO NOT MERGESteve Block2011-10-261-2/+2
| | | | | | | See https://android-git.corp.google.com/g/#/c/143865 Bug: 5449033 Change-Id: I0122812ed6ff6f5b59fe4a43ab8bff0577adde0a
* Keep effects sessions active when the caller dies.Marco Nelissen2011-08-091-1/+31
| | | | | | | | 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
* Use channel mask instead of channel count for track creationJean-Michel Trivi2011-06-011-7/+7
| | | | | | | | | | | | | | | | | 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
* Removed interface to load audio effects librariesEric Laurent2011-05-271-48/+0
| | | | | | | Removed unused functions allowing dynamic loading of audio effects libraries from effects factory API. Change-Id: I06cc5a51dc10aca87c7a8687bbb874babd711eca
* Fix issue 3371080Eric Laurent2011-02-031-16/+0
| | | | | | | | | | | | | | | | | | | | | | 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
* Audio policy manager changes for audio effectsEric Laurent2010-07-201-1/+21
| | | | | | | | | | | | | | | 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
* Various fixes and improvements in audio effects implementationEric Laurent2010-06-251-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Effect API: - Use different definitions for audio device, channels, formats... in AudioSystem and EffectApi: Removed media/AudioCommon.h file created for initial version of EffectApi - Indicate audio session and output ID to effect library when calling EffectCreate(). Session ID can be useful to optimize the implementation of effect chains in the same audio session. Output ID can be used for effects implemented in audio hardware. - Renamed EffectQueryNext() function to EffectQueryEffect() and changed operating mode: now an index is passed for the queried effect instead of implicitly querying the next one. - Added CPU load and memory usage indication in effects descriptor - Added flags and commands to indicate changes in audio mode (ring tone, in call...) to effect engine - Added flag to indicate hardware accelerated effect implementation. - Renamed EffectFactoryApi.h to EffectsFactoryApi.h for consistency with EffectsFactory.c/h Effect libraries: - Reflected changes in Effect API - Several fixes in reverb implementation - Added build option TEST_EFFECT_LIBRARIES in makefile to prepare integration of actual effect library. - Replaced pointer by integer identifier for library handle returned by effects factory Audio effect framework: - Added support for audio session -1 in preparation of output stage effects configuration. - Reflected changes in Effect API - Removed volume ramp up/down when effect is inserted/removed: this has to be taken care of by effect engines. - Added some overflow verification on indexes used for deferred parameter updates via shared memory - Added hardcoded CPU and memory limit check when creating a new effect instance Change-Id: I43fee5182ee201384ea3479af6d0acb95092901d