summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorAndy Hung <hunga@google.com>2015-04-23 01:30:04 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-04-23 01:30:05 +0000
commit25d4a63983430aa2461791445d2cea9829aab5be (patch)
tree7eda8d6d4a3bf3a944401cacd6c70fa3bfe268d0 /media
parent7b380329ece8ce0bc93f6b16459dd4a8e594e0e6 (diff)
parent98d4ca62290a45ea2a66826a1a99e9a664016808 (diff)
downloadframeworks_base-25d4a63983430aa2461791445d2cea9829aab5be.zip
frameworks_base-25d4a63983430aa2461791445d2cea9829aab5be.tar.gz
frameworks_base-25d4a63983430aa2461791445d2cea9829aab5be.tar.bz2
Merge "Add channel index mask to AudioRecord"
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/AudioRecord.java28
1 files changed, 19 insertions, 9 deletions
diff --git a/media/java/android/media/AudioRecord.java b/media/java/android/media/AudioRecord.java
index 3e771f4..8bbfb51 100644
--- a/media/java/android/media/AudioRecord.java
+++ b/media/java/android/media/AudioRecord.java
@@ -166,10 +166,14 @@ public class AudioRecord
*/
private int mChannelCount;
/**
- * The audio channel mask
+ * The audio channel position mask
*/
private int mChannelMask;
/**
+ * The audio channel index mask
+ */
+ private int mChannelIndexMask;
+ /**
* The encoding of the audio samples.
* @see AudioFormat#ENCODING_PCM_8BIT
* @see AudioFormat#ENCODING_PCM_16BIT
@@ -344,14 +348,19 @@ public class AudioRecord
audioParamCheck(attributes.getCapturePreset(), rate, encoding);
- int channelMask = AudioFormat.CHANNEL_IN_DEFAULT;
if ((format.getPropertySetMask()
- & AudioFormat.AUDIO_FORMAT_HAS_PROPERTY_CHANNEL_MASK) != 0)
- {
- channelMask = format.getChannelMask();
+ & AudioFormat.AUDIO_FORMAT_HAS_PROPERTY_CHANNEL_INDEX_MASK) != 0) {
+ mChannelIndexMask = format.getChannelIndexMask();
+ mChannelCount = format.getChannelCount();
+ }
+ if ((format.getPropertySetMask()
+ & AudioFormat.AUDIO_FORMAT_HAS_PROPERTY_CHANNEL_MASK) != 0) {
+ mChannelMask = getChannelMaskFromLegacyConfig(format.getChannelMask(), false);
+ mChannelCount = format.getChannelCount();
+ } else if (mChannelIndexMask == 0) {
+ mChannelMask = getChannelMaskFromLegacyConfig(AudioFormat.CHANNEL_IN_DEFAULT, false);
+ mChannelCount = AudioFormat.channelCountFromInChannelMask(mChannelMask);
}
- mChannelCount = AudioFormat.channelCountFromInChannelMask(channelMask);
- mChannelMask = getChannelMaskFromLegacyConfig(channelMask, false);
audioBuffSizeCheck(bufferSizeInBytes);
@@ -360,7 +369,8 @@ public class AudioRecord
//TODO: update native initialization when information about hardware init failure
// due to capture device already open is available.
int initResult = native_setup( new WeakReference<AudioRecord>(this),
- mAudioAttributes, mSampleRate, mChannelMask, mAudioFormat, mNativeBufferSizeInBytes,
+ mAudioAttributes, mSampleRate, mChannelMask, mChannelIndexMask,
+ mAudioFormat, mNativeBufferSizeInBytes,
session);
if (initResult != SUCCESS) {
loge("Error code "+initResult+" when initializing native AudioRecord object.");
@@ -1269,7 +1279,7 @@ public class AudioRecord
private native final int native_setup(Object audiorecord_this,
Object /*AudioAttributes*/ attributes,
- int sampleRate, int channelMask, int audioFormat,
+ int sampleRate, int channelMask, int channelIndexMask, int audioFormat,
int buffSizeInBytes, int[] sessionId);
// TODO remove: implementation calls directly into implementation of native_release()