23 Commits

Author SHA1 Message Date
Glenn Kasten
4e7191448d Merge "By convention const goes before the type specifier" 2012-01-09 11:59:17 -08:00
Glenn Kasten
99c2fd36dc By convention const goes before the type specifier
Change-Id: I70203abd6a6f54e5bd9f1412800cc01212157e58
2012-01-06 08:00:59 -08:00
Glenn Kasten
6b14d58580 Merge "Remove the notion of "active track" from mixer" 2012-01-05 08:20:10 -08:00
Glenn Kasten
a8719ad9d5 Merge "Use the standard CC_LIKELY and CC_UNLIKELY macros" 2012-01-05 07:38:29 -08:00
Glenn Kasten
e80a4ccd2b 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
2012-01-05 07:33:45 -08:00
Eric Laurent
dc8627e7dc resolved conflicts for merge of 1a4b9939 to master
Change-Id: I0c910d391a38a916d8431f7d1f5b82e39e1a66c2
2012-01-04 17:39:12 -08:00
Eric Laurent
72dafb20e0 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
2011-12-22 16:08:41 -08:00
Glenn Kasten
68deb15a2b Remove the notion of "active track" from mixer
This is a first step towards making the mixer more object-oriented.

Change-Id: Ifd445d0e471023a7f5c82e934736ffc95ba1b05b
2011-12-20 16:29:21 -08:00
Glenn Kasten
bdb0cee0ef Merge "Remove dead code" 2011-12-20 10:29:49 -08:00
Glenn Kasten
31ba2e5541 Remove dead code
Change-Id: Icf23f7f90fdeb660f4015f22cf239e6d05f5d03c
2011-12-19 15:55:47 -08:00
Glenn Kasten
279f872167 Merge "Use constants for 2 and 32" 2011-12-16 15:10:36 -08:00
Glenn Kasten
d9de2d21ef Merge "Extract out audio DSP code to utility library" 2011-12-16 15:02:30 -08:00
Glenn Kasten
1f6f05da93 Use constants for 2 and 32
Change-Id: If820dfd58b6df258570750610a07af99598d9e53
2011-12-16 14:55:05 -08:00
Glenn Kasten
bde164abbc 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
2011-12-16 13:28:33 -08:00
Glenn Kasten
490909d2c0 Extract out audio DSP code to utility library
Change-Id: Ib8ce72028a7ea30e82baa518e381370e820ebbd0
2011-12-16 11:42:03 -08:00
Glenn Kasten
f96272c3cd Merge "setActiveTrack and setBufferProvider can't fail" 2011-12-16 07:30:14 -08:00
Glenn Kasten
844756be54 Merge "Simplify enable/disable mixing" 2011-12-16 07:29:57 -08:00
Glenn Kasten
afb40b5fcf 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
2011-12-15 15:55:51 -08:00
Glenn Kasten
af62dbca02 Simplify enable/disable mixing
The MIXING enum isn't needed, and now returns void instead of status_t.

Change-Id: Ibe4ec24081d75ad4ab78b9c7191fc9077959c4e9
2011-12-15 15:00:28 -08:00
Glenn Kasten
e5fb263a36 Audio C++ comments
Change-Id: I84906ebb9dfcfa5b96b287d18364b407f02a30c1
2011-12-14 14:38:26 -08:00
Jean-Michel Trivi
5439223b56 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
2011-06-01 10:55:29 -07:00
Eric Laurent
4bb21c496b 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
2011-02-28 16:52:51 -08:00
Mathias Agopian
08e83bb3b7 move native services under services/
moved surfaceflinger, audioflinger, cameraservice

all native services should now reside in this location.

Change-Id: Iee42b83dd2a94c3bf5107ab0895fe2dfcd5337a8
2010-07-14 17:59:35 -07:00