summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/FastMixer.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Start pulling bits of FastMixer up to FastThreadGlenn Kasten2014-04-281-561/+327
| | | | Change-Id: I4c6f7b8f88fcf107bb29ee6432feecd4ab6554d2
* Fix regression in FastMixer statisticsGlenn Kasten2014-04-071-0/+1
| | | | | | | | | At some point, the mSampleRate in FastMixerDumpState stopped being initialized correctly. I'm not sure when this happened, it doesn't seem to be introduced in recent CLs. This lack of initialization caused some of the FastMixer statistics based on sample rate to be useless. Change-Id: Id2a96d606130a90c4c4f1bddd59778f6c6428a9c
* Use LOG_ALWAYS_FATAL instead of LOG_FATALGlenn Kasten2014-03-261-1/+1
| | | | | | | LOG_FATAL is compiled out in most builds, so the assertion checks were not being performed. Change-Id: I774f0985ab9c5ccecd8989a0f1c940386b73fc35
* resolved conflicts for merge of 566be7c3 to masterNarayan Kamath2014-02-111-6/+6
|\ | | | | | | Change-Id: I7b1cc71057b2bd4f771e7bcf508a8c3abd6017ce
| * Make frameworks/av 64-bit compatibleKévin PETIT2014-02-111-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | Contains the necessary changes to make frameworks/av build and work on a 64-bit machine. Signed-off-by: Craig Barber <craig.barber@arm.com> Signed-off-by: Kévin PETIT <kevin.petit@arm.com> Signed-off-by: Ashok Bhat <ashok.bhat@arm.com> Signed-off-by: Marcus Oakland <marcus.oakland@arm.com> Change-Id: I725feaae50ed8eee25ca2c947cf15aee1f395c43
* | am 5a458ede: am 5930e8eb: Merge "AudioFlinger: Remove code for supporting ↵Glenn Kasten2014-02-101-23/+4
|\ \ | |/ | | | | | | | | | | resampling in fast tracks" * commit '5a458ede3b7d303723fde4b856532bdc3b94971b': AudioFlinger: Remove code for supporting resampling in fast tracks
| * AudioFlinger: Remove code for supporting resampling in fast tracksMartin Storsjo2014-02-051-23/+4
| | | | | | | | | | | | This isn't used at the moment. Change-Id: I4e0fb2af5f7d959dbafd5ddb7defa1c6b8e8636a
* | Pretty up audioflinger dumpsysMarco Nelissen2014-02-101-19/+25
| | | | | | | | Change-Id: I57e44b4c36b99f7149542bbcf9645521c6152dfa
* | Use Format_isValid() and Format_isEqual() instead of direct comparisonGlenn Kasten2014-02-031-1/+1
| | | | | | | | Change-Id: Ie87607aa514976947540a77775e6425c4e56e7d9
* | am 97992cc7: am 732845c7: FastMixer computes presentation timestamps for ↵Glenn Kasten2013-09-031-1/+46
|\ \ | |/ | | | | | | | | | | fast tracks * commit '97992cc71fd0bbd4aa22e5195ee7e5cde09ac254': FastMixer computes presentation timestamps for fast tracks
| * FastMixer computes presentation timestamps for fast tracksGlenn Kasten2013-09-031-1/+46
| | | | | | | | | | | | and forwards them to each track's ExtendedAudioBufferProvider::onTimestamp(). Change-Id: I06fb9586bb7e20d5c0289abdc8cac6cd3fd2f6e8
* | Use curly braces in 'if' to make it easier to add logsGlenn Kasten2013-08-131-1/+2
|/ | | | Change-Id: I58b33fefdd8bf703647414157a99a3223be3531c
* HAL stream format for mixer output threads must be stereo 16-bit PCMGlenn Kasten2013-07-251-3/+5
| | | | | | | | | | | | | | | | | | | | Direct and tunnel output threads can support various HAL stream formats, included encoded. But currently there are stereo 16-bit PCM assumptions in several places for mixer and duplicating output threads: - mMixBuffer and mixBuffer() - AudioMixer including resampler - FastMixer's mixBuffer - effects - NBAIO_Format - anywhere FCC_2 is used - possibly other places Until those assumptions are removed, this CL enforces stereo 16-bit PCM in mixer and duplicating threads at the place where the HAL format is read. It was already being checked in checkForNewParameters_l(), but not in readOutputParameters(). Change-Id: Ibe344cc922743da234299097aa1bb1f54795cc9b
* Use AudioSystem::setLowRamDevice() to configure memoryGlenn Kasten2013-07-191-13/+29
| | | | | Bug: 9798886 Change-Id: I9321e3f369f1ed9429ae222e3926ebdeb012b8b0
* Make AudioFlinger::instantiate() more resilient when called from separate moduleGlenn Kasten2013-07-191-0/+7
| | | | | Bug: 8834855 Change-Id: I4cd842cdfb09d2aaaaab9df9ac3bec6179709bd3
* Fix indentationGlenn Kasten2013-07-101-74/+74
| | | | Change-Id: Ia28720a7d0fad8cf110c2448b967d5648d42e017
* Remove timing jitter during startup of audioGlenn Kasten2013-04-231-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a regression introduced recently, that increased timing jitter during the startup of the FastMixer and AudioTrack callback threads. The regression was to make requestPriority() asynchronous as a way to avoid an apparent priority inversion in system_server. This means that the target thread could run briefly with the initial priority, before the new priority takes effect. This change removes the startup jitter for FastMixer, by making the requestPriority() synchronous again for that case. It doesn't matter that this restores the priority inversion involving normal mixer thread, because it happens during startup of both threads. The change also removes the startup jitter for the AudioTrack callback thread, by having the target thread check whether the requestPriority() has completed yet. If not, the target thread blocks with a timeout until the priority boost finishes. Finally, we now log an error message if the expected priority boost doesn't happen. Bug: 8698989 Change-Id: Id590e9a274b70ec1ba85b44a585ee37a22e41cbc
* Miscellaneous cleanupGlenn Kasten2013-03-041-3/+3
| | | | | | | | | | Abbreviation framesReady to fRdy for new systrace. Put inline const on one line. Use local copy of mState in state. Improve logging. Line length 100. Change-Id: I8201c3ce0e53fd464fd33d02544e52c342d40b68
* media.log cleanupGlenn Kasten2013-03-011-17/+7
| | | | | | | | | | | | | | Remove almost all of the specific logs, but leave the media.log logging infrastructure in place for the next time we need it. Re-apply a few good changes that were reverted earlier: - check logf format vs. argument list compatibility - distinguish potentially modified and actually modified tracks in FastMixer - fix benign bug where sq->end() was called more than once - fix a build warning Bug: 6490974 Change-Id: I02d3e83646c738acaebb415bd0d6b548638b4ef5
* Revert "Temporary additional logging to investigate bug"Glenn Kasten2013-02-151-89/+4
| | | | | | This reverts commit 32584a7d672864b20ab8b83a3cb23c1858e908b7 Change-Id: I9dc680578b955b1af462eeb7a49d61a0d45eb81b
* Temporary additional logging to investigate bugGlenn Kasten2013-02-151-4/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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() - increase log buffer sizes yet again - enable assertion checking without ALOGV - improve a few log messages - check for corruption in more places - log in all the process hooks - add new mixer APIs so we can check for corruption of mixer state - fix a build warning Bug: 6490974 Change-Id: Ib0c4a73dcf606ef9bd898313b3b40ef61ab42f51
* 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