40 Commits

Author SHA1 Message Date
Eric Laurent
786c57150c am ce2e2184: am 37947afe: Merge "Fixed AudioFlinger not always pausing tracks" into gingerbread
Merge commit 'ce2e2184bbc5530f4fac3220fdf3d1b3fc08a4c3'

* commit 'ce2e2184bbc5530f4fac3220fdf3d1b3fc08a4c3':
  Fixed AudioFlinger not always pausing tracks
2010-10-07 12:23:39 -07:00
Eric Laurent
9a30fc13f5 Fixed AudioFlinger not always pausing tracks
If the pause request is received before the AudioTrack buffer was
completelly filled and the track ready for mixing, the pause is
not executed: the track just underruns and stays in pausing state.

The fix consists in considering the track ready for mixing immediately
if pausing.

Change-Id: Ia6cb4703fee2126e41011a6400ea8eeb3a3e5456
2010-10-05 14:41:42 -07:00
Eric Laurent
785c416ecf am de12c3cf: am 220ab887: Merge "Issue 3032913: improve AudioTrack recovery time" into gingerbread
Merge commit 'de12c3cf56e3f27b2efc60eeae8b5e422747f2b9'

* commit 'de12c3cf56e3f27b2efc60eeae8b5e422747f2b9':
  Issue 3032913: improve AudioTrack recovery time
2010-09-30 19:47:21 -07:00
Eric Laurent
4712baab81 Issue 3032913: improve AudioTrack recovery time
This issue showed that when an AudioTrack underruns during a too long period
of time and is therefore disabled by audioflinger mixer, it takes an additional
delay of up to 3 seconds to recover.
This fix adds a simple mechanism to recover immediately when the client application
is ready to write data again in the AudioTrack buffer

Also throttle warnings on record overflows

Change-Id: I8b2c71578dd134b9e60a15ee4d91b70f3799cb3d
2010-09-30 17:21:23 -07:00
Eric Laurent
c9a9800fa1 am b047e3cd: am aeb2c62e: Merge "Fix several audio effects problems." into gingerbread
Merge commit 'b047e3cdf24b32e26f366fcd4cd0eee8ae6c592c'

* commit 'b047e3cdf24b32e26f366fcd4cd0eee8ae6c592c':
  Fix several audio effects problems.
2010-09-28 17:39:54 -07:00
Eric Laurent
4fd3ecc1f0 Fix several audio effects problems.
Fixed the following issues in LVM effect bundle wrapper:
- memory leaks in EffectCreate() in case effect creation fails at various stages
- Added saturation when accumulating to output buffer
- Fixed problems with enabled effects count when an effect is released while enabled
- Do not allocate temporary buffer for accumulation each time process() is called

Fixed the following issues in effects framework (AudioFlinger)
- Release effect synchronously in the library when deleted from effect chain
- Do not call the effect process function if no tracks are present in the same
audio session

Change-Id: Ifbd80a163415cfb3c0a337c12082853ea45d9c91
2010-09-28 14:23:39 -07:00
Eric Laurent
8fee382010 am 692dfafe: am 880dfe4f: Merge "Fix issue 3007862" into gingerbread
Merge commit '692dfafe02d04cdbab5367546e166580c92e4d2e'

* commit '692dfafe02d04cdbab5367546e166580c92e4d2e':
  Fix issue 3007862
2010-09-24 10:34:28 -07:00
Eric Laurent
98c92599ac Fix issue 3007862
Removed a cross deadlock condition between audioflinger and audio policy
service mutexes.
Audioflinger::createEffect() locks audioflinger mutex and then calls
AudioSystem::getOutputForEffect() which ends up in
AudioPolicyService::getOutputForEffect() which locks audio policy service
mutex. If at the same time, the command thread in audio policy service is
processing a command(set volume, set route...), the mutex is locked and the
command will call one audioflinger method which in turn will attempt to
lock audioflinger mutex.
The fix consists in releasing audioflinger mutex before calling
getOutputForEffect().

Change-Id: Id44e7feb36e0a295731f6aa97cf32d022edd34d0
2010-09-24 09:32:40 -07:00
Eric Laurent
ec0efd0ceb am 11746caa: am 08959c63: Merge "Request permission for global audio effects." into gingerbread
Merge commit '11746caaa852984ff186bf5b8807e2c14cd7c1bc'

* commit '11746caaa852984ff186bf5b8807e2c14cd7c1bc':
  Request permission for global audio effects.
2010-09-22 17:04:48 -07:00
Eric Laurent
14beea487c Request permission for global audio effects.
Applications creating an audio effect on the output mix must
have the MODIFY_AUDIO_SETTINGS permission.

Change-Id: I57d88533f91ad0d33680107d79abcec28f7263b5
2010-09-22 15:58:38 -07:00
Eric Laurent
e931c68f53 am 4d987850: am bd2e9ec6: Merge "Fix volume problems with insert revert" into gingerbread
Merge commit '4d9878502f7661ed34540a485a5942d859e209c7'

* commit '4d9878502f7661ed34540a485a5942d859e209c7':
  Fix volume problems with insert revert
2010-09-13 14:42:59 -07:00
Eric Laurent
27a2fdfb8a Fix volume problems with insert revert
- Use a constant input level to the reverb engine and implement volume control in the
insert reverb. This avoids the volume spikes when an effect that was inserted after
the reverb is disabled or removed.
- Fix clicks (one silent buffer) at the end of the reverb disable period.
- Modified volume management in audioflinger so that the volume ramp is also done by
the insert effect if present when the track is paused (avoids clicks).
- Increased room level for all presets.

Also fixed problems with output stage session (-1):
- effect bundle wrapper was not designed to support session -1
- the permission check in audioflinger for using session -1 failed due to a wrong usage of
getCallingPid()

Change-Id: Id1ff51327263364bf71d3f2668fa5cde4311d84f
2010-09-13 09:08:28 -07:00
Eric Laurent
6874bd0bec am 937056c1: am 32ec1ad1: Merge "Fix problem in AudioEffect::command() status." into gingerbread
Merge commit '937056c1a7ce71e6881305a31f76e62a76685f24'

* commit '937056c1a7ce71e6881305a31f76e62a76685f24':
  Fix problem in AudioEffect::command() status.
2010-09-02 12:51:11 -07:00
Eric Laurent
e65280c552 Fix problem in AudioEffect::command() status.
The *pReplyData argument of the command() function was left unitialized by EffectHandle::command()
when command was EFFECT_CMD_ENABLE, EFFECT_CMD_DISABLE and EFFECT_CMD_SET_PARAM_COMMIT.

Change-Id: I91a19817ead2a8cfbdd8e2d77ca270c7ce9d5bd4
2010-09-02 11:56:55 -07:00
Eric Laurent
288db3b499 am 55e79374: am f560ceab: Merge "Audio Effects: fix problems in volume control." into gingerbread
Merge commit '55e7937462d107b469a58651d3d51e15086f8e9e'

* commit '55e7937462d107b469a58651d3d51e15086f8e9e':
  Audio Effects: fix problems in volume control.
2010-08-31 15:49:15 -07:00
Eric Laurent
a92ebfa1cd Audio Effects: fix problems in volume control.
- Fixed click when re-enabling effect during the turn off phase:
make sure the effect states where effect is processed are the same
where volume control is delegated to effect.
- Fixed click when effect is deleted while still active: do not apply
volume ramp if an effect having volume control was just removed from the
effect chain.

Also fixed a crash when PCM dump is enabled in effect bundle wrapper.

Change-Id: Ib562f5cf75c69af75df0e862536262e2514493e4
2010-08-31 15:26:23 -07:00
Eric Laurent
2ed7818129 am 44217848: am ae6bdc23: Merge "Fix issue 2952766." into gingerbread
Merge commit '4421784895a58bb7bcf90236a9e443b372b5b80e'

* commit '4421784895a58bb7bcf90236a9e443b372b5b80e':
  Fix issue 2952766.
2010-08-30 15:07:45 -07:00
Eric Laurent
b8453f4e0e Fix issue 2952766.
The problem is that the audio policy manager does not handle the input devices
when forced use for telephony is changed.
The problem does not appear in a call over PSTN becasue only teh output devices drives the
routing of in call audio to/from the base band.

The fix consists in modifying AudioPolicyManagerBase::setForceUse() to check for active inputs
and update the input device if needed.

Change-Id: I0d36d1f5eef1cce527929180c29b025439902f10
2010-08-27 17:10:36 -07:00
Eric Laurent
6b8daf480e am 3a899b85: am 0b9a12bf: Merge "Fix issue 2929440" into gingerbread
Merge commit '3a899b85102f6d51585b3d46ced3038c8602f202'

* commit '3a899b85102f6d51585b3d46ced3038c8602f202':
  Fix issue 2929440
2010-08-21 09:40:43 -07:00
Eric Laurent
8448a79767 Fix issue 2929440
Fixed regression introduced by change a54d7d3d7dd691334189aab20d23c65710092869 in audioflinger mixer thread:
When the output stream is suspended, the sleep time between two writes must match the actual duration
of one output stream buffer otherwise the playback rate is not respected.

Change-Id: Ic5bebe890290d1f44aeff9dd3c142d18e26fff2a
2010-08-19 08:15:08 -07:00
Eric Laurent
029a74a38b am f28608cd: am c8d0d630: Merge "Fix issue 2909189: System property ro.audio.silent no longer mutes system." into gingerbread
Merge commit 'f28608cdf4f6a0075d0811ccd32123baf4daec31'

* commit 'f28608cdf4f6a0075d0811ccd32123baf4daec31':
  Fix issue 2909189: System property ro.audio.silent no longer mutes system.
2010-08-13 17:23:53 -07:00
Eric Laurent
8cc93b9b21 Fix issue 2909189: System property ro.audio.silent no longer mutes system.
Fixed regression introduced by commit 2a6b80bc65c4782b5a7168b300e1dc5ec9f617ee:
master mute was not working if no effect chains were present on session 0.

Change-Id: I66d107e045d159cb94d29c7476fa1e12d92f2ae7
2010-08-11 05:20:11 -07:00
Eric Laurent
dbe57fcb49 am 1ece7d68: am 2a6b80bc: Fixed several audio effects problems.
Merge commit '1ece7d6873027068a3e7b055597045e9387b217c'

* commit '1ece7d6873027068a3e7b055597045e9387b217c':
  Fixed several audio effects problems.
2010-08-09 20:00:11 -07:00
Eric Laurent
2a6b80bc65 Fixed several audio effects problems.
- Fixed constant inversions in AudioEffect.java
- Do not return error when enabling an already enabled effect
- Update cached effect state in native AudioEffect class when effect is enabled/disabled by command() method
- Remove click when restarting effect during disable sequence
- Fixed problem in master mute management when volume control is delegated to effect.

Change-Id: I6df4ce9fcc54fdc7345df858f639d20d802d6712
2010-08-09 05:48:20 -07:00
Eric Laurent
efd58e5fd0 am ba676a00: am a54d7d3d: Fixed underrun in audioflinger mixer.
Merge commit 'ba676a00c1b9ba59b30fe805b83d03d1768fffbd'

* commit 'ba676a00c1b9ba59b30fe805b83d03d1768fffbd':
  Fixed underrun in audioflinger mixer.
2010-07-29 07:46:03 -07:00
Eric Laurent
a54d7d3d7d Fixed underrun in audioflinger mixer.
When all audio tracks have been disabled and the mixer is running idle before the output stream is placed in standby,
the mixer sometimes fails to write to the output stream on time to avoid underrun.

This is because the sleep period used to wait before the next write to output stream is too close to the actual buffer duration.
In fact this sleep time is not critical as if we write too early to the output stream, the kernel driver will wait for free buffers
from the audio DSP DMA and we will sleep anyways.

The fix consists in dividing the calculated wait period by 2 to increase the margin.

Change-Id: I5730887dc2ccce2a511bc858494a6f7da6b392a0
2010-07-29 06:50:24 -07:00
Eric Laurent
e199f1dddb am 45dc4f82: am 493941b8: Allow creation of an audio effect on a session with no audio tracks.
Merge commit '45dc4f82a00e52b12389b22a7cfbbee5609e8e28'

* commit '45dc4f82a00e52b12389b22a7cfbbee5609e8e28':
  Allow creation of an audio effect on a session with no audio tracks.
2010-07-29 05:22:10 -07:00
Eric Laurent
493941b8d8 Allow creation of an audio effect on a session with no audio tracks.
This is necessary to allow creating and enabling an effect attached to a particular player
session before the playback is started. As a matter of fact, the implementation of the mediaplayer
does not create the AudioTrack before playback starts.

Change-Id: I1266e8885f9d756acc949303321aaac0fbf83e34
2010-07-29 02:34:40 -07:00
Eric Laurent
ba2709583d am 6fa88882: am 62d83a0c: Merge "Audio effects: modified command() parameter types." into gingerbread
Merge commit '6fa8888254deb4961dc64c6ac03dc103c9cd8bcf'

* commit '6fa8888254deb4961dc64c6ac03dc103c9cd8bcf':
  Audio effects: modified command() parameter types.
2010-07-28 07:53:24 -07:00
Eric Laurent
a4c72acfbc Audio effects: modified command() parameter types.
The type of the cmd, cmdSize and *pReplySize parameters of the effect control interface command()
function have been modified from int to uint32_t. This is more consistent with their role.

Change-Id: I84d289fc262d6753747910f06f485597dfee6591
2010-07-28 05:49:21 -07:00
Eric Laurent
240677ec68 resolved conflicts for merge of dd206093 to master
Change-Id: I21dd2321a4839d034d49092baccbf40986f17dae
2010-07-20 13:37:19 -07:00
Eric Laurent
8ed6ed0b62 Audio policy manager changes for audio effects
Added methods for audio effects management by audio policy manager.
- control of total CPU load and memory used by effect engines
- selection of output stream for global effects
- added audio session id in parameter list for startOutput() and stopOutput().
this is not used in default audio policy manager implementation.

Modifications of audio effect framework in AudioFlinger to allow moving and reconfiguring
effect engines from one output mixer thread to another when audio tracks in the same session
are moved or when requested by audio policy manager.
Also fixed mutex deadlock problem with effect chains locks.

Change-Id: Ida43484b06e9b890d6b9e53c13958d042720ebdb
2010-07-20 10:31:57 -07:00
Eric Laurent
1dfc722c46 am 3c6ea955: am 7203272f: Merge "Fixed problems in audio effect volume control." into gingerbread
Merge commit '3c6ea95553d3a0e416874c583a41efff3f6fbc57'

* commit '3c6ea95553d3a0e416874c583a41efff3f6fbc57':
  Fixed problems in audio effect volume control.
2010-07-19 10:23:00 -07:00
Eric Laurent
0d7e048cf2 Fixed problems in audio effect volume control.
Fixed the following problems in audio effect volume control in AudioFlinger:
- Make sure that the volumes returned by EffectChain::setVolume_l() are correct even is
no change is detected since last call
- Do not use isEnabled() to validate volume control but mState >= ACTIVE instead as the volume control
must be also active in STOPPING and STOPPED states.

Change-Id: Id62da3164fad500ee8a5efd6cd78c77e8fdcb541
2010-07-19 06:31:30 -07:00
Eric Laurent
2469e40924 am f16b3f10: am b0374a0e: Merge "Several improvements in audio effects volume control." into gingerbread
Merge commit 'f16b3f104f60738447db60bcf2c44c7610e17199'

* commit 'f16b3f104f60738447db60bcf2c44c7610e17199':
  Several improvements in audio effects volume control.
2010-07-16 09:12:40 -07:00
Eric Laurent
76c40f74ce Several improvements in audio effects volume control.
- Fixed crash when deleting an effect chained before an effect having volume control
- Changed EFFECT_FLAG_VOLUME_CTRL to implicitely include EFFECT_FLAG_VOLUME_IND
(not need to set both in effect descriptor).
- Volume control changes from one effect to another if needed according to effect enable state
- EFFECT_CMD_SET_VOLUME is only sent when their is an actual change in volume

Change-Id: Ieebaf09157e2627366023569d95516646e03e26c
2010-07-15 12:50:15 -07:00
Mathias Agopian
53459436ed am c74034b6: am 24651682: added BinderService<> template to help creating native binder services
Merge commit 'c74034b6bf0940dc80c4d4efa1e677ad0d2dfd6c'

* commit 'c74034b6bf0940dc80c4d4efa1e677ad0d2dfd6c':
  added BinderService<> template to help creating native binder services
2010-07-14 20:18:50 -07:00
Mathias Agopian
0779682a49 am 78983a91: am 4055b780: Merge "move native services under services/" into gingerbread
Merge commit '78983a9133d3dd3f08b1ec462a7e2f9e7bfa9e2f'

* commit '78983a9133d3dd3f08b1ec462a7e2f9e7bfa9e2f':
  move native services under services/
2010-07-14 18:48:58 -07:00
Mathias Agopian
24651682ed added BinderService<> template to help creating native binder services
Change-Id: Id980899d2647b56479f8a27c89eaa949f9209dfe
2010-07-14 18:43:19 -07: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