summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/FastMixer.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert "Temporary additional logging to investigate bug"Glenn Kasten2013-02-141-43/+2
| | | | | | This reverts commit 639482c24c911b125398b31883ba6d55faebe28b Change-Id: I11f2829072ab11e18b0663024f27bf31192f1d39
* Temporary additional logging to investigate bugGlenn Kasten2013-02-141-2/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | The bug appears related to continuing to use an invalid buffer provider in fast mixer after track destruction, so focus the added logs in that area. Also includes a bug fix: was calling log in an unsafe place near Threads.cpp AudioFlinger::PlaybackThread::createTrack_l line 1250. Details: - include caller pid or client pid where appropriate - increase log buffer size - log mFastIndex when AudioMixer sees an invalid bufferProvider. - log both potentially modified and actually modified tracks in FastMixer. - fix benign bug where sq->end() was called more than once. - log StateQueue push() call and return. - increase StateQueue size from 4 to 8 entries - log mixer->enable(), bufferProvider, and currentTrackMask - log buffer provider addresses - increase fast mixer log buffer again - check logf format vs. argument list compatibility - add logging to AudioMixer - add checking of magic field in AudioMixer to detect overwrites - add bool AudioMixer::enabled() Bug: 6490974 Change-Id: I1f3f18aa62d9fbd35bc32285b669f5ba40efe28e
* Revert "Temporary additional logging to investigate bug"Glenn Kasten2013-02-141-28/+2
| | | | | | This reverts commit 0ddd56316262ac74a95e9edb595697c163136d6d Change-Id: I180a928af6f5a38d15a5efe44cd1fe927b5d961c
* Temporary additional logging to investigate bugGlenn Kasten2013-02-131-2/+28
| | | | | | | | | | | | | | | | | | | The bug appears related to continuing to use an invalid buffer provider in fast mixer after track destruction, so focus the added logs in that area. Also includes a bug fix: was calling log in an unsafe place near Threads.cpp AudioFlinger::PlaybackThread::createTrack_l line 1250. Details: - include caller pid or client pid where appropriate - increase log buffer size - log mFastIndex when AudioMixer sees an invalid bufferProvider. - log both potentially modified and actually modified tracks in FastMixer. - fix benign bug where sq->end() was called more than once. - log StateQueue push() call and return. Bug: 6490974 Change-Id: Iee7c8f40e20b6000cd8286c0ec6a14fff4a37af1
* Revert "Temporary additional logging to investigate bug"Glenn Kasten2013-02-121-16/+0
| | | | | | This reverts commit 3051df27261e9952c0e642dec548515250e85f6a Change-Id: I8bf5c3e91b65bd20de26f480c367c2854b62373c
* Temporary additional logging to investigate bugGlenn Kasten2013-02-121-0/+16
| | | | | | | | | | | | | | | The bug appears related to continuing to use an invalid buffer provider in fast mixer after track destruction, so focus the added logs in that area. Also includes a bug fix: was calling log in an unsafe place near Threads.cpp AudioFlinger::PlaybackThread::createTrack_l line 1250. Details: - include caller pid or client pid where appropriate - increase log buffer size Bug: 6490974 Change-Id: I4c030f171343fe4b483eae0ddea4427118d8d4b1
* AudioFlinger uses media.log service for loggingGlenn Kasten2013-01-311-0/+17
| | | | Change-Id: Ia0f8204334f6b233f644d897762a18c95d936b4b
* Merge "Add warning about following the design rules"Glenn Kasten2012-12-201-0/+6
|\
| * Add warning about following the design rulesGlenn Kasten2012-11-301-0/+6
| | | | | | | | Change-Id: Ic4895ed5682bad10b03e97d8015e642ee1696533
* | audioflinger: define ANDROID_SMP, remove conditional tracingAlex Ray2012-11-301-21/+10
| | | | | | | | | | | | | | | | With ANDROID_SMP set, tracing functionality is completely inline, and without the performance hits of external library calls, tracing does not need to be conditionally compiled. Change-Id: I4b29a9a52c403f0d2ea137c5b7bc05a518a7ca4b
* | Remove conditional compilation of ATRACE functionsAlex Ray2012-11-301-0/+5
| | | | | | | | | | | | | | Tracing functions are meant to be dynamically controlled via sysprops. Conditional compilation removes this functionality. Change-Id: I26bc473d104d0b3c50a228dddfda3fa2428d157a
* | Use ATRACE macros instead of Tracer staticsSimon Wilson2012-11-291-2/+2
|/ | | | | | | | | | ATRACE_BEGIN and ATRACE_END have replaced the static Tracer::traceBegin and Tracer::traceEnd functions, so use them instead. Fixes compilation errors when tracing is enabled. Change-Id: I4d1147d2f76afcdf113e9986f0544cb848802b15
* Check clock_gettime(CLOCK_MONOTONIC) for failureGlenn Kasten2012-09-241-0/+3
| | | | | Bug: 7100774 Change-Id: I15a84a19bb6d6ef1d9dac4beaa03587638196404
* Communicate audio session ID to downmixerJean-Michel Trivi2012-09-101-2/+3
| | | | | | | | The audio downmixer effect might need the audio session Id, pass it from the track creation in AudioFlinger to the downmix effect creation in AudioMixer. Change-Id: I5e29540542ae89cf4a0cdb537b3e67f04442a20a
* Add outlier statistics for fast mixer cycle timesGlenn Kasten2012-09-071-1/+40
| | | | Change-Id: I31c964caeb8b5d9ae0a426224f030cdcb01114a0
* Tune the overrun correctionGlenn Kasten2012-08-081-2/+2
| | | | | | | | | | The new overrun correction is: if the previous write() cycle time is < 50% of expected, then sleep enough extra to make the total cycle time = 95% of expected. This should help compensate for HAL implementations that have uneven cycle times due to sample rate conversion. Bug: 6881638 Change-Id: I5ab58afdfceee7ac523177f021fbf62d743d571a
* AudioFlinger: fix timed audioJohn Grossman2012-08-081-1/+6
| | | | | | | | | | | | | | | | | | (cherry picked from commit e20ac92c564a2f4e8123885807abdf0a78de0dd7) > AudioFlinger: fix timed audio > > Addresses Bug 6900517. > > Finish up support for timed audio in the new FastMixer world. Pay special > attention to remaining lock-less and voluntary yield free on the FastMixer > thread. This fixes audio playback for Q on JB. > > Change-Id: Iaf815e58a1b1d0a0190051794bec8dc5c9231785 > Signed-off-by: John Grossman <johngro@google.com> Change-Id: I9bd687acc345a05867af48e71116690fdb0ce1b5 Signed-off-by: John Grossman <johngro@google.com>
* Change definition of warmup periodGlenn Kasten2012-06-151-2/+5
| | | | | | | | | | | | | | | | | | | | Previously, warmup was considered done as soon as any write() took more than 0.5 nominal cycle time. In practice, this was always the first write() that turned on power to the output path, and it didn't accurately account for filling the full kernel buffer queue, or for buffering in the HAL sample rate conversion. Now warmup is considered done when a write() _after_ the first write takes more than 0.5 nominal cycle time. This will throttle the initial pull rate after coming out of standby. When combined with another change to throttle the pull rate for devices with HAL sample rate conversion, it may help reduce some of the notification glitches. The only downside is that it will increase the warmup time a bit. Bug: 6508317, 6650846, 6607056 Change-Id: I39f324c5195578170a55308e9601d3a1b41db3e0
* FastMixer compensates for SRC jitter in audio HALGlenn Kasten2012-06-151-6/+14
| | | | | | | Force a sleep if audio HAL write() returns too quickly. Bug: 6661275 Change-Id: Ie810f5a087b89fb24dab229a0e500af1dee53571
* Make CPU frequency statistics optionalGlenn Kasten2012-06-141-4/+19
| | | | | | | | | | Certain CPUs with dynamic cluster swapping and hotplug don't report CPU frequency accurately. The file descriptors used to read the frequency become stale and report bogus data. So make this feature a build time option for debugging only. This will also improve performance of the fast mixer loop. Change-Id: I602f81ec3281a37992769208be08084ed1469e8c
* Shorten dumpsys media.audio_flinger outputGlenn Kasten2012-06-131-0/+4
| | | | | | | | | Don't include in FastMixer if it's not present. This removes confusing clutter especially for devices with a separate deep buffer output thread, or for the duplicating thread and A2DP output thread. Change-Id: I84933f5555593256f11ba0895ec915c09cf16963
* 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
* Fast track dumpsysGlenn Kasten2012-06-031-1/+38
| | | | | Bug: 6591648 Change-Id: I696f51c682e7233ba690d97da26012084989b412
* Was calculating measured warmup time wrongGlenn Kasten2012-06-011-0/+1
| | | | | Bug: 6592923 Change-Id: I980c6fc69d78c569147ea44ce33a7f8a41739c91
* Keep a copy of most recent audio playedGlenn Kasten2012-05-211-0/+5
| | | | Change-Id: I6b2f97881c39998a2fae9ab79d669af6c0a37e94
* systrace for audioGlenn Kasten2012-05-171-3/+18
| | | | | | | | | | Trace fast track buffer fill status for underruns etc. Move the definition of macro to Android.mk. No overhead if disabled. Change-Id: If0e83e21b61b059ca38f543f8a6ffb58e08c79ee
* 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
* Improve underrun handling for fast tracksGlenn Kasten2012-05-141-4/+9
| | | | | | | Maintain more accurate accounting of type of underrun. Automatically remove track from active list after a series of "empty" underruns. Change-Id: If042bf80e1790dcaaf195c99dc9c0ed9b55382c1
* 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-101-0/+7
| | | | | | Disabled by default; uncomment ATRACE_TAG to enable Change-Id: I99af894022a859ee5644bd853cfd8a48e4735ff9
* Update fast mixer statisticsGlenn Kasten2012-05-101-16/+114
| | | | | | | | | | | | | | | 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
* Fix race condition for non-started fast tracksGlenn Kasten2012-04-301-11/+76
| | | | | | | | | | | | | | | | | | | | | 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
* FastMixer updateGlenn Kasten2012-04-201-3/+25
| | | | | | | | | | Updates: - Add support for mono fast tracks - Add support for optional sample rate conversion on fast tracks - Log sample rate and frame count - Enable statistics Change-Id: Ife014edf4f452da361f3eaaae19209ef6ff6958b
* Fix multichannel downmix pause bug on video playerJean-Michel Trivi2012-04-181-1/+2
| | | | | | | | | | | | | | | | | | | | | | Pausing a video player will cause the track audio mixer to be disabled, which causes the downmixer to be deleted. When reenabled, the track channel mask hasn't changed but the downmixer is there anymore. Fixed by: - instanciating a downmixer when the AudioMixer track gets initialized (in getTrackName(), now taking a channel mask as input), and deleted when in deleteTrackName(). - when the channel changes on a track, check whether it needs a downmixer or not. Preparing a track for downmix automatically removes the old downmixer if there was one. Also: initialize the track downmixerBufferProvider field when AudioMixer is instanciated, so we can safely call delete on it in AudioMixer's destructor, in case deleteTrackName() wasn't called before the mixer was destroyed. Change-Id: I589b0781cda5b3c82f85b561c52b08546cac21f8
* Fast mixerGlenn Kasten2012-04-181-0/+454
Change-Id: I61552f83507e08e4c706076b9fb15362869e6265