Commit graph

47 commits

Author SHA1 Message Date
Paul McLean
9ab869acfd Technical Debt Paydown - move/rename files
Moved audio (alsa actually) utils files to system/core/alsa_utils.
Renamed "audio" utilities to "alsa" to better relect their purpose.
Renamed audio_hw.c -> to audio_hal. c to better reflect its purpose.

Change-Id: I67c7d47ee02abafd3e12c4c99d605a62e0f59122
2015-01-13 09:37:06 -08:00
Eric Laurent
5b16836d67 am e6499429: Merge commit \'83b47a68\' into manualmerge
* commit 'e64994292cb02fae66f04002e1121d29979503d1':
  usb audio: Fix incorrect bytes returned for recording
2015-01-10 01:13:38 +00:00
Eric Laurent
e64994292c Merge commit '83b47a68' into manualmerge 2015-01-09 17:04:40 -08:00
Paul McLean
31844086a6 Merge "Multi-USB device support & read device on open." 2015-01-09 23:11:44 +00:00
Pavan Chikkala
83b47a6891 usb audio: Fix incorrect bytes returned for recording
In a recording session , the number of bytes read is
not updated when pcm_read() fails. This results in
silence/invalid data being added during a device switch
from USB headset to handset.
Fix is to reset the number of bytes read if pcm_read()
returns an error indicating removal of USB headset.

Bug: 18611518

Change-Id: I10d578c3cf1037c90a891e63be2bd1c2b7e6126b
2015-01-09 14:14:41 -08:00
Eric Laurent
c654dc6c1f am 7e9abab1: am b338957d: Merge "usbaudio: Return 0 bytes on failure in capture"
* commit '7e9abab1940091b4c4d7589160855870fdda437e':
  usbaudio: Return 0 bytes on failure in capture
2015-01-09 18:04:14 +00:00
Eric Laurent
7e9abab194 am b338957d: Merge "usbaudio: Return 0 bytes on failure in capture"
* commit 'b338957d02528e5b51a15c5ce21e96fad4ff4a6f':
  usbaudio: Return 0 bytes on failure in capture
2015-01-09 17:58:33 +00:00
Viswanath L
8c7e1114a3 usbaudio: Return 0 bytes on failure in capture
Return 0 bytes from in_read() in failure conditions so that invalid
data is not recorded.

Change-Id: I9a6294e4162fa642fd7e160a32d1ad16f255ff62
2015-01-09 22:38:54 +05:30
Paul McLean
0f1753ead0 Multi-USB device support & read device on open.
Change-Id: I8b6dd33be1915db764eeaefec5a5da1e9d02dc87
2015-01-08 08:44:15 -08:00
Eric Laurent
077c704c7d am 68be24b1: am ce0bbb97: Merge "fix: memory leak"
* commit '68be24b1cc2bad01d9257f76faabd92dbfc6c3e8':
  fix: memory leak
2014-12-18 23:21:51 +00:00
Eric Laurent
68be24b1cc am ce0bbb97: Merge "fix: memory leak"
* commit 'ce0bbb97c12b712b75d0df42ce2f6e3f35d8db72':
  fix: memory leak
2014-12-18 21:50:36 +00:00
soon1.choi
781bb3f72e DO NOT MERGE - fix: memory leak
free momory for str_parms to prevent memory leak.

cherry-pcik from aosp c357157e28

Bug: 18798194.

Change-Id: I7df5567d665554dbd4646c881f0f48b0c568c5fe
2014-12-18 09:55:05 -08:00
soon1.choi
c357157e28 fix: memory leak
free momory for str_parms to prevent memory leak.

Change-Id: I7df5567d665554dbd4646c881f0f48b0c568c5fe
2014-12-18 16:03:43 +09:00
Paul McLean
271444af38 Renaming generic-sounding filenames to indicate "audio".
Change-Id: Iba6403a3493379c39d22d23b438f028efc2e15b7
2014-12-15 18:18:52 +00:00
Paul McLean
2cfd81bae0 Support MONO and STERO USB inputs. Allow "dynamic" flag in audio_policy.conf.
Bug 17526569

Change-Id: I64b00fd338eb937303b41608728a18341ee78820
2014-09-17 08:38:57 -07:00
Eric Laurent
253def9fa0 usb audio: implement microphone mute.
Bug: 17321604.
Change-Id: I8e3daf2636dfd5f85d990c0093c52c908064afac
2014-09-14 12:32:28 -07:00
Paul McLean
2c6196f20c Fix problem with dropouts with multiple USB audio streams.
Bug 17136569

Change-Id: I94bdbe037533a3fd77f249fdd42f4d828d3bf87f
2014-08-28 07:59:03 -07:00
Paul McLean
93d4e0db0e Fix problem with reloading config of new capture devices
with same card/device numbers.

Bug: 17012657
Change-Id: I7cb50aedc538d8c648e7f66c8e153cf47ce12577
2014-08-13 23:08:41 +00:00
Paul McLean
af5187efbd Fix problem with reloading config of new devices with same card/device numbers.
Bug 16981885

Change-Id: I65c6c418ee0d0f42c87379b614f64302d27f8e77
2014-08-12 13:57:10 -07:00
Eric Laurent
05333d458d usb audio: fix set_parameters read/write concurrency
Do not read the ALSA PCM device configuration when playback
or capture is active.
Do not force ALSA profile update if card and device passed
to out/in_set_parameters() do not change.
Hold the main HAL lock when closing or opening the
ALSA PCM device.

Bug: 15520724.

Change-Id: I2b6087ed46ce7433de0b6dd8b24ec10de2e55d21
2014-08-06 14:18:26 -07:00
Andy Hung
b52eff359f Merge "Add multichannel USB handshaking with AudioFlinger" into lmp-dev 2014-07-28 22:45:16 +00:00
Andy Hung
03576bed81 Add multichannel USB handshaking with AudioFlinger
The number of channels can be "forced" using k_force_channels.
If the channel count proposed by AudioFlinger is not permitted
by the device, it is emulated.

Change-Id: Ib20e680c8f95adb84616a4fe52977f659cf4d6ca
2014-07-28 17:37:46 -07:00
Eric Laurent
f5e2469c02 audio HAL: add parameters to open stream
Pass device address (and audio source for inputs) to
open_output_stream() and open_input_stream() audio HAL functions.

Bug: 14815883.
Change-Id: I5535677db3f3027917a31a7ed5c0a4c6bc013639
2014-07-28 11:38:40 -07:00
Paul McLean
c88e6ae584 Refactor USB HAL (audio_hw.c)
Refactoring alsa device attributes to alsa_device_profile.h/.c
Refactoring alsa device state to alsa_device_proxy.h/.c
Refactoring format functions into format.h/.c
Refactoring logging functions into logging.h/.c
Sundry (and extensive) code cleanup
Reworked locking on out_write() and in_read() to allow
  simultaneous input/output

Bug: 15986827, 15856702, 12833166

Change-Id: I82c8d0ef252b2f95ee23f263dc175f4c883bfd64
2014-07-25 12:48:51 -07:00
Paul McLean
845e78993b Merge "Move channel expansion/contraction functions to audio_utils/channels.h/.c" into lmp-dev 2014-07-17 21:15:46 +00:00
Paul McLean
c2201159bb Move channel expansion/contraction functions to audio_utils/channels.h/.c
Change-Id: I967a062f6c1cb5ae6acb6e92f4f3df00a0336733
2014-07-16 15:29:31 -07:00
Glenn Kasten
7d973adff4 Add audio_input_flags_t to HAL open_input_stream
Change-Id: I3519bfa45809e064d19473ebe6489c5249d306a8
2014-07-16 12:29:35 -07:00
Paul McLean
a02bc9d4c3 Marking invalid PCM formats with PCM_FORMAT_INVALID, shrinking format table.
Change-Id: I57da4ed85fe128e88e63c03be4fe836f8de76ac8
2014-07-16 09:30:03 -07:00
Paul McLean
eb192973f3 Support for 32-bit data conversions.
Change-Id: I18d955d9b2df99744ae6211bdb924c679ea7a617
2014-07-15 17:11:47 -07:00
Eric Laurent
13082efc62 Revert "Added enumeration of legitimate sample rates for input and output."
This reverts commit 0a4f9f6662aad6b97a1877030d5efbcfbd94c03c.

Change-Id: I6e7125aecf2ff2e89a4c9206dc669d8e792a6300
2014-07-15 23:15:05 +00:00
Paul McLean
497abe3d99 Added enumeration of legitimate sample rates for input and output.
Change-Id: Ib53ec5254bd47761dbce84646a841eb9b32fd62a
2014-07-15 22:20:04 +00:00
Paul McLean
f62d75ebc6 Added enumeration of legitimate sample rates for input and output.
Added device_profile to enable refactoring of query methods.
Refactored query methods (in_get_parameters/out_getParameters)
  in terms of device_get_parameters.
Freeing ALSA parameter structures (pcm_params_free)

Eliminated unnecessay input & output card/device (to support
 other changes).

Change-Id: I771cf4681a628f87ca6d6ee3f85f76ae4d7f1504
2014-07-14 15:18:56 -07:00
Paul McLean
99e35eba21 Merge "Multi-format USB audio input" 2014-07-02 18:22:50 +00:00
Paul McLean
6b1c0fef80 Multi-format USB audio input
Change-Id: I716a9f79dcfea35eacd0aeeda530e3e3c7eb4d32
2014-07-07 09:37:42 -07:00
Eric Laurent
c5ae6a0304 audio: different frame size calculation for input and output
Bug: 15000850.
Change-Id: I7813e99a0b7ce613cc3b7d7c95be0525cb2d6c81
2014-07-03 16:51:09 -07:00
Paul McLean
e32cbc1fdd Multi-format USB Audio suport
Change-Id: I2815e1dc38d39a3d88fb0affd52b1b9f50a73b92
2014-06-30 10:48:06 -07:00
Eric Laurent
fbc02dc16e usb audio: fix capture channel conversion
Change-Id: Ibdff053bd6ecc4bf2bc8bb51384098911f52f6ef
2014-06-27 18:39:21 -07:00
Paul McLean
33a6b171ba Implement minimal buffer size for playback
This will enable low-latency playback in mixer/audioflinger.

Change-Id: I415aa1b92e3c6f945a48be7b626527f0b02a82d7
2014-06-20 10:55:11 -07:00
Eric Laurent
7661a48402 usb audio: fix usb capture configuration
Capture configuration was using cached_output_hardware_config
instead of cached_input_hardware_config.

Also enable mono capture by rejecting first attempt to open
an input stream in mono with -EINVAL error: AudioFlinger will reopen in
stereo and do the channel conversion.

Change-Id: Ibdf53be4aa88d47091745bc71daa1dec002535f8
2014-06-11 12:00:16 -07:00
Mark Salyzyn
88e458ae61 USB HAL: 64-bit compile issues
- size_t/ssize_t issues
- const warnings
- printf format (unsigned/signed and non-integer types)

Change-Id: I36d6b0d86e832b46eb0da076e99bf1f25bd697ff
2014-04-28 16:47:58 -07:00
Paul McLean
cf61191774 Added support for 1-channel capture sources (like a microphone)
Change-Id: Ie38b41ed8a63bf1b813379361665c883f08cbaae
2014-04-28 14:59:02 -07:00
Paul McLean
30f4185da7 USB HAL Capture Implementation
Change-Id: Ic04f7e1b33b423e5169667700145b9cbdd9704a6
2014-04-24 15:47:24 -07:00
Paul McLean
eedc92ea4d Initial implementation of usb audio I/O
Change-Id: Ib82783f0b25887e2d34a24fde346cee5003d5b89
2014-03-31 16:30:16 -07:00
Amit Shekhar
f9953b7d52 usbaudio: fix for out->dev->lock remains locked in error case
out->dev->lock remains locked in error case in out_write()
Added pthread_mutex_unlock() in the error case

Bug: 12824374
Change-Id: Ibbbd5ced1f9d469cfba3b33a94414d0b94affa8f
Signed-off-by: Glenn Kasten <gkasten@google.com>
2014-01-30 16:23:21 -08:00
Eric Laurent
85e08e2625 audio: new audio devices enums
Changed audio device API version to 2.0 because of
new enums for audio input and output devices.

Removed implementations of get_supported_devices() in
stub and usb audio modules.

Change-Id: I09345d38929d931e5015e36d18259f5a5f950298
2012-09-07 10:32:57 -07:00
Mike Lockwood
46a9809e9c Update USB audio HAL to use API
Also don't clear card and device when out_set_parameters is called
to set other parameters.

Change-Id: I4feda9f6a2e76cb45bbc8a8f8256bb1760302707
Signed-off-by: Mike Lockwood <lockwood@google.com>
2012-04-24 16:46:24 -07:00
Simon Wilson
19957a37a0 usbaudio: add initial usbaudio default HAL
Change-Id: I6e93b2512883f3697683a74cadb9a29113966bc0
2012-04-12 22:48:10 -07:00