summaryrefslogtreecommitdiffstats
path: root/include/private
Commit message (Collapse)AuthorAgeFilesLines
* Replace size_t in shared memory by uint32_tGlenn Kasten2014-01-282-6/+18
| | | | | | | Eventually we may want to use uint64_t, but will need to confirm atomicity. Bug: 12381724 Change-Id: Ia2c591d262d22b47b6f7dab4b9d9faa14b86d865
* Replace control block frameCount_ by explicit in/out parameterGlenn Kasten2013-12-201-5/+1
| | | | | | in IAudioFlinger::createTrack and IAudioFlinger::openRecord Change-Id: I09c644c80e92c8e744b1b99055988a2588b2a83d
* am 77177fa2: am 95c03858: Merge "Allow releaseBuffer after flush" into klp-devGlenn Kasten2013-10-181-2/+3
|\ | | | | | | | | * commit '77177fa20773d02b4f9c4147ecb98107f019fa7d': Allow releaseBuffer after flush
| * Allow releaseBuffer after flushGlenn Kasten2013-10-181-2/+3
| | | | | | | | | | | | | | | | | | | | | | After AudioTrack start checks for pending flush, allow releaseBuffer on any previously obtained buffer. For example, this can happen if the resampler has obtained a buffer but not released the whole buffer yet. Note that the resampler will be reading obsolete data. Bug: 11285590 Change-Id: I0614fbb62e43604aac3089cce4b7797c87a306b5
* | am 7f8c3973: am 120a8847: Merge "AudioTrack: fix head position after ↵Eric Laurent2013-10-161-0/+2
|\ \ | |/ | | | | | | | | | | restore" into klp-dev * commit '7f8c397378a7ee5abd395413be71388ad36d3ed2': AudioTrack: fix head position after restore
| * AudioTrack: fix head position after restoreEric Laurent2013-10-161-0/+2
| | | | | | | | | | | | | | | | | | | | The head position transfered to the new track by restoreTrack_l() must take into account the frames that are dropped from the old track to avoid a non recoverable offset in the playback head position returned to applications. Bug: 11230062. Change-Id: I51143a08b95e8f264ed709ae2054360315f2b8b1
* | am 11454092: am 18f86140: Merge "Fix underruns when fast track denied due to ↵Glenn Kasten2013-09-171-2/+0
|\ \ | |/ | | | | | | | | | | SRC" into klp-dev * commit '11454092e4a94d3c8b4576c981595339abdfac0d': Fix underruns when fast track denied due to SRC
| * Fix underruns when fast track denied due to SRCGlenn Kasten2013-09-171-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | OpenSL ES requests a fast track. If sample rate conversion is needed, the request is denied by server, and a larger client buffer is used to handle the higher latency of a normal track. However the client notification period was calculated based on buffer being divided into 2 sub-buffers. That resulted in the notification period being too long. The server pulls chunks that are smaller than half the total buffer. So now the client uses 3 sub-buffers when there is SRC. Also removed the 'defer wake' optimization because it was incorrect. This optimization attempted to reduce the number of wakeups of client, when server releaseBuffer knows that another releaseBuffer will be following. But there is no way for the first releaseBuffer to predict how soon the second releaseBuffer will occur. In some cases it was a long time, and the client underran. So now the client is woken up immediately if the total number of available frames to client is >= the minimum number the client wants to see (the notification period). Also fix bug where minimum frame count was not being used in the calculation of notification period. Bug: 10342804 Change-Id: I3c246f4e7bc3684a344f2cf08268dc082e338e2a
* | am 908d3c09: am 51ec03c2: Merge "Implement Track::getTimestamp()" into klp-devGlenn Kasten2013-08-291-0/+3
|\ \ | |/ | | | | | | * commit '908d3c09ca7f2ccb280aa5dc8d876099ff9a9d0f': Implement Track::getTimestamp()
| * Implement Track::getTimestamp()Glenn Kasten2013-08-291-0/+3
| | | | | | | | | | | | | | using a new timestamp latch in PlaybackThread, and AudioTrackServerProxy::framesReleased() which returns mServer. Change-Id: I1ebfba968c773faaab95648c272fd3ebd74718d6
* | WhitespaceGlenn Kasten2013-08-131-1/+1
|/ | | | Change-Id: Id3ccc183a03421330d0498faaa62a45915cdc3d6
* Report underruns for fast tracks alsoGlenn Kasten2013-07-311-0/+9
| | | | | | | | | | | | | | | | | | | | | | | This fixes a regression that was introduced earlier by commit 9f80dd223d83d9bb9077fb6baee056cee4eaf7e5 called "New control block for AudioTrack and AudioRecord". That commit broke underrun reporting for fast tracks. Also remove Track::mUnderrunCount, which counted the number of underrun events, and was only used by dumpsys media.audio_flinger. Now dumpsys media.audio_flinger reports the number of underrun frames, Isolated underrun-related control block accesses via the proxy, so that the server is not directly poking around in the control block. The new proxy APIs are AudioTrackServerProxy::getUnderrunFrames() and AudioTrackServerProxy::tallyUnderrunFrames(). getUnderrunFrames() returns a rolling counter for streaming tracks, or zero for static buffer tracks which never underrun, but do a kind of 'pause' at end of buffer. tallyUnderrunFrames() increments the counter by a specified number of frames. Change-Id: Ib31fd73eb17cbb23888ce3af8ff29f471f5bd5a2
* Move control block mName to createTrack() outputGlenn Kasten2013-07-301-3/+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
* Rename control block flags to mFlagsGlenn Kasten2013-07-301-1/+2
| | | | Change-Id: I7b6d31e24531954ab1ecdf3ed56c19433700bd89
* Rename control block server to mServer and add commentsGlenn Kasten2013-07-301-3/+6
| | | | Change-Id: Ieabd91acee92d0e84e66fbd358df5282b856306e
* libmedia: offloaded playback supportRichard Fitzgerald2013-07-251-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | - 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>
* AudioFlinger: offload playback, non-blocking writeEric Laurent2013-07-251-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | - 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
* AudioTrackShared cleanupGlenn Kasten2013-07-021-2/+2
| | | | | | | | Maintain unreleased frame count on client side also (was already there on server side). Assertion failure instead of BAD_VALUE status for incorrect usage of APIs. Clean up error handling code. Change-Id: I23ca2f6f8a7c18645309ee5d64fbc844429bcba8
* Public API changes for audio offload support.Richard Fitzgerald2013-06-271-0/+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>
* Use mFutex as an event flag rather than semaphoreGlenn Kasten2013-06-241-1/+2
| | | | | | | | An event flag can be more fault-tolerant in case of loss of synchronization, as it cannot overflow. It also allows more bits to be used in the future. See http://en.wikipedia.org/wiki/Event_flag Change-Id: I01ca25d951eb263124da54bb4738f0d94ec4a48b
* New control block for AudioTrack and AudioRecordGlenn Kasten2013-06-121-124/+267
| | | | | | | | 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
* 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
* AV Android make files changesJames Dong2012-03-281-67/+0
| | | | | | | o plus a few file relocation: ActivityManager.cpp/h, SoundPool.h, etc o remove some runtime dependencies to libandroid, libandroid_runtime, etc Change-Id: I047a47c5fb361dd5cf85cd98798c39f629a75d10
* Use a status_t return type for GL functorsRomain Guy2012-03-261-0/+17
| | | | | | | | | WebView needs more fine-grained control over the behavior of the framework upon execution of the display lists. The new status_t allows WebView to requests its functor to be re-executed directly without causing a redraw of the entire hierarchy. Change-Id: I97a8141dc5c6eeb6805b6024cc1e76fce07d24cc
* 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
* remove files that moved to frameworks/nativeMathias Agopian2012-03-077-584/+0
| | | | Change-Id: I140d291e520097b1148930f736823650e08488f7
* fix libgui header locationMathias Agopian2012-02-272-2/+1
| | | | Change-Id: Iec71706cdd4f29c6904993648ce873e83ef9cafe
* libagl shouldn't export anythingMathias Agopian2012-02-271-640/+0
| | | | Change-Id: Ia823dbc56aab2a0b8a6063df4348fe6baac124c6
* remove dependency on android_native{s_priv|buffer}.hMathias Agopian2012-02-241-17/+0
| | | | Change-Id: Ie4b95f7061c240f37c504414259f92d72c4ffc89
* 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