summaryrefslogtreecommitdiffstats
path: root/media/libmedia/AudioTrack.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Added support for auxiliary audio effects to AudioTrack and MediaPlayer.Eric Laurent2010-07-211-3/+11
| | | | | | | | Added methods to AudioTrack and MediaPlayer java classes to enable use of auxiliary audio effects. The effect can be attached and detached by specifying its ID and the send level controlled. Change-Id: Ie74ff54a453096a742688476f612ce355543b6f3
* Added support for audio sessions in MediaPlayer and AudioTrack.Eric Laurent2010-06-221-2/+4
| | | | | | Audio sessions are used to associate audio effects to particular instances (or groups) of MediaPlayers or AudioTracks. Change-Id: Ib94eec43241cfcb416590f435ddce7ab39a07640
* media: add AudioTrack::getMinFrameCount().Chia-chi Yeh2010-06-211-0/+29
| | | | Change-Id: If15162583d1d16d89f59be0793106afe77417f35
* Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack ↵Eric Laurent2010-06-031-9/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | modifications. First drop of audio framework modifications for audio effects support. - AudioTrack/AudioRecord: Added support for auxiliary effects in AudioTrack Added support for audio sessions Fixed left right channel inversion in setVolume() - IAudioFlinger: Added interface methods for effect enumeraiton and instantiation Added support for audio sessions. - IAudioTrack: Added method to attach auxiliary effect. - AudioFlinger Created new classes to control effect engines in effect library and manage effect connections to tracks or output mix: EffectModule: wrapper object controlling the effect engine implementation in the effect library. There is one EffectModule per instance of an effect in a given audio session EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session. EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks with same session ID. Each chain contains a variable number of EffectModules EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles. Added support for effect modules and effect chains creation in PlaybackThread. modified mixer thread loop to allow track volume control by effect modules and call effect processing. -AudioMixer Each track now specifies its output buffer used by mixer for accumulation Modified mixer process functions to process tracks by groups of tracks with same buffer Modified track process functions to support accumulation to auxiliary channel Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
* Fix issue 2553359: Pandora does not work well with Passion deskdock / Cardock.Eric Laurent2010-05-171-73/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem is due to a too big difference between the buffer size used at the hardware interface and at the A2DP interface. When no resampling occurs we don't notice problems but the timing is very tight. As soon as resampling is activated, the AudioTrack underruns. This is because the AudioTrack buffers are not resized when moving the AudioTrack from hardware to A2DP output. The AudioTrack buffers are calculated based on a hardware output buffer size of 3072 bytes. Which is much less than the A2DP output buffer size (10240). The solution consists in creating new tracks with new buffers in AudioFlinger when the A2DP output is opened instead of just transfering active tracks from hardware output mixer thread to the new A2DP output mixer thread. To avoid synchronization issues between mixer threads and client processes, this is done by invalidating tracks by setting a flag in their control block and having AudioTrack release the handle on this track (IAudioTrack) and create a new IAudioTrack when this flag is detected next time obtainBuffer() or start() is executed. AudioFlinger modifications: - invalidate the tracks when setStreamOutput() is called - make sure that notifications of output opening/closing and change of stream type to output mapping are sent synchronously to client process. This is necessary so that AudioSystem has the new stream to output mapping when the AudioTrack detects the invalidate flag in the client process. Previously their were sent when the corresponding thread loop was executed. AudioTrack modifications: - move frame count calculation and verification from set() to createTrack() so that is is updated every time a new IAudioTrack is created. - detect track invalidate flag in obtainBuffer() and start() and create a new IAudioTrack. AudioTrackShared modifications - group all flags (out, flowControlFlag, forceReady...) into a single bit filed to save space. Change-Id: I9ac26b6192230627d35084e1449640caaf7d56ee
* libutils Condition are now PRIVATE by defaultMathias Agopian2010-03-191-2/+4
| | | | | | | | | | | Condition must be initialized with SHARED for the old behavior, where they can be used accross processes. Updated the two places android that require SHARED conditions. PRIVATE conditions (and mutexes) use more efficient syscalls. Change-Id: I9a281a4b88206e92ac559c66554e886b9c62db3a
* Simplify the MemoryDealer implementationMathias Agopian2010-01-291-1/+0
| | | | | | | | | | | | | | At some point the implementation became complicated because of SurfaceFlinger's special needs, since we are now relying on gralloc we can go back to much simpler MemoryDealer. Removed HeapInterface and AllocatorInterface, since those don't need to be paramterized anymore. Merged SimpleMemory and Allocation. Made SimplisticAllocator non virtual. Removed MemoryDealer flags (READ_ONLY, PAGE_ALIGNED) Removed a lot of unneeded code.
* Issue 2265163: Audio still reported routed through earpiece on sholesEric Laurent2009-11-191-12/+10
| | | | | | | | | | | | | This is a second attempt to fix the audio routed to earpiece syndrom. The root cause identified this time is the crash of an application having an active AudioTrack playing on the VOICE_CALL stream type. When this happens, the AudioTrack destructor is not called and the audio policy manager is not notified of the track stop. Results a situation where the VOICE_CALL stream is considered as always in use by audio policy manager which makes that audio is routed to earpiece. The fix consists in moving the track start/stop/close notification to audio policiy manager from AudioTrack to AudioFlinger Track objet. The net result is that in the case of a client application crash, the AudioFlinger TrackHandle object (which implements the remote side of the IAudioTrack binder interface) destructor is called which in turn destroys the Track object and we can notify the audio policy manager of the track stop and removal. The same modification is made for AudioRecord although no bug related to record has been reported yet. Also fixed a potential problem if record stop is called while the record thread is exiting.
* Improvements for issue 2197683: English IME key-press latency is noticeably ↵Eric Laurent2009-11-111-9/+18
| | | | | | | | | higher on passion than sholes This change goes with a kernel driver change that reduces the audio buffer size from 4800 bytes (~27ms) to 3072 bytes (~17ms). - The AudioFlinger modifcations in change 0bca68cfff161abbc992fec82dc7c88079dd1a36 have been removed: the short sleep period was counter productive when the AudioTrack is using the call back thread as it causes to many preemptions. - AudioFlinger mixer thread now detects long standby exit time and in this case anticipates start by writing 0s as soon as a track is enabled even if not ready for mixing. - AudioTrack::start() is modified to start call back thread before starting the IAudioTrack so that thread startup time is masked by IAudioTrack start and mixer thread wakeup time.
* Fix issue 2203561: Sholes: audio playing out of earpiece.Eric Laurent2009-11-041-60/+103
| | | | | | | | | | | Create a new IAudioTrack interface to AudioFlinger when start() fails due to a broken pipe error. Do the same if start fails due to the same error after time out in obtainBuffer(). Do not indicate that the AudioTrack is started to AudioPolicyManager if IAudioTrack start fails. This avoids that an AudioTrack keeps a dead IAudioTrack after a media server crash. Same modifications for AudioRecord. Add a flag to ToneGenerator indicating that the callback thread can call Java. Without it, when the media server crashes and restarts, the AudioSystem error callback will crash in JNI if the IAudiotrack is created from AudioTrack callback thread.
* Fix problem in AudioTrack with 8 bit PCM and direct output.Eric Laurent2009-08-041-4/+4
| | | | Do not perform 8 to 16 bit conversion in AudioTrack write() and processAudioBuffer() if direct output flag is set.
* Fix issue 1795088 Improve audio routing codeEric Laurent2009-07-231-73/+116
| | | | | | | Initial commit for review. Integrated comments after patch set 1 review. Fixed lockup in AudioFlinger::ThreadBase::exit() Fixed lockup when playing tone with AudioPlocyService startTone()
* add a ctor to Mutex to specify the type, which can be shared. This is used ↵Mathias Agopian2009-07-131-1/+1
| | | | by sf and af an soon will allow some optimization in the kernel for non shared mutexes
* am 88e209dc: Fix issue 1743700: AudioTrack: setPlaybackRate can not set the ↵Eric Laurent2009-07-071-15/+8
|\ | | | | | | | | | | | | | | | | playback rate to twice of the ouputSR Merge commit '88e209dcf8c2ebddda5c272f46d1bd5478bc639c' * commit '88e209dcf8c2ebddda5c272f46d1bd5478bc639c': Fix issue 1743700: AudioTrack: setPlaybackRate can not set the playback rate to twice of the ouputSR
| * Fix issue 1743700: AudioTrack: setPlaybackRate can not set the playback rate ↵Eric Laurent2009-07-071-15/+8
| | | | | | | | | | | | | | | | to twice of the ouputSR Store sample rate on 32 bits instead of 16 bits in audio_track_cblk_t. Removed sampleRate() methods from AudioTrack and AudioRecord: replaced by getSampleRate(). AudioTrack::setSampleRate() no returns a status.
* | move libbinder's header files under includes/binderMathias Agopian2009-05-201-3/+3
|/
* Fix issue 1745312: Various cleanups in media frameworkEric Laurent2009-04-211-6/+6
| | | | | | | | | | | | | | | | | | | | | | AudioTrack, AudioRecord: - remove useless mAudioFlinger member of AudioTrack and AudioRecord. - signal cblk.cv condition in stop() method to speed up stop completion. - extend wait condition timeout in obtainBuffer() when waitCount is -1 to avoid waking up callback thread unnecessarily AudioFlinger: - remove some warnings in AudioFlinger.cpp. - remove function AudioFlinger::MixerThread::removetrack_l() as its content is never executed. - remove useless call to setMasterVolume in AudioFlinger::handleForcedSpeakerRoute(). - Offset VOICE_CALL stream volume to reflect actual volume that is never 0 in hardware (this fix has been made in the open source): 0.01 + v * 0.99. AudioSystem.java: - correct typo in comment IAudioflinger, IAudioFlingerClient: - make AudioFlinger binder interfaces used for callbacks ONEWAY. AudioHardwareInterface: - correct routeStrings[] table in AudioHardwareInteface.cpp
* Automated import from //branches/donutburger/...@140663,140663Jean-Michel Trivi2009-03-241-2/+13
|
* auto import from //branches/cupcake_rel/...@140373The Android Open Source Project2009-03-181-3/+1
|
* auto import from //depot/cupcake/@136594The Android Open Source Project2009-03-051-1/+8
|
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-0/+1021
|
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-1011/+0
|
* auto import from //depot/cupcake/@132589The Android Open Source Project2009-03-031-10/+3
|
* auto import from //depot/cupcake/@137055The Android Open Source Project2009-03-021-3/+10
|
* auto import from //branches/cupcake/...@132276The Android Open Source Project2009-02-191-1/+1
|
* auto import from //branches/cupcake/...@131421The Android Open Source Project2009-02-131-8/+7
|
* auto import from //branches/cupcake/...@130745The Android Open Source Project2009-02-101-5/+9
|
* auto import from //branches/cupcake/...@127101The Android Open Source Project2009-01-201-31/+51
|
* auto import from //branches/cupcake/...@125939The Android Open Source Project2009-01-091-15/+7
|
* Code drop from //branches/cupcake/...@124589The Android Open Source Project2008-12-171-142/+542
|
* Initial ContributionThe Android Open Source Project2008-10-211-0/+596