summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/AudioMixer.h
Commit message (Collapse)AuthorAgeFilesLines
* Use AudioPlaybackRate to hold TimestretchBufferProvider parametersRicardo Garcia2015-04-221-3/+3
| | | | | | | | Use this struct to handle the parameters for TimestretchBufferProvider all across the system. Add stretch mode and fallback mode to TimestretchBuffer Provider. Change-Id: I19099924a7003c62e48bb6ead56c785cb129fba2
* Add playback rate to AudioMixerAndy Hung2015-04-091-0/+13
| | | | | Bug: 19196501 Change-Id: I42d1f90e6297cf3f1304860d1691a5dfedd4c37d
* Factor out buffer provider code from AudioMixerAndy Hung2015-04-081-111/+4
| | | | | | | In preparation for playback rate support and timestretching. Bug: 19196501 Change-Id: I435accb852d32110dd0b3a9917488522c567ba80
* Remove redundant semicolon from namespace closingGlenn Kasten2015-03-031-1/+1
| | | | Change-Id: I163f9d3d216c283ae1160ce4802e5247cf44fba7
* Allow AUDIO_FORMAT_PCM_8_BIT AudioTrack buffersAndy Hung2015-01-141-4/+10
| | | | | | | | Previously conversion to AUDIO_FORMAT_PCM_16_BIT was required. Client shared memory for static tracks and AudioFlinger track creation and buffer delivery now use native 8 bit PCM data. Change-Id: I485c07a4971fde9a25442bd43fed95019d39abcc
* am d0e12a16: am 902dc42d: am 07715ac3: Merge "C++11 compatibility."Dan Albert2014-11-201-6/+6
|\ | | | | | | | | * commit 'd0e12a161471823d1ab269cb608be3f3b0a71ed1': C++11 compatibility.
| * C++11 compatibility.Dan Albert2014-11-201-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix string literal concatenation to not be interpreted as UD literals. * Add constexpr compatibility for non-integral static members. * Use __typeof__ instead of typeof (should become decltype once this actually becomes C++11). * Add an appropriate cast for atomic_uintptr_t, since moving to C++11 means moving from <stdatomic.h> to <atomic>, which has better typechecking (hooray for not macros!). Bug: 18466763 Change-Id: I9561dcb2526578687819ff85421ba80d8e1a9694
* | Fix AudioMixer floating interaction with downmixerAndy Hung2014-11-071-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously _if_ the full floating point mixer is enabled, a downmixer would force the mixer input for a session submix to integer, breaking other mixer inputs to the same submix that were in float. Use another ReformatBufferProvider after the downmixer to solve this issue. Update the test-mixer app and the mixer_to_wave_tests shell script to detect this issue. Bug: 17363939 Change-Id: I74a56333f9ee75ddde39a75392c021c5eebddbef
* | Move AudioMixer buffer provider preparation into trackAndy Hung2014-11-071-8/+6
|/ | | | | Bug: 17363939 Change-Id: I1f0f597b008f7369df87ba369fabaa93dec08ea1
* Remove unused TwoTrack process mode from AudioMixerAndy Hung2014-08-041-4/+0
| | | | | | Legacy code that has not been hooked up. Change-Id: Ic01a4eddfa1020089d5bc42f58b6a4697698c27a
* Add multichannel capability to AudioFlingerAndy Hung2014-07-241-1/+1
| | | | | | But not enabled (kEnableExtendedChannels == false). Change-Id: I62f7e31fbd29ad703a9a02f5d1a280b6972dd423
* Add multichannel capability to AudioMixerAndy Hung2014-07-241-20/+25
| | | | | | | | tests/test-mixer updated to handle multichannel. New mixer path is still disabled (kUseNewMixer = false). Subsequent CL will enable multichannel capability. Change-Id: I71dafa94cc1d9af567c285e0ded7c5c94e3ff926
* Add RemixBufferProvider to AudioMixerAndy Hung2014-07-181-2/+19
| | | | | | | This is used to convert between channel masks for input AudioTrack data. Change-Id: Iedffaeccb99c7053992152e7b1cb6b2d33b12eef
* Update DownmixerBufferProvider to use CopyBufferProviderAndy Hung2014-07-181-14/+23
| | | | Change-Id: I6b1a8755a1e6c29b916662fd376e9509cda5df55
* Add CopyBufferProvider class for AudioMixerAndy Hung2014-07-181-28/+60
| | | | | | | | AudioMixer::ReformatBufferProvider now uses it as a base class. Fix ReformatBufferProvider object leak. Change-Id: If196f844eaaa124a173ffa27afe88098023c2ff9
* Add floating point volume handling to AudioMixerAndy Hung2014-07-081-3/+26
| | | | | | | | | | | | | | | Use floating point volume in AudioMixer mixing when floating point input is used with the new mixer engine. AudioResampler is updated to take floating point volume to match. Both legacy integer and floating point mixer engines work. For now, integer volume is used when the new mixer engine runs in integer input mode, for backward compatibility with the legacy mixer. The new mixer engine will generally run in floating point input mode. When the legacy path is removed, the integer volumes will be removed. Change-Id: I79e80c292ae7c8b8bdd0aa371a1b2c3a1b618290
* Add new AudioMixer processing hooksAndy Hung2014-06-301-1/+36
| | | | | | | | This change adds new process and thread hooks for multi-format handling. It is enabled by setting kUseNewMixer = true. Change-Id: I262a3d2e4411f8cef7370a497b77a34eb55f1f86
* Change parameter type for volume to float in AudioMixerAndy Hung2014-05-301-0/+1
| | | | Change-Id: I4da1505ce852505f86f8e5b87f60e8edceeb30e0
* Rename UNITY_GAIN to UNITY_GAIN_INT in AudioMixerAndy Hung2014-05-301-2/+2
| | | | Change-Id: Ic040311305026f0b4c4280a5b3bef7a447ac1da3
* Merge "Add multiple format capability to AudioMixer"Andy Hung2014-05-271-3/+45
|\
| * Add multiple format capability to AudioMixerAndy Hung2014-05-231-3/+45
| | | | | | | | | | Change-Id: I04ac1cafd90b6ed652f8d51888ad07576678f0bc Signed-off-by: Andy Hung <hunga@google.com>
* | Merge "Add format parameter to getTrackName() and track_t"Andy Hung2014-05-231-4/+10
|\ \ | |/
| * Add format parameter to getTrackName() and track_tAndy Hung2014-05-191-4/+10
| | | | | | | | | | Change-Id: Ia152a839014e235fbfb656104c15d7c1b456d02e Signed-off-by: Andy Hung <hunga@google.com>
* | Pass stereo gains as packed minifloatGlenn Kasten2014-05-191-0/+4
|/ | | | | | | | | | 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
* Rename mSinkFormat to mMixerFormat for AudioMixer::track_tAndy Hung2014-03-011-2/+2
| | | | | | | AudioMixer::SINK_FORMAT also changes to AudioMixer::MIXER_FORMAT Change-Id: Ic3f8be77d2c75c082c4fd140bc907e30c304d285 Signed-off-by: Andy Hung <hunga@google.com>
* Add Track Sink Format to AudioMixerAndy Hung2014-02-261-1/+4
| | | | | | | | | 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>
* Fix clang warnings in AudioFlingerGlenn Kasten2014-02-101-1/+1
| | | | Change-Id: I0fa61025c979709ad7d655bc717df5f194b6089e
* Simplify track 'needs' bitsGlenn Kasten2013-11-061-15/+7
| | | | | | | Use more standard coding convention for bit masks, and add a FIXME about max channel count. Change-Id: I856784016703417ee480b92ae73757c472f9cf95
* Fix race condition in initializing downmixGlenn Kasten2013-11-061-2/+2
| | | | | | | | | | | | | | | | | 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
* media.log cleanupGlenn Kasten2013-03-011-1/+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-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