History log of /frameworks/av/services/audioflinger/FastMixer.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
6bf707f4c0752643757a7389384817da41d34fab 24-Feb-2017 Glenn Kasten <gkasten@google.com> Rename audio_utils/conversion.h to mono_blend.h

There is only one function declared in that header file, and it is
mono_blend, so a more specific filename may be easier to understand.

Test: compiles OK
Change-Id: Ie2aec6c706b1822581b34d3702818b8200a1db8a
/frameworks/av/services/audioflinger/FastMixer.cpp
068561c8e84569d51df2adbbb53b56fdfd09c06b 04-Jan-2017 Andy Hung <hunga@google.com> AudioFlinger: Split off audio processing library

Test: native AudioResampler test, general playback test
Bug: 31015569
Change-Id: Ifb248f4402a583438d756c014dcd7a4577aef713
/frameworks/av/services/audioflinger/FastMixer.cpp
b54c854d1ef1bb66e093c94099f915178eac570e 21-Sep-2016 Andy Hung <hunga@google.com> Add logging of written frame counts

Bug: 31591209
Change-Id: Ife5917aa65b02c3b0791dfe1975c70ccf58f9a75
(cherry picked from commit 2c45393d842a5d2968ef78fa7a08667efdf15f2a)
/frameworks/av/services/audioflinger/FastMixer.cpp
f9715e43ea73361321663514c44129c939c5db2f 13-Jul-2016 Glenn Kasten <gkasten@google.com> Distinguish systrace timelines for playback and capture

Bug: 30120068
Change-Id: If416540f0785e83e7b1e8ba986ee55b5b9298a2a
/frameworks/av/services/audioflinger/FastMixer.cpp
07eee80b3422c0304491f24bbc415deb0badbefc 22-Jun-2016 Andy Hung <hunga@google.com> Limit cached timestamp use if HW fails to provide them

On some devices, if the HDMI cable is disconnected during use,
cached timestamp info can become very old.

Bug: 29423451
Change-Id: Ieecf5e98bad14d00b4f5f14b032c2cf66ae94ceb
/frameworks/av/services/audioflinger/FastMixer.cpp
dc2c50bad491d2c0c8a2efc0e24491076701c63c 21-Apr-2016 Glenn Kasten <gkasten@google.com> Make max fast tracks configurable using a property

ro.audio.max_fast_tracks

Rename the currently configured maximum number of fast tracks
from FastMixerState::kMaxFastTracks to FastMixerState::sMaxFastTracks.

There is no guarantee that the CPU will be able to handle
the configured number of fast tracks.

Bug: 27564141
Change-Id: If9af226d839b226503488c3cb20a4bb8950b429d
/frameworks/av/services/audioflinger/FastMixer.cpp
c42e9b462661673dff480ee71757a58b0f806370 21-Mar-2016 Glenn Kasten <gkasten@google.com> Fix build warnings

Change-Id: Idfdaff3a7a8f60cd8817bd306bfba28020a391c8
/frameworks/av/services/audioflinger/FastMixer.cpp
7be6866af78a86a89113e9b680f1a6416ae1f711 19-Mar-2016 Glenn Kasten <gkasten@google.com> Merge "Fix build warnings" into nyc-dev
57c4e6f7464d458eb52d209c2a63524913d6406d 18-Mar-2016 Glenn Kasten <gkasten@google.com> Fix build warnings

Change-Id: I33178dbe0bfc087d6599579ca0529ad853c669ed
/frameworks/av/services/audioflinger/FastMixer.cpp
947ffa37beced7cca943477b4d748b0f6b279b0b 12-Dec-2014 Mohan Kumar <mkumard@nvidia.com> audioflinger: clear mMixerBuffer if frame is not ready

Clear the mMixerBuffer if frame is not ready before the FastMixer
starts processing. Otherwise it might result in large glitches on
output device due to junk data present in the mixbuffer.

Change-Id: I9f025234d4ac100f85d2ec67c06a8df4195bea98
/frameworks/av/services/audioflinger/FastMixer.cpp
818e7a32ce3633980138aff2c2bfcc5158b3cfcc 17-Feb-2016 Andy Hung <hunga@google.com> Implement server side playback timestamps with 64 bit accuracy

Provide server timestamps if the HAL doesn't provide it.
Provide monotonic - boottime translation.
Integrate record timestamps and playback timestamps together.

Bug: 17472992
Bug: 22871200
Bug: 26400089
Bug: 26682703
Change-Id: If1974f94232fcce7ba0bbcdf63d9e54ed51918ff
/frameworks/av/services/audioflinger/FastMixer.cpp
03c48d5afcb3dfc1e43df93e1f3b3b3e9292e148 28-Jan-2016 Glenn Kasten <gkasten@google.com> Add limiter for mono blend

Bug: 26904791
Change-Id: I76b16e70871cd9fc0a9b8badc66f27069fabe1cb
/frameworks/av/services/audioflinger/FastMixer.cpp
d79072e9dff59f767cce2cda1caab80ce5a0815b 06-Jan-2016 Glenn Kasten <gkasten@google.com> Remove TimedAudioTrack and associated code

Bug: 8278435
Change-Id: I095c1a4888e645e14d93b0b15fbef4524a831ca1
/frameworks/av/services/audioflinger/FastMixer.cpp
64f1901bdddf464c8f29bed34e3449762873b3e9 09-Jan-2016 Andy Hung <hunga@google.com> Merge "Add setMasterMono and getMasterMono"
2ddee19245641e86bca436dda23a0f5089bf2ab5 19-Dec-2015 Andy Hung <hunga@google.com> Add setMasterMono and getMasterMono

Bug: 15283594
Bug: 22700363
Change-Id: I32dc1fcecf285967a61bd508af3bb299595db57d
/frameworks/av/services/audioflinger/FastMixer.cpp
cb4432af8dc3abc8dc4cc8e5d6080cc68a862ea1 16-Dec-2015 Glenn Kasten <gkasten@google.com> Use FCC_2 and FCC_8 to highlight channel count assumptions

Bug: 21656069
Change-Id: I7678adaac2c4cb429465e2eef03c1c711e550e99
/frameworks/av/services/audioflinger/FastMixer.cpp
60c545dfc4160a6d46febb9aa6684f6d300ec74d 20-Jun-2015 Andy Hung <hunga@google.com> Fix FastMixer high bit depth Hal support

Bug: 21959591
Change-Id: Ia3351ea5644b36852a1f0dad1314beac97d840e1
/frameworks/av/services/audioflinger/FastMixer.cpp
f59497bd3c190e087202043de5450ef06e92b27d 27-Jan-2015 Glenn Kasten <gkasten@google.com> Update comments

Change-Id: I37d3c4ce22b74fe8581a886fe5a7f9fef8266dad
/frameworks/av/services/audioflinger/FastMixer.cpp
4dd03b5b68dcd8eb5f5ffe2cfe93d26b8f08b848 03-Mar-2015 Glenn Kasten <gkasten@google.com> Remove redundant this->

Change-Id: Iaa11bcce94dd331425197aab49065939e226a6a2
/frameworks/av/services/audioflinger/FastMixer.cpp
e4a7ce250cb94a00aa2f76e5edca1c4479dc5401 03-Mar-2015 Glenn Kasten <gkasten@google.com> Add "m" prefix to fields

Change-Id: Ifdb8fa886d1ff53cd7c8aff3c2f8286e6e18dec2
/frameworks/av/services/audioflinger/FastMixer.cpp
214b406c813e5baca3e4b5cdc1d986de35f09bbb 02-Mar-2015 Glenn Kasten <gkasten@google.com> Rename FAST_MIXER_STATISTICS to FAST_THREAD_STATISTICS

Change-Id: Idb5f5bf0c20bffff8536cf4a46f696e12e99e81b
/frameworks/av/services/audioflinger/FastMixer.cpp
d2123e631834a887c2d8600c3ac43dda02d47cb9 29-Jan-2015 Glenn Kasten <gkasten@google.com> Warmup cycles must be in range and consecutive

Change-Id: Ie8a40ec3547bdd62a1e2e05b11fb107c25841784
/frameworks/av/services/audioflinger/FastMixer.cpp
ad8510a339ffab330c2c46e5c247dd1cf9e15c22 18-Feb-2015 Glenn Kasten <gkasten@google.com> Include what you use

Change-Id: I1967861f383bb5ed6743fb69e3bd439907ed7033
/frameworks/av/services/audioflinger/FastMixer.cpp
04333cdc8d6a3c8e4a11835371e8ad13adf3f7f0 18-Feb-2015 Glenn Kasten <gkasten@google.com> Pull out FastCaptureDumpState and FastMixerDumpState

Change-Id: I8e44dbfe02338622eb69193b234743b50f0dd79f
/frameworks/av/services/audioflinger/FastMixer.cpp
b187de1ada34a9023c05d020a4592686ba761278 30-Dec-2014 Glenn Kasten <gkasten@google.com> Line length 100

Change-Id: I6c8fe626a3825fa9e139319656d682a57b887c97
/frameworks/av/services/audioflinger/FastMixer.cpp
329f6511ee4e03a4605c70bbda8d3a96d2544884 29-Aug-2014 Glenn Kasten <gkasten@google.com> Restore the ability to build tee sink for debugging

This changelist does not enable tee sink, but makes it possible to do so.
Tee sink had suffered some bit rot since it is not built by default.

Also fixes a crash for > 2 byte per sample or > 2 channels.
Still does not write correct header for floating-point;
that will be best solved by moving to libsndfile.

Bug: 16990102
Change-Id: I8e92c588ccc513d7802d696fcfb324e815772df6
/frameworks/av/services/audioflinger/FastMixer.cpp
9a59276fb465e492138e0576523b54079671e8f4 22-Jul-2014 Andy Hung <hunga@google.com> Add multichannel capability to AudioFlinger

But not enabled (kEnableExtendedChannels == false).

Change-Id: I62f7e31fbd29ad703a9a02f5d1a280b6972dd423
/frameworks/av/services/audioflinger/FastMixer.cpp
6be494077f8d7970f3a88129c5d139c5a0c88f6d 30-May-2014 Andy Hung <hunga@google.com> Change parameter type for volume to float in AudioMixer

Change-Id: I4da1505ce852505f86f8e5b87f60e8edceeb30e0
/frameworks/av/services/audioflinger/FastMixer.cpp
1258c1ab592a899fabb1e31eb5db2ef413b6f38a 24-May-2014 Andy Hung <hunga@google.com> Add multiple format capability to FastMixer

Floating point data from MixerThread into FastMixer.
Multiple output format capability from FastMixer to Sink.

Change-Id: I0da17810ee71381a39a006c46faec71108d22c26
/frameworks/av/services/audioflinger/FastMixer.cpp
b9e722bdf00333557578497c5abfc77c5d779ecb 28-May-2014 Andy Hung <hunga@google.com> Merge "Rename mixBuffer to mMixerBuffer in FastMixer"
018d324dc599c5f4238a4cd631baac47c28d59fe 27-May-2014 Andy Hung <hunga@google.com> Merge "Add multiple format capability to AudioMixer"
45d68d366d07b10733c1e8af6a6984befbc08ce1 24-May-2014 Andy Hung <hunga@google.com> Rename mixBuffer to mMixerBuffer in FastMixer

Likewise mixBufferState becomes mMixerBufferState.
This harmonizes with the naming in AF::MixerThread.

Change-Id: I1255d7c07cc2c6ee925d7430925236d2bd163122
/frameworks/av/services/audioflinger/FastMixer.cpp
ef7c7fbd0e3fb36af14cd7d39f64c949031516a5 13-May-2014 Andy Hung <hunga@google.com> Add multiple format capability to AudioMixer

Change-Id: I04ac1cafd90b6ed652f8d51888ad07576678f0bc
Signed-off-by: Andy Hung <hunga@google.com>
/frameworks/av/services/audioflinger/FastMixer.cpp
c62476f0c0c1cf9283a38852bde0a4c9434df712 24-May-2014 Andy Hung <hunga@google.com> Merge "Add format parameter to getTrackName() and track_t"
24ffe7a9161943c8ba2353e956653a71af564b5d 23-May-2014 Elliott Hughes <enh@google.com> am 79262cfc: am 5b756bfd: am 8b187f4a: Merge "Move frameworks/av off <sys/atomics.h>."

* commit '79262cfc14a9d8b5aa29d43e84ea91eedb9492ba':
Move frameworks/av off <sys/atomics.h>.
63492411cf4abff452b47f59ec7ff6f3e9925c84 22-May-2014 Elliott Hughes <enh@google.com> Move frameworks/av off <sys/atomics.h>.

Bug: 14903517
Change-Id: I92cdfc618d83fd914cfb558a07b1deae0255fccb
/frameworks/av/services/audioflinger/FastMixer.cpp
87cebadd48710e42474756fc3513df678de045ce 22-May-2014 Elliott Hughes <enh@google.com> resolved conflicts for merge of f285c91e to master

Change-Id: I4c995e297d09c0854a42142cc57dce8b771acf65
8b5f642eb2364ea7fe46a5b3af51b48b58f12183 22-May-2014 Elliott Hughes <enh@google.com> Move frameworks/av from fdprintf to POSIX dprintf.

Bug: 11156955
Change-Id: Ia98cd16b4c1f7be87cf060b7456de4f40896bacb
/frameworks/av/services/audioflinger/FastMixer.cpp
22f22ffcb111b38eb7a303bfde39aed108b43e07 22-May-2014 Elliott Hughes <enh@google.com> Restore accidentally-removed NULL timeout.

Change-Id: I933c80fea50950243f109acf8d6350013aaa811f
/frameworks/av/services/audioflinger/FastMixer.cpp
ee499291404a192b059f2e04c5afc65aa6cdd74c 22-May-2014 Elliott Hughes <enh@google.com> Move frameworks/av off private API.

Bug: 11156955
Change-Id: Ib3bb9d66a2bf92977c2445b62aa074a2d7a45aea
/frameworks/av/services/audioflinger/FastMixer.cpp
00ddac6f47a066a545342a81c40425e3a153e8a1 20-May-2014 Andy Hung <hunga@google.com> Merge "Update AudioMixer::getTrackName to save channelMask"
e8a1ced4da17dc6c07803dc2af8060f62a8389c1 10-May-2014 Andy Hung <hunga@google.com> Add format parameter to getTrackName() and track_t

Change-Id: Ia152a839014e235fbfb656104c15d7c1b456d02e
Signed-off-by: Andy Hung <hunga@google.com>
/frameworks/av/services/audioflinger/FastMixer.cpp
c56f3426099a3cf2d07ccff8886050c7fbce140f 22-Mar-2014 Glenn Kasten <gkasten@google.com> Pass stereo gains as packed minifloat

This will allow (eventually) a greater dynamic range for gains.
However there are still a few remaining places in effects and mixer
that will also need to be changed in order to get the full benefit.

Also fixes a minor bug: was not checking for NaN in AudioTrack C++.

Change-Id: I63bce9e82e0a61546d8ff475fb94bcb700d99c96
/frameworks/av/services/audioflinger/FastMixer.cpp
68112fc4f77ab8c4a744782f78e9792afe0cbfc1 14-May-2014 Andy Hung <hunga@google.com> Update AudioMixer::getTrackName to save channelMask

Change-Id: I4fb4abbff1b05bdd0f6e21b5f5f4c3f2a57ae28d
Signed-off-by: Andy Hung <hunga@google.com>
/frameworks/av/services/audioflinger/FastMixer.cpp
2234002b0710c8db73f82d397cb945cd541c6bbb 07-Apr-2014 Glenn Kasten <gkasten@google.com> Start pulling bits of FastMixer up to FastThread

Change-Id: I4c6f7b8f88fcf107bb29ee6432feecd4ab6554d2
/frameworks/av/services/audioflinger/FastMixer.cpp
bc6ae9bd4ee93e91e212ad35be038f21797ef31e 07-Apr-2014 Glenn Kasten <gkasten@google.com> Fix regression in FastMixer statistics

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
/frameworks/av/services/audioflinger/FastMixer.cpp
adad3d7d935da176ff24941b4ae9edf7340e9b96 21-Feb-2014 Glenn Kasten <gkasten@google.com> Use LOG_ALWAYS_FATAL instead of LOG_FATAL

LOG_FATAL is compiled out in most builds, so the
assertion checks were not being performed.

Change-Id: I774f0985ab9c5ccecd8989a0f1c940386b73fc35
/frameworks/av/services/audioflinger/FastMixer.cpp
1d6fa7af1288b550faabe4ec2cf98684236723db 11-Feb-2014 Narayan Kamath <narayan@google.com> resolved conflicts for merge of 566be7c3 to master

Change-Id: I7b1cc71057b2bd4f771e7bcf508a8c3abd6017ce
377b2ec9a2885f9b6405b07ba900a9e3f4349c38 03-Feb-2014 Kévin PETIT <kevin.petit@arm.com> Make frameworks/av 64-bit compatible

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
/frameworks/av/services/audioflinger/FastMixer.cpp
4b76d27d6c4751b31a1cb8ac5e6da1d4b7724a7b 10-Feb-2014 Glenn Kasten <gkasten@android.com> am 5a458ede: am 5930e8eb: Merge "AudioFlinger: Remove code for supporting resampling in fast tracks"

* commit '5a458ede3b7d303723fde4b856532bdc3b94971b':
AudioFlinger: Remove code for supporting resampling in fast tracks
b220884bf3129253cc5bc8d030bc475411ea4911 07-Feb-2014 Marco Nelissen <marcone@google.com> Pretty up audioflinger dumpsys

Change-Id: I57e44b4c36b99f7149542bbcf9645521c6152dfa
/frameworks/av/services/audioflinger/FastMixer.cpp
3ce28aa3cb5262775180a8b423cfb4a5670ebc59 05-Feb-2014 Martin Storsjo <martin@martin.st> AudioFlinger: Remove code for supporting resampling in fast tracks

This isn't used at the moment.

Change-Id: I4e0fb2af5f7d959dbafd5ddb7defa1c6b8e8636a
/frameworks/av/services/audioflinger/FastMixer.cpp
6e0d67d7b496ce17c0970a4ffd3a6f808860949c 31-Jan-2014 Glenn Kasten <gkasten@google.com> Use Format_isValid() and Format_isEqual() instead of direct comparison

Change-Id: Ie87607aa514976947540a77775e6425c4e56e7d9
/frameworks/av/services/audioflinger/FastMixer.cpp
b9258d930d67fc314373f94ab4423974e5f87e1a 04-Sep-2013 Glenn Kasten <gkasten@google.com> am 97992cc7: am 732845c7: FastMixer computes presentation timestamps for fast tracks

* commit '97992cc71fd0bbd4aa22e5195ee7e5cde09ac254':
FastMixer computes presentation timestamps for fast tracks
732845c7e8d294bb1aaa4cd9687da62b51f1f6e6 23-Aug-2013 Glenn Kasten <gkasten@google.com> FastMixer computes presentation timestamps for fast tracks

and forwards them to each track's ExtendedAudioBufferProvider::onTimestamp().

Change-Id: I06fb9586bb7e20d5c0289abdc8cac6cd3fd2f6e8
/frameworks/av/services/audioflinger/FastMixer.cpp
6e2ebe97f2ad0a21907f20f9ee644c4eacbb7a40 13-Aug-2013 Glenn Kasten <gkasten@google.com> Use curly braces in 'if' to make it easier to add logs

Change-Id: I58b33fefdd8bf703647414157a99a3223be3531c
/frameworks/av/services/audioflinger/FastMixer.cpp
7fc97ba08e2850f3f16db704b78ce78e3dbe1ff0 17-Jul-2013 Glenn Kasten <gkasten@google.com> HAL stream format for mixer output threads must be stereo 16-bit PCM

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
/frameworks/av/services/audioflinger/FastMixer.cpp
4182c4e2a07e2441fcd5c22eaff0ddfe7f826f61 15-Jul-2013 Glenn Kasten <gkasten@google.com> Use AudioSystem::setLowRamDevice() to configure memory

Bug: 9798886
Change-Id: I9321e3f369f1ed9429ae222e3926ebdeb012b8b0
/frameworks/av/services/audioflinger/FastMixer.cpp
153b9fe667e6e78e0218ff0159353097428c7657 15-Jul-2013 Glenn Kasten <gkasten@google.com> Make AudioFlinger::instantiate() more resilient when called from separate module

Bug: 8834855
Change-Id: I4cd842cdfb09d2aaaaab9df9ac3bec6179709bd3
/frameworks/av/services/audioflinger/FastMixer.cpp
3d1982595cb9cb0856841f1f57fbdb4581189e99 11-Jul-2013 Glenn Kasten <gkasten@google.com> Fix indentation

Change-Id: Ia28720a7d0fad8cf110c2448b967d5648d42e017
/frameworks/av/services/audioflinger/FastMixer.cpp
a07f17ca46db04c9d5d9e7d6b2878db59ca2b9ea 23-Apr-2013 Glenn Kasten <gkasten@google.com> Remove timing jitter during startup of audio

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
/frameworks/av/services/audioflinger/FastMixer.cpp
c9b2e20f7c9a71e07ef398152709c76079decbcd 26-Feb-2013 Glenn Kasten <gkasten@google.com> Miscellaneous cleanup

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
/frameworks/av/services/audioflinger/FastMixer.cpp
ab7d72f0804fbb7e91ad9d2a16f826d97e20e5d0 27-Feb-2013 Glenn Kasten <gkasten@google.com> media.log cleanup

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
/frameworks/av/services/audioflinger/FastMixer.cpp
7f5d335f7b4caecd0dfb8f1085f352f1d2da5d2e 16-Feb-2013 Glenn Kasten <gkasten@google.com> Revert "Temporary additional logging to investigate bug"

This reverts commit 32584a7d672864b20ab8b83a3cb23c1858e908b7

Change-Id: I9dc680578b955b1af462eeb7a49d61a0d45eb81b
/frameworks/av/services/audioflinger/FastMixer.cpp
32584a7d672864b20ab8b83a3cb23c1858e908b7 13-Feb-2013 Glenn Kasten <gkasten@google.com> Temporary additional logging to investigate bug

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
/frameworks/av/services/audioflinger/FastMixer.cpp
e186b51e0a9834b287d7a509e960eaf1b688db75 15-Feb-2013 Glenn Kasten <gkasten@google.com> Revert "Temporary additional logging to investigate bug"

This reverts commit 639482c24c911b125398b31883ba6d55faebe28b

Change-Id: I11f2829072ab11e18b0663024f27bf31192f1d39
/frameworks/av/services/audioflinger/FastMixer.cpp
639482c24c911b125398b31883ba6d55faebe28b 13-Feb-2013 Glenn Kasten <gkasten@google.com> Temporary additional logging to investigate bug

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
/frameworks/av/services/audioflinger/FastMixer.cpp
51eb3965caa8ba135bcdd8ffb7a2024a042ecdc0 14-Feb-2013 Glenn Kasten <gkasten@google.com> Revert "Temporary additional logging to investigate bug"

This reverts commit 0ddd56316262ac74a95e9edb595697c163136d6d

Change-Id: I180a928af6f5a38d15a5efe44cd1fe927b5d961c
/frameworks/av/services/audioflinger/FastMixer.cpp
0ddd56316262ac74a95e9edb595697c163136d6d 13-Feb-2013 Glenn Kasten <gkasten@google.com> Temporary additional logging to investigate bug

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
/frameworks/av/services/audioflinger/FastMixer.cpp
ecd9389c8712aedeb2a79823ea0e4fb842684269 12-Feb-2013 Glenn Kasten <gkasten@google.com> Revert "Temporary additional logging to investigate bug"

This reverts commit 3051df27261e9952c0e642dec548515250e85f6a

Change-Id: I8bf5c3e91b65bd20de26f480c367c2854b62373c
/frameworks/av/services/audioflinger/FastMixer.cpp
3051df27261e9952c0e642dec548515250e85f6a 12-Feb-2013 Glenn Kasten <gkasten@google.com> Temporary additional logging to investigate bug

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
/frameworks/av/services/audioflinger/FastMixer.cpp
9e58b552f51b00b3b674102876bd6c77ef3da806 19-Jan-2013 Glenn Kasten <gkasten@google.com> AudioFlinger uses media.log service for logging

Change-Id: Ia0f8204334f6b233f644d897762a18c95d936b4b
/frameworks/av/services/audioflinger/FastMixer.cpp
cb02ba7c2666b72db030b8bf4a3f2cddc3c23ead 20-Dec-2012 Glenn Kasten <gkasten@google.com> Merge "Add warning about following the design rules"
b3a8364eeea621ef63b983e4c1b0771f62069fe0 01-Dec-2012 Alex Ray <aray@google.com> audioflinger: define ANDROID_SMP, remove conditional tracing

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
/frameworks/av/services/audioflinger/FastMixer.cpp
371eb9756c32109ea572b91216b19bb623f6d3fd 30-Nov-2012 Alex Ray <aray@google.com> Remove conditional compilation of ATRACE functions

Tracing functions are meant to be dynamically controlled via sysprops.
Conditional compilation removes this functionality.

Change-Id: I26bc473d104d0b3c50a228dddfda3fa2428d157a
/frameworks/av/services/audioflinger/FastMixer.cpp
a3d2628a22f2b3d682495044897a40ea1399a662 30-Nov-2012 Glenn Kasten <gkasten@google.com> Add warning about following the design rules

Change-Id: Ic4895ed5682bad10b03e97d8015e642ee1696533
/frameworks/av/services/audioflinger/FastMixer.cpp
2d590964aa58e137d17a43e095e6443dd0fe2e98 30-Nov-2012 Simon Wilson <simonwilson@google.com> Use ATRACE macros instead of Tracer statics

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
/frameworks/av/services/audioflinger/FastMixer.cpp
80b3273cea8660fe8a5868d024d2788a1e083ffc 24-Sep-2012 Glenn Kasten <gkasten@google.com> Check clock_gettime(CLOCK_MONOTONIC) for failure

Bug: 7100774
Change-Id: I15a84a19bb6d6ef1d9dac4beaa03587638196404
/frameworks/av/services/audioflinger/FastMixer.cpp
fe3156ec6fd9fa57dde913fd8567530d095a6550 11-Sep-2012 Jean-Michel Trivi <jmtrivi@google.com> Communicate audio session ID to downmixer

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
/frameworks/av/services/audioflinger/FastMixer.cpp
1ab212cf5cfa5b88c801840e11e3191cd10f48e4 07-Sep-2012 Glenn Kasten <gkasten@google.com> Add outlier statistics for fast mixer cycle times

Change-Id: I31c964caeb8b5d9ae0a426224f030cdcb01114a0
/frameworks/av/services/audioflinger/FastMixer.cpp
0d27c65ddb5c968baa6db0c26e80f5c451bc52bc 07-Aug-2012 Glenn Kasten <gkasten@google.com> Tune the overrun correction

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
/frameworks/av/services/audioflinger/FastMixer.cpp
2c3b2da3049627264b7c6b449a1622f002210f03 03-Aug-2012 John Grossman <johngro@google.com> AudioFlinger: fix timed audio

(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>
/frameworks/av/services/audioflinger/FastMixer.cpp
eb15716b59020f342df62bce5b293f0603b94861 13-Jun-2012 Glenn Kasten <gkasten@google.com> Change definition of warmup period

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
/frameworks/av/services/audioflinger/FastMixer.cpp
972af221ae7253e406e0e1ea853e56a3010ed6b1 14-Jun-2012 Glenn Kasten <gkasten@google.com> FastMixer compensates for SRC jitter in audio HAL

Force a sleep if audio HAL write() returns too quickly.

Bug: 6661275
Change-Id: Ie810f5a087b89fb24dab229a0e500af1dee53571
/frameworks/av/services/audioflinger/FastMixer.cpp
0a14c4ce1a41bc09eb7855fa531a3af629a69139 13-Jun-2012 Glenn Kasten <gkasten@google.com> Make CPU frequency statistics optional

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
/frameworks/av/services/audioflinger/FastMixer.cpp
868c0abe9f26852c217bc201b337e72c68f829b8 13-Jun-2012 Glenn Kasten <gkasten@google.com> Shorten dumpsys media.audio_flinger output

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
/frameworks/av/services/audioflinger/FastMixer.cpp
9a0d82df8fd681257bc5b29fb5e6c65fcc7cef5a 06-Jun-2012 Eric Laurent <elaurent@google.com> audioflinger: modify fast mixer overrun management

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
/frameworks/av/services/audioflinger/FastMixer.cpp
1295bb4dcff7b29c75cd23746816df12a871d72c 31-May-2012 Glenn Kasten <gkasten@google.com> Fast track dumpsys

Bug: 6591648
Change-Id: I696f51c682e7233ba690d97da26012084989b412
/frameworks/av/services/audioflinger/FastMixer.cpp
04a4ca4217e9b30342d5865024c340013d7184e8 01-Jun-2012 Glenn Kasten <gkasten@google.com> Was calculating measured warmup time wrong

Bug: 6592923
Change-Id: I980c6fc69d78c569147ea44ce33a7f8a41739c91
/frameworks/av/services/audioflinger/FastMixer.cpp
fbae5dae5187aca9d974cbe15ec818e9c6f56705 21-May-2012 Glenn Kasten <gkasten@google.com> Keep a copy of most recent audio played

Change-Id: I6b2f97881c39998a2fae9ab79d669af6c0a37e94
/frameworks/av/services/audioflinger/FastMixer.cpp
99c99d00beb43b939dedc9ffb07adb89f6a85ba5 15-May-2012 Glenn Kasten <gkasten@google.com> systrace for audio

Trace fast track buffer fill status for underruns etc.

Move the definition of macro to Android.mk.

No overhead if disabled.

Change-Id: If0e83e21b61b059ca38f543f8a6ffb58e08c79ee
/frameworks/av/services/audioflinger/FastMixer.cpp
c059bd4246c1b3944965be921e5b334d51cd236c 15-May-2012 Glenn Kasten <gkasten@google.com> Skip bad kHz values, and display them accurately

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
/frameworks/av/services/audioflinger/FastMixer.cpp
09474df67278c0cd621b57c4aef1deaec4d8447f 10-May-2012 Glenn Kasten <gkasten@google.com> Improve underrun handling for fast tracks

Maintain more accurate accounting of type of underrun.
Automatically remove track from active list after a series of "empty" underruns.

Change-Id: If042bf80e1790dcaaf195c99dc9c0ed9b55382c1
/frameworks/av/services/audioflinger/FastMixer.cpp
e58ccce45598bcf4b4874b0e87cd1eb8d05ba9a9 12-May-2012 Glenn Kasten <gkasten@google.com> Fix 2 bugs in fast mixer statistics

Was losing the upper half of the bounds, and MHz was off.

Change-Id: I61c98027b35ce7c3578ea6f3acf05aa5c48a5831
/frameworks/av/services/audioflinger/FastMixer.cpp
d8e6fd35ec2b59ee7d873daf1f1d9d348221c7bc 07-May-2012 Glenn Kasten <gkasten@google.com> Use audio tag for system tracing

Disabled by default; uncomment ATRACE_TAG to enable

Change-Id: I99af894022a859ee5644bd853cfd8a48e4735ff9
/frameworks/av/services/audioflinger/FastMixer.cpp
42d45cfd0c3d62357a6549c62f535e4d4fe08d91 02-May-2012 Glenn Kasten <gkasten@google.com> Update fast mixer statistics

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
/frameworks/av/services/audioflinger/FastMixer.cpp
288ed2103d96f3aabd7e6bea3c080ab6db164049 26-Apr-2012 Glenn Kasten <gkasten@google.com> Fix race condition for non-started fast tracks

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
/frameworks/av/services/audioflinger/FastMixer.cpp
21e8c50bd13ebe44f3088e26c9c6df0e163c469c 12-Apr-2012 Glenn Kasten <gkasten@google.com> FastMixer update

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
/frameworks/av/services/audioflinger/FastMixer.cpp
9bd23229fdec1657398abc682ccccfce1c95f8aa 16-Apr-2012 Jean-Michel Trivi <jmtrivi@google.com> Fix multichannel downmix pause bug on video player

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
/frameworks/av/services/audioflinger/FastMixer.cpp
97b5d0d5b5ef766eb5dd680d05a5d199662d4ae0 24-Mar-2012 Glenn Kasten <gkasten@google.com> Fast mixer

Change-Id: I61552f83507e08e4c706076b9fb15362869e6265
/frameworks/av/services/audioflinger/FastMixer.cpp