summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/AudioMixer.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Use new channel count functions for audio masksAndy Hung2014-05-161-2/+2
| | | | | Change-Id: Ia658ab4b6320d19fdb50f123c930918724ff0ef3 Signed-off-by: Andy Hung <hunga@google.com>
* Change references of Q19.12 to Q4.27 for clarityAndy Hung2014-04-021-4/+4
| | | | | Change-Id: I5beb7daf6ff9bc123ff3582f7c294edcaf8652f6 Signed-off-by: Andy Hung <hunga@google.com>
* Use LOG_ALWAYS_FATAL instead of LOG_FATALGlenn Kasten2014-03-261-4/+4
| | | | | | | LOG_FATAL is compiled out in most builds, so the assertion checks were not being performed. Change-Id: I774f0985ab9c5ccecd8989a0f1c940386b73fc35
* Rename mSinkFormat to mMixerFormat for AudioMixer::track_tAndy Hung2014-03-011-12/+12
| | | | | | | AudioMixer::SINK_FORMAT also changes to AudioMixer::MIXER_FORMAT Change-Id: Ic3f8be77d2c75c082c4fd140bc907e30c304d285 Signed-off-by: Andy Hung <hunga@google.com>
* Use float_from_q19_12 conversion in AudioMixerAndy Hung2014-02-281-3/+4
| | | | | Change-Id: Idbe84fb9610c7e636a84468f2e2402a913435ca9 Signed-off-by: Andy Hung <hunga@google.com>
* Add Track Sink Format to AudioMixerAndy Hung2014-02-261-22/+68
| | | | | | | | | Track Sink Format now allows both AUDIO_FORMAT_PCM_FLOAT and AUDIO_FORMAT_PCM_16_BIT (default). The float case is not enabled now. Change-Id: Ibee70cab4725c8bc9905e49f1f9a9c2448f76e00 Signed-off-by: Andy Hung <hunga@google.com>
* resolved conflicts for merge of 566be7c3 to masterNarayan Kamath2014-02-111-3/+4
|\ | | | | | | Change-Id: I7b1cc71057b2bd4f771e7bcf508a8c3abd6017ce
| * Make frameworks/av 64-bit compatibleKévin PETIT2014-02-111-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | Enable new dynamic audio resampler as defaultAndy Hung2014-01-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The default may still be overridden by af.resampler.quality in the local or build properties file. For the build properties check the relevant device.mk files. In the absence of being overridden, the 44.1 to 48kHz and 48 to 44.1kHz conversion will use the DYN_MED_QUALITY resamplers and other conversion will use the DYN_LOW_QUALITY resamplers. Change-Id: Icf9a4af5422cddc445e1904eef93984b0abe6a44 Signed-off-by: Andy Hung <hunga@google.com>
* | Merge "Remove warnings in Audio mixer resampler compilation."Andy Hung2014-01-301-7/+7
|\ \
| * | Remove warnings in Audio mixer resampler compilation.Andy Hung2014-01-291-7/+7
| | | | | | | | | | | | | | | Change-Id: Ie68766142796772a54a90afdea188d0a5a78d4ac Signed-off-by: Andy Hung <hunga@google.com>
* | | Merge commit 'adf3f9b9' into manualmergeGlenn Kasten2014-01-291-5/+7
|\ \ \ | |/ / |/| / | |/ Change-Id: Icdef7d075b160eb2a5ced7c57f90c6a6a4b4c64a
| * AudioMixer: Remove tracks from enabledTracks after reseting outTempGaurav Kumar2014-01-291-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If any track goes through AudioMixer::process__genericNoResampling, and its getnextbuffer returns NULL, Then that track is removed by AudioMixer from enabledTracks. Thus if all tracks getnextbuffer return NULL, Then this function doesn't reset outTemp and last buffer in AudioFlinger's mMixBuffer will be repeated and noise is observed. Remove tracks from enabledTracks after reseting outTemp to zero, so that process__genericNoResampling will reset outTemp and noise won't appear. Bug: 12450065 Change-Id: I1ccac7ee4a3bf7fd930254356c072099e11e7c19 Signed-off-by: Gaurav Kumar <gaurav.kumar@broadcom.com> Signed-off-by: Pierre Couillaud <pierre@broadcom.com>
* | Merge "Channel counts are uint32_t"Glenn Kasten2013-11-081-1/+1
|\ \
| * | Channel counts are uint32_tGlenn Kasten2013-11-061-1/+1
| | | | | | | | | | | | Change-Id: I5676b6a291b72d7db6326f7eaf6d17588de51b05
* | | Simplify track 'needs' bitsGlenn Kasten2013-11-061-11/+13
| | | | | | | | | | | | | | | | | | | | | Use more standard coding convention for bit masks, and add a FIXME about max channel count. Change-Id: I856784016703417ee480b92ae73757c472f9cf95
* | | Remove redundant this->Glenn Kasten2013-11-061-2/+2
| | | | | | | | | | | | Change-Id: Id783201e802b6ce294fa92f4bbe492adfb446686
* | | Remove dead codeGlenn Kasten2013-11-061-2/+0
| | | | | | | | | | | | Change-Id: Ide9196aa348cd3846b5c71d51fe6538f38ea8dc2
* | | Fix race condition in initializing downmixGlenn Kasten2013-11-061-25/+26
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code that initializes downmix GUID searches for an effect of the right type. If two or more AudioMixers are created, there is a possibility that the GUID will temporarily have the wrong value. Now the initialization is only done once, regardless of how many AudioMixers there are. Other minor changes: - use naming convention of leading 's' for static member variables - log message for no downmix effect is now a warning instead of an error, since it is not an error until there is actual content to downmix without a downmix effect Change-Id: I33ab0e51cf9d24ecaf8ae868883736b0772178c4
* | Explicit comparison to 0 for integral typesGlenn Kasten2013-08-131-4/+4
| | | | | | | | Change-Id: I2bfe864d1bda719581e297a38d96abfc0e3748b9
* | Use curly braces in 'if' to make it easier to add logsGlenn Kasten2013-08-131-4/+5
|/ | | | Change-Id: I58b33fefdd8bf703647414157a99a3223be3531c
* Make AudioFlinger::instantiate() more resilient when called from separate moduleGlenn Kasten2013-07-191-0/+1
| | | | | Bug: 8834855 Change-Id: I4cd842cdfb09d2aaaaab9df9ac3bec6179709bd3
* media.log cleanupGlenn Kasten2013-03-011-1/+6
| | | | | | | | | | | | | | 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 "Logging to investigate a crash"Glenn Kasten2013-02-271-6/+0
| | | | This reverts commit f0ff908da019a44115109f1b4d1b6864b35a8a29.
* A reference cannot be re-boundGlenn Kasten2013-02-191-20/+24
| | | | | | Bug: 8213067 Bug: 6490974 Change-Id: If546215641fbc9a0fb1e8af8b85cc01f0a4b26ab
* Revert "Temporary additional logging to investigate bug"Glenn Kasten2013-02-151-68/+4
| | | | | | This reverts commit 32584a7d672864b20ab8b83a3cb23c1858e908b7 Change-Id: I9dc680578b955b1af462eeb7a49d61a0d45eb81b
* Temporary additional logging to investigate bugGlenn Kasten2013-02-151-4/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/+3
| | | | | | This reverts commit 639482c24c911b125398b31883ba6d55faebe28b Change-Id: I11f2829072ab11e18b0663024f27bf31192f1d39
* Temporary additional logging to investigate bugGlenn Kasten2013-02-141-3/+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-6/+2
| | | | | | This reverts commit 0ddd56316262ac74a95e9edb595697c163136d6d Change-Id: I180a928af6f5a38d15a5efe44cd1fe927b5d961c
* Temporary additional logging to investigate bugGlenn Kasten2013-02-131-2/+6
| | | | | | | | | | | | | | | | | | | 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
* am 76143093: am f0ff908d: Logging to investigate a crashGlenn Kasten2012-12-101-0/+6
|\ | | | | | | | | * commit '761430930a7335d714af0f7c1d497feb8f9f0a5a': Logging to investigate a crash
| * Logging to investigate a crashGlenn Kasten2012-12-071-0/+6
| | | | | | | | | | Bug: 6490974 Change-Id: Ib926a9258bde4ee05ed42eea662dff68e426a997
* | Line length 100Glenn Kasten2012-11-011-10/+20
| | | | | | | | Change-Id: Ib28fd7b9ce951a6933f006e7f8812ba617625530
* | Document AudioMixer hard-coded limitsGlenn Kasten2012-10-261-0/+6
| | | | | | | | Change-Id: I83ea8bed375f251260945db788bdb5f280dba12d
* | resolved conflicts for merge of f12b1c81 to masterGlenn Kasten2012-10-041-1/+13
|\ \ | |/ | | | | Change-Id: I914a11706bd01a198e2137e0c12af0fc92ffa02b
| * Integrate improved coefficient sinc resampler: VHQGlenn Kasten2012-10-041-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Very high quality is enabled only for 44.1 -> 48 or 48 -> 44.1, and uses low quality for all other use cases. Track estimated CPU load and throttles the quality based on load; as currently configured it should allow up to 2 instances of very high quality. Medium quality and high quality are currently disabled unless explicitly requested. Details: Only load .so the first time it is needed. Cleanup code style: formatting, indentation, whitespace. Restore medium quality resampler, but it is not used (see next line). Fix memory leak for sinc resampler. Check sample rate in resampler constructor. Add logs for debugging. Rename DEFAULT to DEFAULT_QUALITY for consistency with other quality levels. Renumber VERY_HIGH_QUALITY from 255 to 4. Use enum src_quality consistently. Improve parsing of property af.resampler.quality. Fix reentrancy bug - allow an instance of high quality and an instance of very high quality to both be active concurrently. Bug: 7229644 Change-Id: I0ce6b913b05038889f50462a38830b61a602a9f7
| * 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
* | Communicate audio session ID to downmixerJean-Michel Trivi2012-09-121-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: I836873eebd6711f1048fce81cd2eb29b94f0ad0c
* | am 0efd0358: am fcfc61da: am ff4c64d6: am c64a1787: Merge "Fix ↵Jean-Baptiste Queru2012-08-101-1/+5
|\ \ | |/ | | | | | | | | | | initialization of audio mixer track resources for MIPS." * commit '0efd035854ad2c8d20100a740e054c4bf7b3e9a4': Fix initialization of audio mixer track resources for MIPS.
| * am ff4c64d6: am c64a1787: Merge "Fix initialization of audio mixer track ↵Jean-Baptiste Queru2012-08-101-1/+5
| |\ | | | | | | | | | | | | | | | | | | resources for MIPS." * commit 'ff4c64d6b1b58494a1b15f1a664e5c421d095d15': Fix initialization of audio mixer track resources for MIPS.
| | * Fix initialization of audio mixer track resources for MIPS.Paul Lind2012-08-011-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The value 1 << 32 (maxNumTracks defaults to 32) is surprisingly not defined in C, and differs on MIPS than the other arch. Therefore the track resources were not initialized properly, resulting in failure to play any audio. The fix allows the mConfiguredNames bitmask to be correctly set to all 1's in the 32-track case, for all arch. Change-Id: Ied3e1305952e9567602e2cd76c5ef3acb0809ee0 Signed-off-by: Paul Lind <plind@mips.com>
* | | Share local time frequency for all tracks & mixersGlenn Kasten2012-07-251-6/+14
|/ / | | | | | | Change-Id: I5e6f0e371f728a5225c2fa6f778c109449d33602
* | Use audio_channel_mask_t more placesGlenn Kasten2012-07-101-1/+1
|/ | | | | | | | | | Use it in AudioSystem::getOutput(), AudioSystem::getInput(), IAudioPolicyService::getOutput(), IAudioPolicyService::getInput(), and various other places in AudioFlinger. Not done: AudioTrack and OutputDescriptor. Change-Id: I70e83455820bd8f05dafd30c63d636c6a47cd172
* Fix multichannel downmix pause bug on video playerJean-Michel Trivi2012-04-181-20/+51
| | | | | | | | | | | | | | | | | | | | | | 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
* Configure the resampler with the correct channel count when downmixingJean-Michel Trivi2012-04-181-2/+5
| | | | | | | | | | | | | When a track needs to be downmixed and resampled, it gets downmixed first before being resampled. Therefore the resampler needs to be configured with the channel count of the output of the downmixer instead of that of the track. Removed frame size checks that don't apply anymore now that we support frame sizes that are not powers of 2 (e.g. 12 for 5.1 16bits), and changed test performed for every buffer during playback into an assert. Change-Id: Ia220f00ee382f4f7848b661c58555bdca664e194
* AudioMixer new cmd: remove sample rate converterGlenn Kasten2012-04-161-10/+10
| | | | | | | | | | 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: fix crash in destructorEric Laurent2012-04-161-0/+1
| | | | | | | | | | Commit deeb1282 made that track->resampler is only set to NULL when getTrackName() is called. It remains uninitialized for all unused tracks causing a crash when deleted by Audiomixer destructor. Issue 6309441. Change-Id: I49451387a6afe81299b8368ef206524df32f74c4
* AudioMixer uses downmix effect for multichannel contentJean-Michel Trivi2012-04-091-4/+217
| | | | | | | | | | | | | | 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
* AudioMixer default track parametersGlenn Kasten2012-04-011-23/+33
| | | | | | | | | | Move the default initialization of track parameters from the AudioMixer constructor to getTrackName(). This fixes a bug where the defaults were only valid the first time a name was allocated. Also added a switch case for parameter FORMAT. Change-Id: I07abd3aaf7f4efe9825a761d2bc662aaee2c6db0