summaryrefslogtreecommitdiffstats
path: root/services
Commit message (Collapse)AuthorAgeFilesLines
* Add NOTICE and MODULE_LICENSE_APACH2 to libs build under /frameworks/av/James Dong2012-06-136-0/+570
| | | | | Change-Id: I0a3af3e2abdedebd5934f3d941d01c32cfc75e26 related-to-bug: 6647465
* Add audio watchdog threadGlenn Kasten2012-06-115-0/+264
| | | | Change-Id: I4ed62087bd6554179abb8258d2da606050e762c0
* Reduce underruns in screen off, esp. with EQGlenn Kasten2012-06-085-17/+88
| | | | | | | | | | | | Add MonoPipe APIs to specify setpoint. Use screen state to configure pipe setpoint. Fix a long-standing bug where pipe sleep time was excessive, which interacted poorly with governor and low clock frequencies. Now it deducts the elapsed time since last write(), which was significant when there was EQ and low clock frequency. Bug: 6618373 Change-Id: I6f3b0072c2244aeb033ef0795ad164491a164ff5
* audioflinger: fix duplicating thread standbyEric Laurent2012-06-071-9/+8
| | | | | | | | | | | | | | The code that waits for a track presentation to be complete before disabling it caused a regression for duplicating threads. Because of the way output tracks activity is managed, the number of frames output by the duplicating thread would never reach the target set for a track to be considered presented. The track would not be removed from active list and the thread would not go to standby and keep its wakelock held. Bug 6606922. Change-Id: I4b46b420ac4cbf79a86b6791ae6589d407b01c92
* Merge "Take latency and current time into account for visualization" into jb-devMarco Nelissen2012-06-072-0/+31
|\
| * Take latency and current time into account for visualizationMarco Nelissen2012-06-072-0/+31
| | | | | | | | | | | | | | | | | | | | Buffer more data, and return the data that is currently being output from the audio output, to ensure that visualizations are smooth and responsive even when the audio output has a large latency and/or large buffers. b/6522728 Change-Id: I401637f01be7600b3c594a55c869036c13b206c0
* | audioflinger: modify fast mixer overrun managementEric Laurent2012-06-061-1/+4
|/ | | | | | | | | | Do not force sleep when an overrun occurs. This was for non blocking audio HAL and is unused. Keep statistics on overruns. Bug 6605215. Change-Id: I295455d4562201aa3814c88bdd6e52c9226712af
* audioflinger: various fixes on direct outputEric Laurent2012-06-053-124/+33
| | | | | | | | | | | | Various fixes in direct output playback thread implementation: - threadLoop_write() was broken for playback threads that do not use a pipe sink. - output buffer size calculation was hard coded for stereo. - removed software volume that was implemented for PCM stereo format only: the audio HAL has to implement volume if needed for direct outputs. Change-Id: If211b4489be9af395435707b8cf0388cce1347b2
* audioflinger: fix active sleep time calculation.Eric Laurent2012-06-041-8/+1
| | | | | | | | | | | | | | | | | When an audioTrack underruns, the audioflinger mixer thread sleeps for a certain time to give the app a chance to recover. This time is based on the reported audio HAL latency. Some audio HALs implementing deep buffering have a variable latency and this creates a problem if the sleep time is cached when the output stream is opened and not updated afterwards. This change derives the active sleep time from the mix buffer framecount instead of the latency. This is more conservative but works for variable latency. Bug 6588525. Change-Id: Ia892fc290fe06f836565c3ae15f7a2ce026c88c6
* State queue dumpGlenn Kasten2012-06-045-0/+121
| | | | | Bug: 6591648 Change-Id: Iac75e5ea64e86640b3d890c46a636641b9733c6d
* Fast track dumpsysGlenn Kasten2012-06-033-3/+44
| | | | | Bug: 6591648 Change-Id: I696f51c682e7233ba690d97da26012084989b412
* Count underruns for normal tracks alsoGlenn Kasten2012-06-031-1/+2
| | | | | Bug: 6591648 Change-Id: Iff9cabe392bb2ce97062603adb9c9dc7aa4170d5
* Merge "Was calculating measured warmup time wrong" into jb-devGlenn Kasten2012-06-031-0/+1
|\
| * Was calculating measured warmup time wrongGlenn Kasten2012-06-011-0/+1
| | | | | | | | | | Bug: 6592923 Change-Id: I980c6fc69d78c569147ea44ce33a7f8a41739c91
* | Merge "Fix fast track leak if out of normal track names" into jb-devGlenn Kasten2012-06-012-9/+11
|\ \
| * | Fix fast track leak if out of normal track namesGlenn Kasten2012-05-312-9/+11
| |/ | | | | | | | | Bug: 6580402 Change-Id: I3ac7f012062c35833147f47ba822eb4bf532a824
* | Merge "Pipe throttle based on requested frame count" into jb-devGlenn Kasten2012-06-012-41/+24
|\ \ | |/ |/|
| * Pipe throttle based on requested frame countGlenn Kasten2012-05-302-41/+24
| | | | | | | | | | | | | | | | | | Now does throttling based on the requested frame count, but still permits overfilling pipe up to the rounded-up frame count. Also still uses the larger frame count for non-blocking arithmetic. Bug: 6585323 Change-Id: Ic2420a071419905524a14c22ebe1ce0e32d70a9d
* | Merge "audioflinger: fix effect problem during underrun" into jb-devEric Laurent2012-05-302-2/+37
|\ \ | |/ |/|
| * audioflinger: fix effect problem during underrunEric Laurent2012-05-302-2/+37
| | | | | | | | | | | | | | | | | | | | | | When an audio track underruns, the input buffer of the corresponding effect chain (if any) must be cleared, otherwise audio from previous mixer run will be fed again to the effect process function. Bug 6551652. Change-Id: I5cd02196745f756c85af82d6937e9dc54369b37f
* | DO NOT MERGE: Minimal fix for takePicture/previewCallback deadlockEino-Ville Talvala2012-05-292-18/+45
|/ | | | | | | | | | | | | - Caused by already held lock in camera service - Introduce one more lock, mICameraLock, to control access to camera client through ICamera binder interface. - mLock is released before calling HAL takePicture, allowing HAL callbacks to access camera client during takePicture processing. Bug: 5804701 Change-Id: Ibcef4857a2c844c964afefa70f9cdccdd0a55fd0
* audioflinger: change session check in createTrack.Eric Laurent2012-05-241-7/+3
| | | | | | | | | | | | | | Do not refuse to create a track on an output thread if the same session is present on another thread. It is now possible that two tracks with the same session ID are on different threads if one can use deep buffering and the other can't. In this case, move effects attached to this session to the output thread ion which the new track is created. Bug 6530324. Change-Id: I9019b3ee382e374c89d2319033afcfa7f886e4c4
* audioflinger: refine latency latency calculation.Eric Laurent2012-05-223-1/+23
| | | | | | | | | | | | There is an audio pipe between the normal mixer output and the fast mixer to cope for scheduling delays and buffer size difference. This pipe depth was not taken into account in latency calculation. Adding the pipe contribution to the latency significantly improves A/V sync. Bug 6520569. Change-Id: I5584908e8aa8a02170eb38b22b4370eea800a235
* Keep a copy of most recent audio playedGlenn Kasten2012-05-217-3/+90
| | | | Change-Id: I6b2f97881c39998a2fae9ab79d669af6c0a37e94
* Add throttle to have pipe fill at more stable rateGlenn Kasten2012-05-182-17/+58
| | | | Change-Id: Ibff9ab62764e2acd04518a4a00e25f19e28aff4a
* systrace for audioGlenn Kasten2012-05-173-5/+27
| | | | | | | | | | Trace fast track buffer fill status for underruns etc. Move the definition of macro to Android.mk. No overhead if disabled. Change-Id: If0e83e21b61b059ca38f543f8a6ffb58e08c79ee
* Merge "Display pipe underrun counters in dumpsys" into jb-devGlenn Kasten2012-05-172-2/+7
|\
| * Display pipe underrun counters in dumpsysGlenn Kasten2012-05-172-2/+7
| | | | | | | | | | | | | | | | The normal mixer writes it's submix to a pipe, which is read by the fast mixer. Now dumpsys media.audio_flinger display the raw underrun counters when fast mixer tries to pull from the pipe but doesn't get enough frames. Change-Id: I72505f149f9e12802784da654a651d43734e1c79
* | Skip bad kHz values, and display them accuratelyGlenn Kasten2012-05-171-6/+9
|/ | | | | | | | One device reports zero CPU kHz occasionally, so skip those values. Preserve accuracy of the low-order 4 bits of the the CPU frequency. Change-Id: I7d934f697412277462464fca82d112d0306a214e
* Increase normal mixer's pipe to fast mixerGlenn Kasten2012-05-151-3/+4
| | | | Change-Id: I330925c7d07b6adb30b773bda3657e4efef9ae9b
* Fix static track activity ref countingEric Laurent2012-05-152-2/+16
| | | | | | | | | | | When a static AudioTrack underruns, it means that playback is over. As apps do not necessarily stop playback explicitly, AudioFlinger should call stopOutput() to decrease activity ref count in audio policy manager. Bug 6486311. Change-Id: I1ea722c443780329ded6310c958b24726e918d16
* Fix issues with synchronous record start.Eric Laurent2012-05-142-32/+71
| | | | | | | | | | | | | | | | - Added a timeout in case the trigger event is never fired. - Extend AudioRecord obtainBuffer() timeout in case of synchronous start to avoid spurious warning. - Make sure that the event is triggered if the track is destroyed. - Reject event if the triggering track is in an incompatible state. Also fix a problem when restoring a static AudioTrack after a mediaserver crash. Bug 6449468. Change-Id: Ib36e11111fb88f73caa31dcb0622792737d57a4b
* Reduce video frame drop rateGlenn Kasten2012-05-141-10/+36
| | | | | | | | | | | | | | The video playback engine depends on having relatively precise audio progress updates for its A/V sync and frame drop calculations. For small audio HAL buffer sizes, this was not a problem, but when the HAL buffer size was > 12 ms, the normal mix buffer size became > 24 ms and this then caused video problems. The new formula tries to keep the normal mix buffer size within a closer tolerance of 20 ms to 24 ms. Also use consistent term: multiplier instead of multiple. Bug: 6479613 Change-Id: I903bad74461908e8c8f0a61e99ab5e24d5c44433
* Improve underrun handling for fast tracksGlenn Kasten2012-05-144-29/+97
| | | | | | | Maintain more accurate accounting of type of underrun. Automatically remove track from active list after a series of "empty" underruns. Change-Id: If042bf80e1790dcaaf195c99dc9c0ed9b55382c1
* Fix stopping process for fast tracksGlenn Kasten2012-05-142-34/+87
| | | | | | | | | | | | Previously, the state of a fast track "wiggled" back and forth at the end. Now it goes through these transitions: active -> stopping_1 -> stopping_2 -> stopped This CL is only for fast tracks, and does not change how normal tracks work. Change-Id: Icc414f2b48c46dda63cfa6373ca22d033dd21cd4
* AudioFlinger: fix global effects suspend logicEric Laurent2012-05-121-1/+3
| | | | | | | Audio effects on the output mix should not be suspended when effects on the output stage (post processing) are enabled. Change-Id: I2e1c08fa9358ea3cbaec68856738d504b1be54e4
* Fix 2 bugs in fast mixer statisticsGlenn Kasten2012-05-111-2/+2
| | | | | | Was losing the upper half of the bounds, and MHz was off. Change-Id: I61c98027b35ce7c3578ea6f3acf05aa5c48a5831
* Use audio tag for system tracingGlenn Kasten2012-05-102-0/+13
| | | | | | Disabled by default; uncomment ATRACE_TAG to enable Change-Id: I99af894022a859ee5644bd853cfd8a48e4735ff9
* Update fast mixer statisticsGlenn Kasten2012-05-102-22/+128
| | | | | | | | | | | | | | | Compute statistics on fast mixer elapsed time and CPU load per cycle using a simple moving average rather than by fixed blocks. This has a couple advantages: - remove burstiness of CPU usage due to former floating-point calculations in fast mixer - gives us flexibility in how to report (e.g. could report over just the last 1 second) Disadvantage is increased RAM, and since the samples are not updated atomically, it is possible to have an error in the statistics. This should not be much of an issue due to the relatively large number of samples. Also add CPU raw ns and adjusted MHz statistics. Change-Id: Iaa2cd13f18250c3162aff40409b3694b769d9505
* dumpsys fCnt and flagsGlenn Kasten2012-05-071-5/+6
| | | | | | | | | Previously displayed TrackBase::mFrameCount but not control block frameCount. Now displays both. Also display the track flags in control block. Change-Id: Ie53781d4784633d78b6f928d69ebd494d8f110ec
* Disable fast track log spamGlenn Kasten2012-05-011-1/+1
| | | | | | except for "denied by client" and "denied by server" Change-Id: I133ab747933729cc1f386813ee06ece055bdb294
* Temporary fix for both normal tracks & fast tracksGlenn Kasten2012-04-302-3/+9
| | | | | | | If there is at least one active fast track, it forces a mixer status of ready, which messes up the logic for normal track underruns. Change-Id: I9de2fcaef090e2c2f99682333af3d3dd618b0d6b
* Fix race condition for non-started fast tracksGlenn Kasten2012-04-308-152/+406
| | | | | | | | | | | | | | | | | | | | | This required re-implementing how fast tracks are considered active. Now, they use the same logic as normal tracks, except underrun is ignored. Other changes: - add framesReady() to AudioBufferProvider interface - rebased - add track underrun counter state to fast mixer dump state - move dumpsys header to Track::appendDumpHeader() so it closer to where tracks are dumped - display track state in dumpsys as a character code - measure and display warmup time and cycles in dumpsys - copy in the presentation complete code - add ExtendedAudioBufferProvider for framesReady() which returns size_t - simplify underrun tracking - deferred reset track after stop() - add comments Change-Id: I7db8821bc565230ec76da1f9380fe3fb09735e5b
* AudioFlinger: fix stop detection for static tracksEric Laurent2012-04-272-2/+5
| | | | | | | | | | | | | | | The end of playback and end of presentation detection was broken for static AudioTracks (tracks using shared memory buffers passed by client). The mixer should not wait for a minimal amount of frames to be available to mix a static track otherwise the last frames might never be consumed. A static track should be removed from active list in case of underrun even if not stopped(). Issue 6411521. Change-Id: I66a2c1a77e98149e5049a223a6f04c3b8c5ad11a
* Fast mixer configurationGlenn Kasten2012-04-271-35/+74
| | | | | | | | | | | Add compile-time option for when to use fast mixer. Double HAL frame count for fast tracks due to SRC, and make the normal frame count multiplier an even number for compatibility. Sample rate conversion can result in underruns if the HAL frame count is used as is, due to jitter. Change-Id: Ia1f8da1b8ac247d9807acfce3c318161db000905
* AudioFlinger: fix tracks ready for mixing logic.Eric Laurent2012-04-262-13/+8
| | | | | | | | | | | | Commit fec279f5 broke the logic allowing to wait for an application to provide frames for mixing in the case of several active tracks. This was causing audio gaps when playing music and superposing a sound Fx (keyboard clicks...). Issue 6185007. Change-Id: Id0fad150d0b615646d6b1387c0de8ca944d228f6
* Move frame count calculations for fast tracksGlenn Kasten2012-04-251-10/+28
| | | | | | | | | | | | | | | | | | | | | For fast tracks: move the default and minimum frame count calculations from client to server. If accepted, the default and minimum frame count is the fast mixer (HAL) frame count. If denied, the default and minimum frame count is the same as it currently is for normal tracks. For normal tracks: there is no change yet, preserve legacy behavior for now but add a FIXME to change this later. Bug fix: the test for buffer alignment matches channelCount was wrong. Bug fix: check for 8-bit data in shared memory, which isn't supported. Optimizations: - in set(), only call AudioSystem::getOutputSamplingRate() when needed - in createTrack_l(), only call AudioSystem::getSamplingRate() and AudioSystem::getFrameCount() when needed Change-Id: I79d2fe507db1a8f7bb094c71da8a129951dbb82f
* Use scheduling policy serviceGlenn Kasten2012-04-246-1/+213
| | | | Change-Id: I3c09da1dc0de5039d0c15ce7fb2bc373fa398712
* AudioFlinger normal mixer uses FastMixerGlenn Kasten2012-04-234-53/+609
| | | | Change-Id: I3131bb22d2d057e9197a2ebfa6aa1cfaab9e5321
* Configure policy of mediaserver threadsGlenn Kasten2012-04-223-37/+42
| | | | Change-Id: Ifd825590ba36996064a458f64453a94b84722cb0