summaryrefslogtreecommitdiffstats
path: root/media/libmedia/AudioTrack.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* | Add playback rate to AudioTrackAndy Hung2015-04-091-15/+118
| | | | | | | | | | Bug: 19196501 Change-Id: I6411e1d3ce652b711a71a6d9df020cb5f60d4714
* | Adding explicit routing API to AudioTrackPaul McLean2015-04-081-7/+26
|/ | | | Change-Id: I40c048c7644c46f4e4f7103875206c0785c4b1dc
* Reject sample rate changes for fast tracksAndy Hung2015-03-311-3/+7
| | | | | | | This is needed for a SoundPool fix. Bug: 19970735 Change-Id: I46b69e059aabf0d06b16b31ea436bb71f7146750
* set() in AudioRecord and AudioTracks needs no lockGlenn Kasten2015-03-231-2/+1
| | | | Change-Id: I9d61b3d117e9b21fbbfad772d8981a5abb8fafae
* LoggingGlenn Kasten2015-03-231-8/+9
| | | | | | | | | | Move log of latency to where it is first computed. Log more parameters when a fast track is denied by client. Log session ID in destructor. Remove obsolete ALOGV that were for debugging a particular problem. Log more parameters of set(). Change-Id: I0156bceaf397f2faa053214572c57136705685ee
* Merge "Fix position when restoring streaming audio track"Andy Hung2015-03-231-1/+1
|\
| * Fix position when restoring streaming audio trackAndy Hung2015-03-201-1/+1
| | | | | | | | | | Bug: 19802225 Change-Id: I19ca7836bc89627f6cead4961641b94c6b27b5f6
* | Update AudioTrack code to match AudioRecordGlenn Kasten2015-03-231-2/+9
| | | | | | | | | | | | | | session ID check buffer error code check Change-Id: I092a61adfd249122f9127dceedf67c0a3bdcfe7b
* | namespace does not need a closing semicolonGlenn Kasten2015-03-231-1/+1
| | | | | | | | Change-Id: Ie8f9d42fc061f6d558f23b98414e04eb3d14b376
* | Declare and initialize in one statementGlenn Kasten2015-03-231-4/+2
|/ | | | Change-Id: Ie8593692907e67558f9d7654c9a4bf8cbce99bd8
* fix flush on HW A/V sync tracksEric Laurent2015-03-091-0/+3
| | | | | | | | | | | | Fix mismatch between track flags on client and server side when HW A/V sync is requested. The audio track was connected to a direct output by the audio policy manager but the client failed to set the direct flag when creating the track resulting in the direct flag not being set in audio flinger. Bug: 19665934. Change-Id: I0a5257b20bf76c9c4d89bc2ad9b44777b81f13bf
* Allow TRANSFER_OBTAIN to be used for fast tracksGlenn Kasten2015-03-091-1/+3
| | | | Change-Id: I8fa20c26f076567b38210af4a680fe1cb2eacee4
* AudioTrack::obtainBuffer() now returns number of non-contiguous framesGlenn Kasten2015-03-091-2/+2
| | | | Change-Id: I1f61d7e3d057c3254babe456b4aa0f6a1809da55
* AudioTrack::releaseBuffer parameter is const *Glenn Kasten2015-03-091-1/+1
| | | | Change-Id: I31ac20863107de05b83cd7f8cd7dd61bed98e456
* AudioTrack obtain/release buffer commentsGlenn Kasten2015-03-091-0/+1
| | | | Change-Id: I0eb178d1ab4eea7f72f4c55852c19b216ca55f5f
* Change AudioTrack resampling buffers from 3 to 2Andy Hung2015-02-061-59/+23
| | | | | | | | | | | | | Move computation of minimum AudioTrack buffer size to server for normal streaming PCM tracks. Use server-side computation to exactly determine requirements for the resampler to avoid triple buffering. This reduces latency for normal audio tracks that require resampling, and makes things consistent with the minimum buffer size. Change-Id: I2f2ca0e599ee20e16559bc5c5dab61ed100da16c
* Allow AUDIO_FORMAT_PCM_8_BIT AudioTrack buffersAndy Hung2015-01-141-46/+15
| | | | | | | | Previously conversion to AUDIO_FORMAT_PCM_16_BIT was required. Client shared memory for static tracks and AudioFlinger track creation and buffer delivery now use native 8 bit PCM data. Change-Id: I485c07a4971fde9a25442bd43fed95019d39abcc
* Fix cumulative error in setPositionNotificationPeriodAndy Hung2015-01-071-2/+3
| | | | | | | | Time for AudioTrackThread sleep due to periodic notification needs to be computed from actual position. External reported AOSP issue 65807. Change-Id: Ic46b64588e6c5803afcd8252cde8837eb3fbf6ff
* Event driven wake for AudioTrackThread notification changesAndy Hung2015-01-061-2/+25
| | | | | | Used for setMarkerPosition and setPositionUpdatePeriod. Change-Id: I0d94b929438a5cd94b295d7c1884f876fae8b5e7
* Improve AudioTrack EVENT_LOOP_END and EVENT_BUFFER_END accuracyAndy Hung2015-01-061-11/+40
| | | | | | | | Fix timing computation to consider current position. Fix EVENT_LOOP_END count accuracy (some could be dropped before) for non-infinite loop static AudioTracks. Change-Id: I255f692915b55ab6f08ccd6a2365fee3f5d0a4fe
* Fix loop and position restoration in static AudioTracksAndy Hung2015-01-061-27/+26
| | | | | | | | Allow restoration of loop and position. Make position and loop synchronously readable. Bug: 17964637 Change-Id: I8cfb5036e665f55fdff5c67d27e1363ce9a8665d
* Fix loop and position setting in static AudioTracksAndy Hung2015-01-051-16/+21
| | | | | | | Allow independent setting of position and loop. Bug: 17964637 Change-Id: I8b3bd97a244b932728b68da7684044f2636984a5
* am d33712d7: am 145cf5d8: Merge "audioflinger: implement pause/resume for ↵Eric Laurent2014-12-171-0/+5
|\ | | | | | | | | | | | | direct outputs" into lmp-mr1-dev * commit 'd33712d7ec5dcf427cc0be9b7d2ca1c99823c8e6': audioflinger: implement pause/resume for direct outputs
| * audioflinger: implement pause/resume for direct outputsEric Laurent2014-12-161-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extend pause/resume support to direct output threads (was only for offload threads). If the HAL implements pause/resume, track pause/resume is forwarded to the HAL. Pause, flush, resume sequence is respected by executing the HAL calls in the playback thread (same as offload). Make sure the track flags on client side are consistent with the flags on server side. Bug: 17883772. Change-Id: I89b360d69818f7a9204bd36e3ec63a79e106ecf1
* | am c49d9cda: am 2dda40d6: Merge "audio policy: add support for custom mixes" ↵Eric Laurent2014-12-101-0/+8
|\ \ | |/ | | | | | | | | | | into lmp-mr1-dev * commit 'c49d9cda49dab8b7dd0376cf56476b3e1895d5c6': audio policy: add support for custom mixes
| * audio policy: add support for custom mixesEric Laurent2014-12-091-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for custom mixes in AudioPolicyManager. Two methods are added to register or unregister a list of custom mixes with their attributes and format. getOutputForAttr() and getInputForAttr() first look for a match in registered mixes before defaulting to normal output/input selection Remote submix device connection disconnection now takes address into account to identify the correspnoding custom mix. Bug: 16009464. Change-Id: I3f1c2a485a0fb71b1f984ed0adc9b68aa971e408
| * Track volume should be maintained even if track is restoredseunghak.han2014-12-051-1/+5
| | | | | | | | | | | | | | | | If track is restored when it set its volume to a non-unity value (such as mute), the volume was forced to unity again. Now, the previous volume is restored. Bug: 18570664 Change-Id: I79f34c6c7d6f535baba813fd3b8ba8e55cac8ad7
* | am bde85d05: am 5458756a: Merge "Track volume should be maintained even if ↵Glenn Kasten2014-12-021-1/+5
|\ \ | | | | | | | | | | | | | | | | | | track is restored" * commit 'bde85d05414cdd3888071635dd05e9ff78679d5e': Track volume should be maintained even if track is restored
| * | Track volume should be maintained even if track is restoredseunghak.han2014-12-011-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | If track is restored when it set its volume to a non-unity value (such as mute), the volume was forced to unity again. Now, the previous volume is restored. Bug: 18570664 Change-Id: I79f34c6c7d6f535baba813fd3b8ba8e55cac8ad7
* | | am 390ef843: am f20c4356: Merge "AudioRecord: use audio attributes instead ↵Eric Laurent2014-11-271-1/+5
|\ \ \ | | |/ | |/| | | | | | | | | | | | | of audio source." into lmp-mr1-dev * commit '390ef84373b7edd1397381f780ca235326357094': AudioRecord: use audio attributes instead of audio source.
| * | AudioRecord: use audio attributes instead of audio source.Eric Laurent2014-11-251-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added AudioRecord constructor with audio attributes. Replaced AudioPolicymanager::getInput() by getInputForAttr(). No new functionality for now. Also: - Fixed warnings in AudioPolicyManager - Allocate audio session ID before calling getOutputForAttr() in AudioTrack. Bug: 16006090. Change-Id: I15df21e4411db688e3096dd801cf579d76d81711
* | | am bf14c62e: am 72bf901c: Merge "audio policy: new getOutputForAttr() ↵Eric Laurent2014-11-261-177/+25
|\ \ \ | |/ / | | | | | | | | | | | | | | | prototype." into lmp-mr1-dev * commit 'bf14c62e7973ed793a3b00c2c67beca4484c1c7a': audio policy: new getOutputForAttr() prototype.
| * | Merge "audio policy: new getOutputForAttr() prototype." into lmp-mr1-devEric Laurent2014-11-261-177/+25
| |\ \
| | * | audio policy: new getOutputForAttr() prototype.Eric Laurent2014-11-251-177/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update getOutputForAttr() prototype and group all logic dealing with audio attributes to stream type conversion in audio policy manager. getOutputForAttr(): - specifies the audio session (for future use) - returns a status code - receives either stream type (for legacy) or audio attributes - returns an updated streamtype Remove logic dealing with legacy stream types to attributes conversion from AudioTrack. Use correct type for audio sessions in other APIs (startOutput() ...). releaseOutput() specifies the audio session (for future use). Bug: 18067208. Change-Id: I1bfbe9626c04c7955d77f8a70aecfad2cb204817
* | | | am 1e18795a: am d325005e: Merge "Fix AudioTrack loop mode to play audio from ↵Andy Hung2014-11-261-2/+1
|\ \ \ \ | |/ / / | | | | | | | | | | | | | | | | | | | | buffer start" into lmp-mr1-dev * commit '1e18795a4847e9368baa7ecee146d3901b283cd0': Fix AudioTrack loop mode to play audio from buffer start
| * | | Merge "Fix AudioTrack loop mode to play audio from buffer start" into ↵Andy Hung2014-11-251-2/+1
| |\ \ \ | | |/ / | |/| | | | | | lmp-mr1-dev
| | * | Fix AudioTrack loop mode to play audio from buffer startAndy Hung2014-11-241-2/+1
| | | | | | | | | | | | | | | | | | | | Bug: 18217633 Change-Id: Ica77acf0a32832d9b04eb657ef2f4f5329f8fbda
* | | | am 1a475921: am 223fd5c9: audio: new routing strategies and stream typesEric Laurent2014-11-261-1/+1
|\ \ \ \ | |/ / / | | | | | | | | | | | | * commit '1a475921c0577a4650d1bbe40a85b732d1766939': audio: new routing strategies and stream types
| * | | audio: new routing strategies and stream typesEric Laurent2014-11-211-1/+1
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added new routing strategies and stream type for internal use by audio policy manager and audio flinger: - One for accessibility to allow different routing than media - One for re-routing (remote submix) in preparation of dynamic policies - Added stream type for "internal" audio flinger tracks used for audio patches and duplication. Bug: 18067208. Change-Id: I88f884b552e51e4a49c29125e5a1204cf58ff434
* | | am bfa77b5c: am 8cd37d67: Merge "audio policy: do not prevent routing to ↵Eric Laurent2014-11-181-0/+5
|\ \ \ | |/ / | | | | | | | | | | | | | | | A2DP when suspended." into lmp-mr1-dev * commit 'bfa77b5c687f217e26267693306aaa6cc8a63672': audio policy: do not prevent routing to A2DP when suspended.
| * | audio policy: do not prevent routing to A2DP when suspended.Eric Laurent2014-11-171-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow A2DP sink selection even if A2DP is suspended. It is not because use of A2DP is temporarily disabled by SCO selection that the policy rule routing a given use case to A2DP should be altered. The source will be routed to A2DP but it will remain silent until suspend condition is cleared which is the purpose of suspend mode. Also make sure that accessibility prompts are audible while in call by forcing stream type to STREAM_VOICE_CALL. Fix inconsistent logic between AudioTrack::setStreamTypeFromAttributes() and AudioPolicyManager::getStrategyForAttr() Bug: 18095151. Change-Id: I1c75dd8288ed3dd494eb942060eac9c9660dca50
* | | resolved conflicts for merge of e78a27ca to lmp-mr1-dev-plus-aospMarco Nelissen2014-11-171-3/+3
|\ \ \ | |/ / |/| / | |/ Change-Id: If10a9cc17245f95d5e10b1507445abbb4020670e
| * Update calls to IInterface::asBinder()Marco Nelissen2014-11-171-3/+3
| | | | | | | | | | | | | | | | | | | | | | to use the new static version. Change-Id: Ia7b10eb38ca55b72278bfd33d3bf647f338b4e6a Conflicts: media/libmedia/IAudioFlinger.cpp media/libmedia/IMediaPlayer.cpp media/libstagefright/CameraSource.cpp
* | remove AudioSystem::getOutputSamplingRateForAttr()Eric Laurent2014-11-121-15/+15
| | | | | | | | | | | | | | | | It is safer to query the output sampling rate once the output have been acquired by calling getOutputForAttr(). Bug: 16009464. Change-Id: Ib561facd19fba5359a6b837d75f1a1cd2dc51b29
* | Improve AudioTrack recovery from mediaserver deathGlenn Kasten2014-11-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Fix race condition in handling of binder death notifications. AudioSystem has a mixture of APIs for both ordinary app clients, and the AudioFlinger and AudioPolicy services within mediaserver. Due to this mix of uses, it is possible for there to be "surprising" sequences of calls on the call stack. Previously, we used a single mutex for all global variables, but this caused a deadlock. To avoid the deadlock, we unlocked the mutex during the critical sequence of calls. But this was a a crucial place where it should have stayed locked; see Change-Id I315c1c5066f62b05e1c13b04fae1272b5fbce977 Now we use separate mutexes for the AudioFlinger, AudioPolicy, and audio port related global variables. This allows us to correctly hold each mutex throughout the atomic region, even when AudioFlinger calls AudioPolicy via AudioSystem, or vice-versa. 2. AudioSystem::clearAudioConfigCache now clears the IAudioFlinger reference. 3. Make AudioSystem::get_audio_policy_service more like get_audio_flinger. Bug: 18242291 Change-Id: I9761443d8337df5bf66d4ca2316a9fd0bd11be94
* | Merge "audio: fix talkback why alarm is playing" into lmp-mr1-devEric Laurent2014-11-041-4/+11
|\ \
| * | audio: fix talkback why alarm is playingEric Laurent2014-11-031-4/+11
| |/ | | | | | | | | | | | | | | | | Convert attributes usage "assistance accessibility" to a stream type guarantying that the prompt is audible and not muted by policy manager. Bug: 17994328. Change-Id: I89f53f2ce84b499b859336c0a1a3a0332ee670f5
* | Support speaker routing for FLAG_BEACONJean-Michel Trivi2014-10-311-2/+10
|/ | | | | | | | | | | | | | | | | | | | Add support for routing audio stream to the speaker when audio attributes carry the FLAG_BEACON value: - associate streams with FLAG_BEACON to the up-to-now unused STREAM_TTS ("Transmitted Through Speaker"). The remapping happens in AudioTrack. - AudioPolicyManager: define new strategy for handling the Beacon behavior, that only goes to speaker. Define new volume curves for STREAM_TTS that are not silence only for the speaker device category. Keep ref count of other streams and never play Beacon streams when anything else is playing: either don't start playback if something else is playing, or unmute STREAM_TTS when it's allowed to play and mute when it's done. - Take into account muting latency when starting an output. Bug 15415971 Change-Id: I26539c7ec1a486accd85bbeb1623e9c7d3a1192f
* Fix AudioTrack retrograde getPosition when restoring tracksAndy Hung2014-10-171-1/+4
| | | | | | | | | | | mReleased represents the number of frames written to the track, but was cleared on start() causing a mismatch if the client wrote to the track before starting. Moved the clearing to entering the STATE_STOPPED or STATE_FLUSHED state. Bug: 18017947 Bug: 18022276 Change-Id: I3788c98c4c3c4d9cc004378432797b3f3138e22e
* AudioTrack: fix AudioTrackThread crash upon exitEric Laurent2014-10-071-0/+3
| | | | | | | | | | | In case of error during createTrack_l(), there is a possibility that a newly created AudioTrackThread is resumed by requestExit() just after entering the Thread class _threadLoop() but before entering the class threadLoop(). In this case, processAudioBuffer() is executed once with mCblk == 0 and we assert. Bug: 17894033. Change-Id: I93d0d0d4dbf14bcb88dad23e6ad49d2ecd47badd