diff options
author | Andy Hung <hunga@google.com> | 2015-04-19 22:33:15 -0700 |
---|---|---|
committer | Andy Hung <hunga@google.com> | 2015-04-22 15:43:48 -0700 |
commit | 98d4ca62290a45ea2a66826a1a99e9a664016808 (patch) | |
tree | 3642a7b7bfb51f5b25cd2ca3650ba57989d3cb9d /core/jni | |
parent | 263b4c97823295c41900210515d0c769a236190c (diff) | |
download | frameworks_base-98d4ca62290a45ea2a66826a1a99e9a664016808.zip frameworks_base-98d4ca62290a45ea2a66826a1a99e9a664016808.tar.gz frameworks_base-98d4ca62290a45ea2a66826a1a99e9a664016808.tar.bz2 |
Add channel index mask to AudioRecord
Change-Id: I5d2504d3a7af6611d3ffa9a4c2d3665a2cf97fef
Diffstat (limited to 'core/jni')
-rw-r--r-- | core/jni/android_media_AudioRecord.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/core/jni/android_media_AudioRecord.cpp b/core/jni/android_media_AudioRecord.cpp index 33db4a85..23b0d50 100644 --- a/core/jni/android_media_AudioRecord.cpp +++ b/core/jni/android_media_AudioRecord.cpp @@ -145,8 +145,7 @@ static sp<AudioRecord> setAudioRecord(JNIEnv* env, jobject thiz, const sp<AudioR // ---------------------------------------------------------------------------- static jint android_media_AudioRecord_setup(JNIEnv *env, jobject thiz, jobject weak_this, - jobject jaa, jint sampleRateInHertz, jint channelMask, - // Java channel masks map directly to the native definition + jobject jaa, jint sampleRateInHertz, jint channelMask, jint channelIndexMask, jint audioFormat, jint buffSizeInBytes, jintArray jSession) { //ALOGV(">> Entering android_media_AudioRecord_setup"); @@ -158,6 +157,15 @@ android_media_AudioRecord_setup(JNIEnv *env, jobject thiz, jobject weak_this, return (jint) AUDIO_JAVA_ERROR; } + // channel index mask takes priority over channel position masks. + if (channelIndexMask) { + // Java channel index masks need the representation bits set. + channelMask = audio_channel_mask_from_representation_and_bits( + AUDIO_CHANNEL_REPRESENTATION_INDEX, + channelIndexMask); + } + // Java channel position masks map directly to the native definition + if (!audio_is_input_channel(channelMask)) { ALOGE("Error creating AudioRecord: channel mask %#x is not valid.", channelMask); return (jint) AUDIORECORD_ERROR_SETUP_INVALIDCHANNELMASK; @@ -583,7 +591,7 @@ static JNINativeMethod gMethods[] = { // name, signature, funcPtr {"native_start", "(II)I", (void *)android_media_AudioRecord_start}, {"native_stop", "()V", (void *)android_media_AudioRecord_stop}, - {"native_setup", "(Ljava/lang/Object;Ljava/lang/Object;IIII[I)I", + {"native_setup", "(Ljava/lang/Object;Ljava/lang/Object;IIIII[I)I", (void *)android_media_AudioRecord_setup}, {"native_finalize", "()V", (void *)android_media_AudioRecord_finalize}, {"native_release", "()V", (void *)android_media_AudioRecord_release}, |