summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/AudioMixer.h
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Temporary additional logging to investigate bug"Glenn Kasten2013-02-151-23/+2
| | | | | | This reverts commit 32584a7d672864b20ab8b83a3cb23c1858e908b7 Change-Id: I9dc680578b955b1af462eeb7a49d61a0d45eb81b
* Temporary additional logging to investigate bugGlenn Kasten2013-02-151-2/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-20/+2
| | | | | | This reverts commit 639482c24c911b125398b31883ba6d55faebe28b Change-Id: I11f2829072ab11e18b0663024f27bf31192f1d39
* Temporary additional logging to investigate bugGlenn Kasten2013-02-141-2/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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-3/+1
| | | | | | This reverts commit 0ddd56316262ac74a95e9edb595697c163136d6d Change-Id: I180a928af6f5a38d15a5efe44cd1fe927b5d961c
* Temporary additional logging to investigate bugGlenn Kasten2013-02-131-1/+3
| | | | | | | | | | | | | | | | | | | 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
* Line length 100Glenn Kasten2012-11-011-6/+12
| | | | Change-Id: Ib28fd7b9ce951a6933f006e7f8812ba617625530
* Document AudioMixer hard-coded limitsGlenn Kasten2012-10-261-0/+7
| | | | Change-Id: I83ea8bed375f251260945db788bdb5f280dba12d
* Communicate audio session ID to downmixerJean-Michel Trivi2012-09-121-2/+4
| | | | | | | | 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: I836873eebd6711f1048fce81cd2eb29b94f0ad0c
* am c9beb01c: am b9cba9b7: Merge "Move libnbaio out of AudioFlinger" into ↵Glenn Kasten2012-08-301-1/+1
|\ | | | | | | | | | | | | jb-mr1-dev * commit 'c9beb01c800e6326051aee52a00659288c25c6eb': Move libnbaio out of AudioFlinger
| * Move libnbaio out of AudioFlingerGlenn Kasten2012-08-301-1/+1
| | | | | | | | | | | | | | | | | | | | libnbaio is now a separate shared library from AudioFlinger, rather than a static library used only by AudioFlinger. AudioBufferProvider interface is now also independent of AudioFlinger, moved to include/media/ Change-Id: I9bb62ffbc38d42a38b0af76e66da5e9ab1e0e21b
* | Share local time frequency for all tracks & mixersGlenn Kasten2012-07-251-3/+5
|/ | | | Change-Id: I5e6f0e371f728a5225c2fa6f778c109449d33602
* Fix multichannel downmix pause bug on video playerJean-Michel Trivi2012-04-181-1/+3
| | | | | | | | | | | | | | | | | | | | | | 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
* AudioMixer new cmd: remove sample rate converterGlenn Kasten2012-04-161-2/+14
| | | | | | | | | | Add a new command REMOVE to remove any sample rate converter on a track, without having to delete the track name. Add comments. Remove some dead code. Fix whitespace and comparison to NULL. Change-Id: Id55a23ab5ee673189e99675b4e6fa5df7b617987
* AudioMixer uses downmix effect for multichannel contentJean-Michel Trivi2012-04-091-3/+36
| | | | | | | | | | | | | | In the AudioMixer structure associated with each track, add an object that acts as the buffer provider when the track has more than two channels of input in the mixer. This object, DownmixerBufferProvider, gets audio from the actual buffer provider of the track, and applies a downmix effect on it. The downmix effect is created and configured when the track gets created in AudioFlinger, which causes AudioMixer::getTrackName() to be called with the new track's channel mask. It is released when the track is disabled in the mixer. Change-Id: I05281ed5f61bef663a8af7ca7d5ceac3517c82db
* Merge "AudioMixer can be configured for fewer max tracks"Glenn Kasten2012-03-211-1/+8
|\
| * AudioMixer can be configured for fewer max tracksGlenn Kasten2012-03-201-1/+8
| | | | | | | | Change-Id: I371b17cef071d083eecf35cd3627a3adff907a33
* | Update commentsGlenn Kasten2012-03-191-0/+5
|/ | | | Change-Id: I327663a020670d0a72ff57bd0b682e2ce0528650
* Remove bit fields to improve performanceGlenn Kasten2012-02-171-7/+21
| | | | | | uint16_t enabled is (mostly) changed to bool in a separate CL Change-Id: Ied9f8c034b2479cee9a8778cee7b8ff92ae75b7b
* Simplify codeGlenn Kasten2012-02-171-2/+1
| | | | | | | | | | | | | | | Use DefaultKeyedVector::valueFor to avoid extra test Make local variables as local as possible No double parentheses No typedef for single use No parentheses around indirect function call No AudioFlinger:: prefix when not needed Remove unnecessary casts Remove block with only one line Saves 128 bytes Change-Id: I3a87430eeb01b81e7b81a1c38f6fdd3274ec48f3
* Upintegrate Audio Flinger changes from ICS_AAHJohn Grossman2012-02-161-8/+15
| | | | | | | | Bring in changes to audio flinger made to support timed audio tracks and HW master volume control. Change-Id: Ide52d48809bdbed13acf35fd59b24637e35064ae Signed-off-by: John Grossman <johngro@google.com>
* Update commentsGlenn Kasten2012-02-141-1/+1
| | | | | | We no longer put the filename at start of file. Change-Id: Ic435b159a23105681e3d4a6cb1ac097bc853302e
* Merge "AudioFlinger methods const and inline"Glenn Kasten2012-02-081-4/+5
|\
| * AudioFlinger methods const and inlineGlenn Kasten2012-02-031-4/+5
| | | | | | | | | | | | This saves 1063 bytes and probably improves performance. Change-Id: I11cf0dfd925fbaec75e3d1b806852a538eae5518
* | Use virtual destructorsGlenn Kasten2012-02-031-1/+1
|/ | | | | | | | | | It turns out to be just a comment, as all except AudioMixer are RefBase. There are only a few performance-sensitive cases where it's worth thinking about whether you need a virtual destructor, and the headache usually outweighs the benefit. Change-Id: I716292f9556ec17c29ce8c76ac8ae602cb496533
* Merge "By convention const goes before the type specifier"Glenn Kasten2012-01-091-1/+1
|\
| * By convention const goes before the type specifierGlenn Kasten2012-01-061-1/+1
| | | | | | | | Change-Id: I70203abd6a6f54e5bd9f1412800cc01212157e58
* | Merge "Remove the notion of "active track" from mixer"Glenn Kasten2012-01-051-7/+7
|\ \ | |/ |/|
| * Remove the notion of "active track" from mixerGlenn Kasten2011-12-201-7/+7
| | | | | | | | | | | | This is a first step towards making the mixer more object-oriented. Change-Id: Ifd445d0e471023a7f5c82e934736ffc95ba1b05b
* | Merge "Use the standard CC_LIKELY and CC_UNLIKELY macros"Glenn Kasten2012-01-051-5/+0
|\ \
| * | Use the standard CC_LIKELY and CC_UNLIKELY macrosGlenn Kasten2012-01-051-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Several source files privately defined macros LIKELY and UNLIKELY in terms of __builtin_expect. But <cutils/compiler.h> already has CC_LIKELY and CC_UNLIKELY which are intended for this purpose. So rename the private uses to use the standard names. In addition, AudioFlinger was relying on the macro expanding to extra ( ). Change-Id: I2494e087a0c0cac0ac998335f5e9c8ad02955873
* | | resolved conflicts for merge of 1a4b9939 to masterEric Laurent2012-01-041-0/+3
|\ \ \ | |/ / |/| | | | | Change-Id: I0c910d391a38a916d8431f7d1f5b82e39e1a66c2
| * | audioflinger: fix clicks on 48kHz audio.Eric Laurent2011-12-221-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The calculation done in prepareTracks_l() for the minimum amount off frames needed to mix one output buffer had 2 issues: - the additional sample needed for interpolation was not included - the fact that the resampler does not acknowledge the frames consumed immediately after each mixing round but only once all frames requested have been used was not taken into account. Thus the number of frames available in track buffer could be considered sufficient although it was not and the resampler would abort producing a short silence perceived as a click. Issue 5727099. Change-Id: I7419847a7474c7d9f9170bedd0a636132262142c
* | | Merge "Remove dead code"Glenn Kasten2011-12-201-5/+2
|\ \ \ | |_|/ |/| |
| * | Remove dead codeGlenn Kasten2011-12-191-5/+2
| |/ | | | | | | Change-Id: Icf23f7f90fdeb660f4015f22cf239e6d05f5d03c
* | Merge "Use constants for 2 and 32"Glenn Kasten2011-12-161-5/+5
|\ \
| * | Use constants for 2 and 32Glenn Kasten2011-12-161-5/+5
| | | | | | | | | | | | Change-Id: If820dfd58b6df258570750610a07af99598d9e53
* | | Merge "Extract out audio DSP code to utility library"Glenn Kasten2011-12-161-2/+0
|\ \ \ | |/ / |/| |
| * | Extract out audio DSP code to utility libraryGlenn Kasten2011-12-161-2/+0
| |/ | | | | | | Change-Id: Ib8ce72028a7ea30e82baa518e381370e820ebbd0
* | Use switch in AudioMixer::setParameterGlenn Kasten2011-12-161-1/+1
| | | | | | | | | | | | | | | | Replace series of if/then/elses by easier-to-read switch. Also return void instead of status_t, since callers weren't checking it. Assert on bad input parameters. Change-Id: Ie1f0a297977b28501d20e1af819afed9b4750616
* | Merge "setActiveTrack and setBufferProvider can't fail"Glenn Kasten2011-12-161-2/+2
|\ \
| * | setActiveTrack and setBufferProvider can't failGlenn Kasten2011-12-151-2/+2
| |/ | | | | | | | | | | | | | | | | | | Return void, not status_t, from setActiveTrack and setBufferProvider. These methods returned status_t, but the callers never checked the return value. Since these aren't externally visible APIs, they now return void, and assert on bad input parameters. Change-Id: I530ed29484596ae41e8659826ca425149c51c2a1
* | Merge "Simplify enable/disable mixing"Glenn Kasten2011-12-161-4/+3
|\ \
| * | Simplify enable/disable mixingGlenn Kasten2011-12-151-4/+3
| |/ | | | | | | | | | | The MIXING enum isn't needed, and now returns void instead of status_t. Change-Id: Ibe4ec24081d75ad4ab78b9c7191fc9077959c4e9
* | Audio C++ commentsGlenn Kasten2011-12-141-2/+2
|/ | | | Change-Id: I84906ebb9dfcfa5b96b287d18364b407f02a30c1
* Use channel mask instead of channel count for track creationJean-Michel Trivi2011-06-011-1/+2
| | | | | | | | | | | | | | | | | Record and playback objects (resp AudioRecord and AudioTrack) are created using a channel mask, but this information is lost in the mixer because only the channel count is known to AudioFlinger. A channel count can always be derived from a channel mask. The change consists in: - disambiguiting variable names for channel masks and counts - passing the mask information from the client to AudioFlinger and the mixer. - when using the DIRECT ouput, only verifying the format of the track is compatible with the output's for PCM. Change-Id: I50d87bfb7d7afcabdf5f12d4ab75ef3a54132c0e
* Fix issue 3479042.Eric Laurent2011-02-281-0/+2
| | | | | | | | | | | | | | | | The problem is that when an AudioRecord using the resampler is restarted, the resampler state is not reset (as there is no reset function in the resampler). The consequence is that the first time the record thread loop runs, it calls the resampler which consumes the remaining data in the input buffer and when this buffer is released the input index is incremented over the limit. The fix consists in implementing a reset function in the resampler. A similar problem was also present for playback but unoticed because the track buffer is always drained by the mixer when a track stops. The only problem for playback was that the initial phase fraction was wrong when restarting a track after stop (it was correct after a pause). Change-Id: Ifc2585d685f4402d29f4afc63f6efd1d69265de3
* move native services under services/Mathias Agopian2010-07-141-0/+207
moved surfaceflinger, audioflinger, cameraservice all native services should now reside in this location. Change-Id: Iee42b83dd2a94c3bf5107ab0895fe2dfcd5337a8