History log of /frameworks/av/services/audioflinger/AudioMixer.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
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
2dd4bdd715f586d4d30cf90cc6fc2bbfbce60fe0 29-Aug-2012 Glenn Kasten <gkasten@google.com> Move libnbaio out of AudioFlinger

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
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
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

Change-Id: I589b0781cda5b3c82f85b561c52b08546cac21f8
4e2293f29f2e719af1245d365747ea06d074b345 12-Apr-2012 Glenn Kasten <gkasten@google.com> AudioMixer new cmd: remove sample rate converter

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
7d5b26230a179cd7bcc01f6578cd80d8c15a92a5 05-Apr-2012 Jean-Michel Trivi <jmtrivi@google.com> AudioMixer uses downmix effect for multichannel content

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
ccf89b54f973f11082150d02ed957f7e967fbc8b 21-Mar-2012 Glenn Kasten <gkasten@google.com> Merge "AudioMixer can be configured for fewer max tracks"
5c94b6c7689a335e26a86e8a0d04b56dc627738e 21-Mar-2012 Glenn Kasten <gkasten@google.com> AudioMixer can be configured for fewer max tracks

Change-Id: I371b17cef071d083eecf35cd3627a3adff907a33
17a736c3e1d062d7fc916329eb32aef8935614af 14-Feb-2012 Glenn Kasten <gkasten@google.com> Update comments

Change-Id: I327663a020670d0a72ff57bd0b682e2ce0528650
3b81acab52b7140c1b8b20be2d67be3e221637e7 28-Jan-2012 Glenn Kasten <gkasten@google.com> Remove bit fields to improve performance

uint16_t enabled is (mostly) changed to bool in a separate CL

Change-Id: Ied9f8c034b2479cee9a8778cee7b8ff92ae75b7b
a111792f1314479c649d1d44c30c2caf70c00c2a 26-Jan-2012 Glenn Kasten <gkasten@google.com> Simplify code

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
4ff14bae91075eb274eb1c2975982358946e7e63 09-Feb-2012 John Grossman <johngro@google.com> Upintegrate Audio Flinger changes from ICS_AAH

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>
99e53b86eebb605b70dd7591b89bf61a9414ed0e 19-Jan-2012 Glenn Kasten <gkasten@google.com> Update comments

We no longer put the filename at start of file.

Change-Id: Ic435b159a23105681e3d4a6cb1ac097bc853302e
63d2daed17ab749baa80bc808fb5083b688b771b 08-Feb-2012 Glenn Kasten <gkasten@google.com> Merge "AudioFlinger methods const and inline"
c59c004a3a6042c0990d71179f88eee2ce781e3c 02-Feb-2012 Glenn Kasten <gkasten@google.com> AudioFlinger methods const and inline

This saves 1063 bytes and probably improves performance.

Change-Id: I11cf0dfd925fbaec75e3d1b806852a538eae5518
c19e22450e6e3d07594c935c7a9522e85e909e82 30-Jan-2012 Glenn Kasten <gkasten@google.com> Use virtual destructors

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
5f29ca38b71506ad7c7cb9925efbddf588e9655b 09-Jan-2012 Glenn Kasten <gkasten@google.com> Merge "By convention const goes before the type specifier"
54c3b66444ebfb9f2265ee70ac3b76ccefa0506a 06-Jan-2012 Glenn Kasten <gkasten@google.com> By convention const goes before the type specifier

Change-Id: I70203abd6a6f54e5bd9f1412800cc01212157e58
88592eccaf6afcddd5f985955be92fe25205c680 05-Jan-2012 Glenn Kasten <gkasten@google.com> Merge "Remove the notion of "active track" from mixer"
a2a0a5d7d56baa831870f4bf2a0d942a477d92ef 05-Jan-2012 Glenn Kasten <gkasten@google.com> Merge "Use the standard CC_LIKELY and CC_UNLIKELY macros"
f6b1678f8f508b447155a81b44e214475ab634a8 15-Dec-2011 Glenn Kasten <gkasten@google.com> Use the standard CC_LIKELY and CC_UNLIKELY macros

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
7ab41c9f773ba599646f1b0d00955c1be80f92fd 05-Jan-2012 Eric Laurent <elaurent@google.com> resolved conflicts for merge of 1a4b9939 to master

Change-Id: I0c910d391a38a916d8431f7d1f5b82e39e1a66c2
071ccd5a9702500f3f7d62ef881300914926184d 23-Dec-2011 Eric Laurent <elaurent@google.com> audioflinger: fix clicks on 48kHz audio.

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
9c56d4ae6212c21ce5fd71ed534eb195983a07c1 20-Dec-2011 Glenn Kasten <gkasten@google.com> Remove the notion of "active track" from mixer

This is a first step towards making the mixer more object-oriented.

Change-Id: Ifd445d0e471023a7f5c82e934736ffc95ba1b05b
12d9702773c8a3242a44dd6528126c9ff0dade43 20-Dec-2011 Glenn Kasten <gkasten@google.com> Merge "Remove dead code"
81a028fef62bcadf13fc8550067a3d29c918b3ca 15-Dec-2011 Glenn Kasten <gkasten@google.com> Remove dead code

Change-Id: Icf23f7f90fdeb660f4015f22cf239e6d05f5d03c
f602a5f7f29e694a7da4c143737b74501c00477d 17-Dec-2011 Glenn Kasten <gkasten@google.com> Merge "Use constants for 2 and 32"
d1e672acd8fa1af899f85ee2321327237028adf8 17-Dec-2011 Glenn Kasten <gkasten@google.com> Merge "Extract out audio DSP code to utility library"
bf71f1e7948406492376c6cbd5e6a30c8cb670e4 13-Dec-2011 Glenn Kasten <gkasten@google.com> Use constants for 2 and 32

Change-Id: If820dfd58b6df258570750610a07af99598d9e53
788040c5189bbdaf567ce4b29ffd1db08ea1020c 05-May-2011 Glenn Kasten <gkasten@google.com> Use switch in AudioMixer::setParameter

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
3b21c50ef95fe4e7ac3426ca14b365749e66ff08 15-Dec-2011 Glenn Kasten <gkasten@google.com> Extract out audio DSP code to utility library

Change-Id: Ib8ce72028a7ea30e82baa518e381370e820ebbd0
6d4bf6eda04888144ec59cba4816a2cbb79b9e5c 16-Dec-2011 Glenn Kasten <gkasten@google.com> Merge "setActiveTrack and setBufferProvider can't fail"
b87c068727a15a3d3f0bfdcb758c76a097f5e869 16-Dec-2011 Glenn Kasten <gkasten@google.com> Merge "Simplify enable/disable mixing"
fba380a0b2c62684ce4272a05165965bae29d6a1 16-Dec-2011 Glenn Kasten <gkasten@google.com> setActiveTrack and setBufferProvider can't fail

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
1c48c3c61970527b97892ab6a2daae8eaac26964 15-Dec-2011 Glenn Kasten <gkasten@google.com> Simplify enable/disable mixing

The MIXING enum isn't needed, and now returns void instead of status_t.

Change-Id: Ibe4ec24081d75ad4ab78b9c7191fc9077959c4e9
362c4e697d8e9c034e964ac7b40227e054491547 14-Dec-2011 Glenn Kasten <gkasten@google.com> Audio C++ comments

Change-Id: I84906ebb9dfcfa5b96b287d18364b407f02a30c1
0d255b2d9061ba31f13ada3fc0f7e51916407176 25-May-2011 Jean-Michel Trivi <jmtrivi@google.com> Use channel mask instead of channel count for track creation

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
243f5f91755c01614a8cafe90b0806396e22d553 01-Mar-2011 Eric Laurent <elaurent@google.com> Fix issue 3479042.

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
65ab47156e1c7dfcd8cc4266253a5ff30219e7f0 15-Jul-2010 Mathias Agopian <mathias@google.com> move native services under services/

moved surfaceflinger, audioflinger, cameraservice

all native services should now reside in this location.

Change-Id: Iee42b83dd2a94c3bf5107ab0895fe2dfcd5337a8