summaryrefslogtreecommitdiffstats
path: root/include/private/media
Commit message (Collapse)AuthorAgeFilesLines
* Add template class SingleStateQueueGlenn Kasten2013-03-051-0/+35
| | | | Change-Id: If7e2bc9b2a216524ee9cbb68682e2634933b4973
* Start isolating control block accesses in a proxyGlenn Kasten2012-12-121-45/+183
| | | | | | | | | | | | | | | | | | | | | The proxy object will eventually be the only code that understands the details of the control block. This should make it easier to change the control block in the future. Initial set of control block fields that are isolated: - sample rate - send level - volume Prepare for streaming/static separation by adding a union to the control block for the new fields. Fix bug in handling of max sample rate on a track. It was only checking at re-configuration, not at each mix. Simplify OutputTrack::obtainBuffer. Change-Id: I2249f9d04f73a911a922ad1d7f6197292c74cd92
* am ba6b1bc3: am e7550eb2: Merge "Initialize and copy mRotationAngle in ↵Andreas Huber2012-11-301-1/+3
|\ | | | | | | | | | | | | VideoFrame" * commit 'ba6b1bc38e0c355277f69af286469adb5f02e876': Initialize and copy mRotationAngle in VideoFrame
| * Initialize and copy mRotationAngle in VideoFrameChrister Fletcher2012-11-301-1/+3
| | | | | | | | | | | | | | | | | | | | | | When thumbnails were generated they could be generated at random angles as the mRotationAngle variable was not initialized to any value. This variable would have to be explicitly overwritten to not cause random rotation. Changed the implementation to initialize the value to 0 (no rotation). mRotationAngle was also missing in the copy constructor. Change-Id: I67a5340fdd807c6ab3a3da5eecb09b5b9d5f4666
* | Don't use control block frame count after createGlenn Kasten2012-11-161-11/+18
| | | | | | | | | | | | This is part of a series to clean up the control block. Change-Id: I7f4cb05aef63053f8e2ab05b286d302260ef4758
* | Update audio commentsGlenn Kasten2012-11-141-1/+2
| | | | | | | | Change-Id: I85d7d2f6381b251db5695202fec75128883a8662
* | Simplify AudioRecord::restoreTrack_l()Glenn Kasten2012-11-131-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Finish removing CBLK_RESTORING and CBLK_RESTORED from control block flags, and remove constant RESTORE_TIMEOUT_MS. Also minor cleanup: - Cache mCblk in local variable cblk and make cblk allocatable in a register. - Use "iMem" for sp<IMemory>. - Add missing error log to AudioRecord; it was already in AudioTrack. This is part of a series to clean up the control block. Change-Id: Ia5f5ab4763c392bc06a45851b167ddaee29e3455
* | Move frame size out of the control blockGlenn Kasten2012-11-121-5/+2
| | | | | | | | | | | | This is part of a series to clean up the control block. Change-Id: Ifab1c42ac0f8be704e571b292713cd2250d12a3f
* | Move buffers pointer out of the control blockGlenn Kasten2012-11-081-4/+5
| | | | | | | | | | | | This is part of a series to clean up the control block. Change-Id: Ie474557db7cb360f2d9a0f11600a68f5a3d46f07
* | Simplify AudioTrack::restoreTrack_l()Glenn Kasten2012-11-081-0/+2
| | | | | | | | | | | | | | | | | | Remove CBLK_RESTORING and CBLK_RESTORED from control block flags, for AudioTrack only. They are still used by AudioRecord. This is part of a series to clean up the control block. Change-Id: Iae4798f5b527c492bdaf789987ff3a1dadd0cb37
* | Remove CBLK_DIRECTION from control block flagsGlenn Kasten2012-11-071-12/+26
| | | | | | | | | | | | This is part of a series to clean up the control block. Change-Id: I0265fece3247356b585d4d48fbda6f37aea8a851
* | Remove CBLK_FAST from control block flagsGlenn Kasten2012-11-061-1/+0
| | | | | | | | | | | | This is part of a series to clean up the control block. Change-Id: Ic881a3560d9547cb63fcc0cefec87aa3da480e0d
* | Simplify control block flag namesGlenn Kasten2012-11-051-22/+9
| | | | | | | | | | | | Use only one symbol per flag Change-Id: Ia3582e2134abd60c896d11337face65383e79c7c
* | Line length 100Glenn Kasten2012-11-011-2/+4
|/ | | | Change-Id: Ib28fd7b9ce951a6933f006e7f8812ba617625530
* Log track name on obtain/releaseBuffer warningsGlenn Kasten2012-06-131-3/+1
| | | | | | | This should help diagnose problems by allowing us to correlate the logs with the dumpsys media.audio_flinger output. Change-Id: I8c7c592b4f87d13b0f29c66ce7a2f301a0f063c9
* Configure policy of mediaserver threadsGlenn Kasten2012-04-221-0/+1
| | | | Change-Id: Ifd825590ba36996064a458f64453a94b84722cb0
* Whitespace and indentationGlenn Kasten2012-03-131-5/+5
| | | | | | | | | | | | | | 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
* Update commentsGlenn Kasten2012-02-141-6/+23
| | | | | | We no longer put the filename at start of file. Change-Id: Ic435b159a23105681e3d4a6cb1ac097bc853302e
* Don't double destruct audio_track_cblk_tGlenn Kasten2012-02-031-0/+1
| | | | | | | | | Fortunately audio_track_cblk_t doesn't have a destructor, but for clarity remove the double destruction. Also add warning not to add any virtuals to audio_track_cblk_t. Change-Id: I70ebe1a70460c7002145b2cdf10f9f137396e6f3
* Make AudioTrack control block volume field privateGlenn Kasten2012-01-201-1/+14
| | | | | | | This is part of the process of abstracting the control block to make it easier to maintain. Change-Id: Idb8f461e68dab3bcf268159cc0781651c6fb7094
* Track volume cleanupGlenn Kasten2012-01-171-4/+7
| | | | | | | | | | | | | | | | | | | | Always read and write track volumes atomically. In most places this was already being done, but there were a couple places where the left and right channels were read independently. Changed constant MAX_GAIN_INT to be a uint32_t instead of a float. It is always used as a uint32_t in comparisons and assignments. Use MAX_GAIN_INT in more places. Now that volume is always accessed atomically, removed the union and alias for uint16_t volume[2], and kept only volumeLR. Removed volatile as it's meaningless. In AudioFlinger, clamp the track volumes read from shared memory before applying master and stream volume. Change-Id: If65e2b27e5bc3db5bf75540479843041b58433f0
* Merge "Use size_t for frame size"Glenn Kasten2012-01-171-1/+1
|\
| * Use size_t for frame sizeGlenn Kasten2012-01-131-1/+1
| | | | | | | | | | | | | | | | | | except in the control block, where we don't have room. In AudioFlinger::ThreadBase::TrackBase::getBuffer, read the frame size from control block only once. Change-Id: Id6c4bccd4ed3e07d91df6bbea43bae45524f9f4e
* | AudioTrack and AudioFlinger send level cleanupGlenn Kasten2012-01-131-1/+16
|/ | | | | | | | | | | Add an API to control block for getting/setting send level. This allow us to make the mSendLevel field private. Document the lack of barriers. Use 0.0f to initialize floating-point values (for doc only). Change-Id: I59f83b00adeb89eeee227e7648625d9a835be7a4
* Audio C++ commentsGlenn Kasten2011-12-141-2/+2
| | | | Change-Id: I84906ebb9dfcfa5b96b287d18364b407f02a30c1
* Remove unnecessary level of priority indirectionGlenn Kasten2011-06-011-1/+0
| | | | Change-Id: I942d43973c20a7ace8b0d3f78b4da97e45e996c6
* Use channel mask instead of channel count for track creationJean-Michel Trivi2011-06-011-1/+2
| | | | | | | | | | | | | | | | | 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
* New fix for issue 4111672: control block flagsEric Laurent2011-04-051-4/+4
| | | | | | | | | | | | | | | The first fix (commit 913af0b4) is problematic because it makes threads in mediaserver process block on the cblk mutex. This is not permitted as it can cause audio to skip or worse have a malicious application prevent all audio playback by keeping the mutex locked. The fix consists in using atomic operations when modifying the control block flags. Also fixed audio_track_cblk_t::framesReady() so that it doesn't block when called from AudioFlinger (only applies when a loop is active). Change-Id: Ibf0abb562ced3e9f64118afdd5036854bb959428
* Fix issue 3439872: video chat and bluetooth SCOEric Laurent2011-03-081-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change fixes the stability problems experienced when using a bluetooth headset supporting both A2DP and SCO. Problems occur when starting the video chat at which time the A2DP output is being stopped to start SCO. At that time, active AudioTracks are invalidated by AudioFlinger so that a new AudioTrack binder interface can be recreated by the client process on the new mixer thread with correct parameters. The problem was that the process to restore the binder interface was not protected against concurrent requests which caused 2 binder interfaces to be created sometimes. This could lead to permanent client deadlock if one of the client threads was waiting for a condition of the first created binder interface while the second one was created (as the AudioFlinger would only signal conditions on the last one created). This concurrent request situation is more likely to happen when a client uses the JAVA AudioTrack as the JNI implementation uses simultaneously the native AudioTrack callback and write push mechanisms. By doing so, the code that checks if the binder interface should be restored (in obtainBuffer()) is much more likely to be called concurrently from two different threads. The fix consists in protecting the critical binder interface restore phase with a flag in the AudioTrack control block. The first thread acting upon the binder interface restore request will raise the flag and the second thread will just wait for a condition to be signaled when the restore process is complete. Also protected all accesses to the AudioTrack control block by a mutex to prevent access while the track is being destroyed and restored. If a mutex cannot be held (e.g because we call a callback function), acquire a strong reference on the IAudioTrack to prevent its destruction while the cblk is being accessed. Modified AudioTrack JNI to use GetByteArrayElements() instead of GetPrimitiveArrayCritical() when writing audio buffers. Entering a critical section would cause the JNI to abort if a mediaserver crash occurs during a write due to the AudioSystem callback being called during the critical section when media server process restarts. Anyway with current JNI implementation, either versions do not copy data most of the times and the criticial version does not guaranty no data copy. The same modifications have been made to AudioRecord. Change-Id: Idc5aa711a04c3eee180cdd03f44fe17f3c4dcb52
* Support extracting thumbnail from rotated video tracksJames Dong2010-11-081-0/+1
| | | | Change-Id: Ife0a2536aaac5ff1efdf1035b9d2c892773ee16c
* Issue 3032913: improve AudioTrack recovery timeEric Laurent2010-09-301-2/+5
| | | | | | | | | | | | This issue showed that when an AudioTrack underruns during a too long period of time and is therefore disabled by audioflinger mixer, it takes an additional delay of up to 3 seconds to recover. This fix adds a simple mechanism to recover immediately when the client application is ready to write data again in the AudioTrack buffer Also throttle warnings on record overflows Change-Id: I8b2c71578dd134b9e60a15ee4d91b70f3799cb3d
* Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack ↵Eric Laurent2010-06-032-1/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-11/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* AudioFlinger: rename variables to clarify reference to track channel count ↵Eric Laurent2010-05-141-1/+1
| | | | | | | | | | | or channel mask Some variables and structure members should be renamed to reflect the fact that they contain the number of channels in a track (channel count) or the actual channels used by a track (channel mask). Especially member "channels" of track control block (struct audio_track_cblk_t) is actually the number of channels (channels count). Change-Id: I220c8dede9fc00c8a5693389e790073b6ed307b8
* Fix issue 1795088 Improve audio routing codeEric Laurent2009-07-231-6/+7
| | | | | | | 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()
* Fix issue 1743700: AudioTrack: setPlaybackRate can not set the playback rate ↵Eric Laurent2009-07-071-4/+3
| | | | | | | | 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.
* auto import from //branches/cupcake_rel/...@140373The Android Open Source Project2009-03-181-1/+2
|
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-032-0/+210
|
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-032-210/+0
|
* auto import from //branches/cupcake/...@127101The Android Open Source Project2009-01-201-1/+8
|
* Code drop from //branches/cupcake/...@124589The Android Open Source Project2008-12-172-12/+151
|
* Initial ContributionThe Android Open Source Project2008-10-211-0/+64