summaryrefslogtreecommitdiffstats
path: root/modules/usbaudio
diff options
context:
space:
mode:
authorPaul McLean <pmclean@google.com>2014-08-25 08:04:02 -0700
committerPaul McLean <pmclean@google.com>2014-08-28 09:16:39 -0700
commitc48cdc8ec0a07bca5e387041d58e9926c8b7c3de (patch)
tree74ed2f542f831e29c17551cf87b1c77d133cfac1 /modules/usbaudio
parent6edd4d605f1c4a5b53d18382ff01c24225e94b01 (diff)
downloadhardware_libhardware-c48cdc8ec0a07bca5e387041d58e9926c8b7c3de.zip
hardware_libhardware-c48cdc8ec0a07bca5e387041d58e9926c8b7c3de.tar.gz
hardware_libhardware-c48cdc8ec0a07bca5e387041d58e9926c8b7c3de.tar.bz2
Fixing non-playback on USB devices with support for MONO playback.
Bug 17136854 Change-Id: Ia0136fa8f9b4789d538b2dccb3f6071ae5062010
Diffstat (limited to 'modules/usbaudio')
-rw-r--r--modules/usbaudio/alsa_device_profile.c19
-rw-r--r--modules/usbaudio/audio_hw.c1
2 files changed, 14 insertions, 6 deletions
diff --git a/modules/usbaudio/alsa_device_profile.c b/modules/usbaudio/alsa_device_profile.c
index f214eab..9deedce 100644
--- a/modules/usbaudio/alsa_device_profile.c
+++ b/modules/usbaudio/alsa_device_profile.c
@@ -267,19 +267,28 @@ static unsigned profile_enum_sample_formats(alsa_device_profile* profile, struct
static unsigned profile_enum_channel_counts(alsa_device_profile* profile, unsigned min, unsigned max)
{
- static const unsigned std_channel_counts[] = {8, 4, 2, 1};
+ // TODO: Don't return MONO even if the device supports it. This causes problems
+ // in AudioPolicyManager. Revisit.
+ static const unsigned std_out_channel_counts[] = {8, 4, 2/*, 1*/};
+ static const unsigned std_in_channel_counts[] = {8, 4, 2, 1};
+
+ unsigned * channel_counts =
+ profile->direction == PCM_OUT ? std_out_channel_counts : std_in_channel_counts;
+ unsigned num_channel_counts =
+ profile->direction == PCM_OUT
+ ? ARRAY_SIZE(std_out_channel_counts) : ARRAY_SIZE(std_in_channel_counts);
unsigned num_counts = 0;
unsigned index;
/* TODO write a profile_test_channel_count() */
/* Ensure there is at least one invalid channel count to terminate the channel counts array */
- for (index = 0; index < ARRAY_SIZE(std_channel_counts) &&
+ for (index = 0; index < num_channel_counts &&
num_counts < ARRAY_SIZE(profile->channel_counts) - 1;
index++) {
/* TODO Do we want a channel counts test? */
- if (std_channel_counts[index] >= min && std_channel_counts[index] <= max /* &&
- profile_test_channel_count(profile, std_channel_counts[index])*/) {
- profile->channel_counts[num_counts++] = std_channel_counts[index];
+ if (channel_counts[index] >= min && channel_counts[index] <= max /* &&
+ profile_test_channel_count(profile, channel_counts[index])*/) {
+ profile->channel_counts[num_counts++] = channel_counts[index];
}
}
diff --git a/modules/usbaudio/audio_hw.c b/modules/usbaudio/audio_hw.c
index 7e65ab5..4310855 100644
--- a/modules/usbaudio/audio_hw.c
+++ b/modules/usbaudio/audio_hw.c
@@ -271,7 +271,6 @@ static audio_format_t out_get_format(const struct audio_stream *stream)
*/
alsa_device_proxy * proxy = &((struct stream_out*)stream)->proxy;
audio_format_t format = audio_format_from_pcm_format(proxy_get_format(proxy));
- ALOGV("out_get_format() = %d", format);
return format;
}