Commit graph

108 commits

Author SHA1 Message Date
Paul McLean
fd61179b64 Update policy handling for USB inputs
Change-Id: Ib2e531f115f8bd1d5f290094032f3f4a4753e726
2014-04-25 17:00:48 +00:00
Colin Cross
b10621c1f1 resolved conflicts for merge of 75402fdb to master
Change-Id: Ie85a3c7d498d7685738190267916e9a205cc469e
2014-04-24 08:39:41 -07:00
Colin Cross
c7b6e3c857 audio: allow compiling for 64-bit
Fix a few 64-bit warnings and set -Wno-unused-parameter, which makes
the directory warnings-clean on 32-bit and 64-bit.
Remove LOCAL_32_BIT_ONLY.

Change-Id: I688b31683f1a6598419866d9b7b6bc27a7056f4a
2014-04-18 15:48:06 -07:00
Paul McLean
c26f454f8d Initial implementation of USB Audio output.
Change-Id: I4e2517233487ca7487ed7948a974fc2cc6c41190
2014-03-28 10:34:25 -07:00
Glenn Kasten
dcc6e9f299 am e6c7127e: am be39c1e4: Merge "audio policy : add AUDIO_DEVICE_IN_USB_DEVICE to sDeviceNameToEnumTable"
* commit 'e6c7127ef2491ddeb995ffb48843fda4e30ff9ff':
  audio policy : add AUDIO_DEVICE_IN_USB_DEVICE to sDeviceNameToEnumTable
2014-03-17 15:56:18 +00:00
Peter Yoon
26101ada7b audio policy : add AUDIO_DEVICE_IN_USB_DEVICE to sDeviceNameToEnumTable
This commit adds AUDIO_DEVICE_IN_USB_DEVICE to sDeviceNameToEnumTable[],
It had to be added here, when it was defined in system/core/include/system/audio.h

AudioPolicyManagerBase::loadHwModule() fails to parse device type of
AUDIO_DEVICE_IN_USB_DEVICE in audio_policy.conf.
By applying this commit, AUDIO_DEVICE_IN_USB_DEVICE can be used for
audio policy customization.

Change-Id: I0165956334d7105129dca4c746372dbca0d9e324
2014-03-17 13:10:04 +00:00
Glenn Kasten
9df8ecc68b Add more PCM formats to audio_policy.conf parser
In particular, we need AUDIO_FORMAT_PCM_24_BIT_PACKED.

Change-Id: I28abe8466024bdd4d1edbb4281c6472d45a2d94f
2014-03-07 10:21:40 -08:00
Glenn Kasten
316222fcd6 Rename setStreamOutput to invalidateStream
And simplify by removing the unused I/O handle parameter 'output'.

Change-Id: Ie9c4df17a7378066312d4ed8790fda7a9125c95e
2014-02-28 11:54:03 -08:00
Patrick Tjin
4387d30660 audio_policy: clean up dumpsys
Remove NUL characters from audio_policy's dump output

Change-Id: If591473dbe3e5adbc34dbbdb0d552b329f19eb6a
2014-02-06 09:11:50 -08:00
Eric Laurent
9f4165f36d audio policy: send config params when opening output
When a new output stream is opened upon device connection,
always send mandatory configuration parameters
(A2DP device address, ALSA card and device number etc...)
immediately after opening the output.

Change-Id: Id1fc1d99d3b30e2ef907dcb231a6a9e70560ecae
2014-01-08 09:34:38 -08:00
Glenn Kasten
2d749b0bda Continued cleanup of audio policy's use of audio_format_t
Change-Id: I6ef6ec50cd5e0e751dc5063af1f7d8882588a89b
2013-12-20 15:37:53 -08:00
Glenn Kasten
2c3d2379ee Use audio_channel_mask_t in AudioPolicy
Also:
 - use %x format for logging channel masks
 - use AUDIO_CHANNEL_IN_* constants from system/audio.h instead of AudioSystemLegacy.h symbols
 - remove redundant casts
 - use "channelMask" instead of "channels" to avoid possible confusion with channel counts

Change-Id: If05d6b1cae5cf1b560cd53a93ae9e592b719ec9e
2013-12-16 14:10:22 -08:00
Glenn Kasten
5082dbeb19 Use audio_format_t in AudioPolicy
Also remove unnecessary default parameters

Change-Id: I553c01a98b8c2a3f3fd2ac98724aded3ad3c3022
2013-12-10 10:06:28 -08:00
Glenn Kasten
6742b02106 Fix typos in logs
Change-Id: Ie2e49d108a4dd33725296c96aaf9458585b81d32
2013-11-22 09:09:58 -08:00
Jean-Michel Trivi
18fc094c0e Define and use DRC-specific volume curves when applicable
Add support for property defining whether a DRC on the speaker path
 is enabled and will boost soft sounds.
Define new volume curves with more attenuations than existing ones
 to compensate for DRC-induced boost on sonification sounds to
 provide a more "linear" control to the user over the applied volume.

Bug 11600699

Change-Id: If23dd097a8b9b5ebb61e75dd8512ff75e63ba899
2013-11-14 16:36:43 -08:00
Eric Laurent
000bb51ca5 audio policy: fix gapless playback when effects enabled
Do not allow offloading if one non offloadable effect is enabled. This prevents from
creating an offloaded track and tearing it down immediately after start when audioflinger
detects there is an active non offloadable effect.
Not doing so breaks gapless playback because AwesomePlayer will always be able to open
an offloaded track which will not be compatible with the previous PCM track and
Audiosink::open() will not recycle it.

Bug: 11181933.
Change-Id: I6d163806849d9093b9ec701ba8e8c1ccb658e3c8
2013-10-14 11:15:39 -07:00
Eric Laurent
b40b96a785 audio policy: fix direct output selection
commit a527ffd broke the selection of an available
direct output profile in getProfileForDirectOutput().
getProfileForDirectOutput() should check for direct output profiles
regardless of the flags provided to getOutput().

Bug: 11051912.
Change-Id: I4a84734331bfed03d6024ea1c2e8776c27d0b28f
2013-10-07 10:10:44 -07:00
Eric Laurent
87e28f7b35 audio policy: fix DTMF tones volume while in call
When voice call stream volume is at 0, DTMF are not heard at all.
DTMF volume should follow the behavior of voice call volume which
is never completely muted.

Bug: 10932676.
Change-Id: Iaf0e33284be75b00516a837907e66be3123e5331
2013-10-03 18:02:16 -07:00
Eric Laurent
727fef1b1a remove audio HAL warning when inserting a headset
A valid offload info structure must be provided when
opening an offload output stream in checkOutputsForDevice()
upon headset insertion.

Bug: 8174034.
Change-Id: Id800a206536e5ce979febf89747a51db581c53b6
2013-09-30 19:20:15 -07:00
Eric Laurent
45c763947b audio policy: add support for audio effect offload
Add rules to select the appropriate output for global
effects.
Move global effects if needed when an offloaded output is
created or released.

Bug: 8174034.

Change-Id: I0bbd8e9f8aa717f672462dd74ba0d01eaef1fda7
2013-09-17 11:27:45 -07:00
Eric Laurent
fc9b2457ce AudioPolicyManageBase changes to enable HOTWORD audio source
- This change enables HOTWORD audio source to be preempted by any other
  audio source

Bug: 10640877.

Change-Id:  I6f7acbe95a6521306db70ad73260d2ba7b38b940
2013-09-09 15:43:35 -07:00
Eric Laurent
4e57a1d497 audio policy: remove verbose logging.
Change-Id: I268935bd8f7e58f90c698c098686a04681b43887
2013-08-30 15:47:52 -07:00
Eric Laurent
41b150b659 audio policy: disable audio offloading with video
Do not enable offloading of audio decompression when
playing video.

Change-Id: I6ee8b59370219f5ef810a99a27ba4a1cf222b55b
2013-08-30 15:36:55 -07:00
Chong Zhang
fe97ee4b99 audio policy: allow virtual input even if there are active inputs
Bug: 10460751

Change-Id: Ic6fcd14162e9c6e03366d887063321e21fcf14cd
2013-08-24 16:45:36 -07:00
Jeff Brown
b96b2839f4 Automatically enable/disable remote submix when input started.
When recording from the audio submix begins, enable the remote
audio submit output device.  When it ends, disable it.

Bug: 10265163
Change-Id: Ia0dc2e20623bb834d06561469ce856688991243b
2013-08-19 15:47:33 -07:00
Richard Fitzgerald
a527ffd3c2 Code changes for audio offload support
- Share existing offload output if compatible instead of
  creating a new one. Hardware has limited number of
  offload channels (possible only 1) so we must use as
  few as possible

- Changes to routing handling for offloaded outputs

Change-Id: I11111d8f504828595bd8dbf66444cbd1202e7192
Signed-off-by: Eric Laurent <elaurent@google.com>
2013-07-24 18:39:05 -07:00
Eric Laurent
ae57fbe12a am 8e7e4254: am e92d6238: audio policy: apply default device volume
* commit '8e7e42547116b1d5f49118ba41946b2906ad3936':
  audio policy: apply default device volume
2013-07-15 17:26:21 -07:00
Eric Laurent
e92d623811 audio policy: apply default device volume
Make sure that we apply default device volume to
active outputs in case no specific volume for selected
device is received afterward.

Bug: 9760269.
Change-Id: I216de40396e1075e77493c97e8b192cd3a31d546
2013-07-15 15:41:08 -07:00
Richard Fitzgerald
b4d07b97d2 Add audio policy API changes for audio offload
Changes to the API of audio policy for audio offload support:
- Add isOffloadSupported() function
- Add OUTPUT_FLAG_OFFLOAD
- Extend AudioOutputDescriptor to include a sharing count for direct outputs
- Pass audio_offload_info_t when opening output streams

Change-Id: I5ad26418fdb286eb7ae299d586dd1fd525d48ab9
Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Eric Laurent <elaurent@google.com>
2013-06-27 17:16:25 -07:00
Eric Laurent
6670743515 audio policy: fix device selection in startInput()
Check again input device selection when capture starts in case
conditions have changed since the input stream was opened.

This is related to but does not fix issue 8761558. It makes the
selection of BT SCO device consistent.

Bug: 8761558
Change-Id: I386b638e9c3238711e16fb848449af561624359e
2013-05-17 14:11:27 -07:00
Eric Laurent
5a950c960c audio policy: reuse direct output when possible
Modified getOutput() logic to not systematically
open a new direct output when a profile matches a request.
This causes a problem when transitioning between two
multichannel tracks as the audio HAL will most of the times
only support one direct output stream open at a time.

Instead, reuse an open output if all the parameters match
or force close the output before reopening it.

Also modify releaseOuput():
- close a direct output only if no client is using it anymore
- call closeOutput() instead of removing the output from
the open output list: this factors in code executed when closing an
output stream.

Bug 8388941

Change-Id: Ic3d3beb21063622ddf57a5b932f93d56f2986f54
2013-04-04 14:18:40 -07:00
Eric Laurent
80f5b0400f audio policy: fix music glitch when starting call
When answering a call in silent mode, music playing over A2DP
was not immediately muted by current audio policy manager logic.

The fix consists in muting media strategy on all output streams
immediately when entering in call.

Also add methods to AudioOutputDescriptor to report
recent global, per strategy and per stream activity.

Bug 8315512

Change-Id: I4a90eb05db50e4f22374d02b1e647e8662f6bec6
2013-03-25 16:58:39 -07:00
Eric Laurent
9641bd36db audio policy: fix in call capture device
Allow use of default capture device when
AUDIO_SOURCE_VOICE_UPLINK is specified and the platform
does not support AUDIO_DEVICE_IN_VOICE_CALL.

Change-Id: Ibbc314f60c91e5a0fa75d57878f2d2a96ef2d83b
2013-03-05 16:53:53 +00:00
Eric Laurent
f32e38e24d audio policy: fix music glitch with touch sounds
There is a brief music interruption when a touch sound
is played the first time after the headset insertion.

This is due to a bug in audio policy manager logic to prevent
volume bursts while changing device while music is playing.

The fix consists in muting music only on current output stream
when changing device, not all output streams.

Also prevent unecessary device change if the requested device
is not supported by the output stream profile.

Bug: 8301565
Change-Id: I00daab19bbdda10ca856a05fa32a1e333e1b9469
2013-03-04 17:56:02 -08:00
Eric Laurent
bb0e0da128 Merge "audio policy: fix in call audio setup delay" 2013-02-11 21:42:48 +00:00
Eric Laurent
8bf56b16e5 audio policy: fix in call audio setup delay
There is a delay inserted by audio policy manager before switching
device when entering in call mode to allow music playback to be muted
before the device actually switches.

This delay can be significant when high latency outputs (e.g. deep buffers) are
present and should not be applied if the output is not active.

Issue 7612431.

Change-Id: I04b666769033dbfdc861752b030d3f7bdffe9435
2013-02-11 12:48:20 -08:00
Jean-Michel Trivi
dc3bf1a374 Identify remote stream activity, used for notification routing
Add support for checking remote stream activity.

Don't route notifications like media when media active remotely.

Add remote stream activity query in audio policy HAL.

Bug 7485803

Change-Id: Ifb722c7f9ffbfbdc877fec5156bcfc09bec40651
2013-02-11 10:23:13 -08:00
Eric Laurent
60758e27a4 audio policy: added front + back mic
Added definition to parse front + back mic from input descriptors
in audio_policy.conf file.

Change-Id: I9ebdeac664e12104589a52d15acbbfc4db787923
2013-01-22 17:07:33 -08:00
Eric Laurent
911408bc76 Merge "audio policy: fix notification start delay" 2012-11-08 09:43:16 -08:00
Jason Simmons
02580d804a am c8bc2286: am 7aab5b0f: Merge "Close a newly opened direct output if its parameters are invalid" into jb-mr1-aah-dev
* commit 'c8bc22869096ee413717102d3f5d0ca804cc3174':
  Close a newly opened direct output if its parameters are invalid
2012-11-08 06:18:52 -08:00
Eric Laurent
42fa8215a7 audio policy: fix notification start delay
The mechanism delaying notifications in case of
muliple active outputs with long latencies must
take into account recently paused audio tracks.

Bug 7400428.

Change-Id: I4ac9dfac81336e33f475b4f28df82713707d0c46
2012-11-07 13:48:47 -08:00
Jason Simmons
10705c404c Close a newly opened direct output if its parameters are invalid
Change-Id: I27ac015217480a854d25273ab9498949971b411a
2012-10-31 10:50:12 -07:00
Eric Laurent
2c72e9faa5 audio policy: fix volume change when disabling SCO
commit 76e97d39 introduced a regression by having setDeviceConnectionState()
force a device change on duplicated outputs even if the selected device is 0.
This also forces a device 0 for the two outputs it is duplicated to,
which may override a valid device selection on those outputs and apply
default volumes.

Bug 7429869.

Change-Id: I37dd66343c54eb27e420089edbda04444fa1e2c6
2012-10-30 16:14:04 -07:00
John Grossman
5debe92591 Fix a parse error in checkOutputForDevice
Fix a small parsing error in parsing the supported formats and sample
rates of a stream out with dynamic values for these parameters.  The
channel mask parser was properly skipping the "=" in the setting
string, but formats and sample rates were not (cauing the first
reported format and sample rate to end up being skipped)

Change-Id: Id227a44f6b5fc0c223f2ce74f94ebb6abc5fa77d
Signed-off-by: John Grossman <johngro@google.com>
2012-10-29 18:54:12 -07:00
Eric Laurent
5a484b753c audio policy: active analog dock force usage
Qualify the selection of the analog dock for media by the force use.

Bug 7302106.

Change-Id: I2ea48fd43866ce8491085bba72a27751b2203401
2012-10-26 18:04:03 -07:00
Eric Laurent
89ef58f4c0 Merge "audio policy: fix scanning of supported devices" into jb-mr1-dev 2012-10-18 11:38:54 -07:00
Eric Laurent
672e9ace42 Merge "audio policy: tune voice/video chat volumes" into jb-mr1-dev 2012-10-18 10:54:45 -07:00
Eric Laurent
fd8cecbee6 audio policy: fix scanning of supported devices
Fix is a bug in checkOutputsForDevice() which makes that we can
try to reopen an output stream after a new device is connected because
we believe that no opened output is available for this device.

Bug 7369475.

Change-Id: I2290a9b5ba102657cda495fbb8a995e0003b883a
2012-10-17 17:49:41 -07:00
Eric Laurent
0d6490a58b audio policy: tune voice/video chat volumes
Add new volume curves for VOICE_CALL stream type
to improve voice/video chat volume on speakers.

Bug 7346643.

Change-Id: Ib282a97570d2234deec6b58391bdfc45846d9cc0
2012-10-17 10:22:29 -07:00
SathishKumar Mani
772686310a audio policy: update output delayMs in setPhoneState
- Issue: When call is connected in HDMI while playing music,
  Playback is routed to phone shortly
- Cause: delayMs is not updated correctly, and no delay is
  set when setOutputDevice is called
- Fix: update delayMs with biggest mOutput latency and mute
  STRATEGY_MEDIA on all outputs

Bug: 7268860
Change-Id: I12b75443a29ab8485314bd0cbfe5ee4789be5c29
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-10-17 10:20:37 -07:00