diff options
author | Glenn Kasten <gkasten@google.com> | 2013-10-30 11:29:27 -0700 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2013-11-08 11:26:57 -0800 |
commit | 8ba90326d683b035d99e24db669093e4602a7149 (patch) | |
tree | f7ee24ee1580a7e90cd9b38fdbf28c4dd6898811 /media | |
parent | d21952fe5bc94f7bb6ee729f806c0e641fdb1a0d (diff) | |
download | frameworks_av-8ba90326d683b035d99e24db669093e4602a7149.zip frameworks_av-8ba90326d683b035d99e24db669093e4602a7149.tar.gz frameworks_av-8ba90326d683b035d99e24db669093e4602a7149.tar.bz2 |
Remove default channel mask for AudioTrack
It doesn't make sense to have a default channel mask, since the caller
needs to know what format it will use when supplying data, and there
is currently no API to return the channel mask of an AudioTrack.
audio_is_output_channel() does not allow 0, so it will catch any
stragglers (I'm not aware of any).
Also move channel mask validation earlier.
Change-Id: Ia018ded8711455581a2a935f37432b049422d492
Diffstat (limited to 'media')
-rw-r--r-- | media/libmedia/AudioTrack.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp index df58909..8319dcd 100644 --- a/media/libmedia/AudioTrack.cpp +++ b/media/libmedia/AudioTrack.cpp @@ -250,9 +250,6 @@ status_t AudioTrack::set( if (format == AUDIO_FORMAT_DEFAULT) { format = AUDIO_FORMAT_PCM_16_BIT; } - if (channelMask == 0) { - channelMask = AUDIO_CHANNEL_OUT_STEREO; - } // validate parameters if (!audio_is_valid_format(format)) { @@ -260,6 +257,11 @@ status_t AudioTrack::set( return BAD_VALUE; } + if (!audio_is_output_channel(channelMask)) { + ALOGE("Invalid channel mask %#x", channelMask); + return BAD_VALUE; + } + // AudioFlinger does not currently support 8-bit data in shared memory if (format == AUDIO_FORMAT_PCM_8_BIT && sharedBuffer != 0) { ALOGE("8-bit data in shared memory is not supported"); @@ -282,10 +284,6 @@ status_t AudioTrack::set( flags = (audio_output_flags_t)(flags &~AUDIO_OUTPUT_FLAG_DEEP_BUFFER); } - if (!audio_is_output_channel(channelMask)) { - ALOGE("Invalid channel mask %#x", channelMask); - return BAD_VALUE; - } mChannelMask = channelMask; uint32_t channelCount = popcount(channelMask); mChannelCount = channelCount; |