diff options
author | Eric Laurent <elaurent@google.com> | 2011-06-18 10:34:05 -0700 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2011-07-18 09:43:23 -0700 |
commit | 44ff4cd8be50768d5bd471bc6c034acefa0b59ca (patch) | |
tree | 6a6e1e6b9060adb7e8a2c0d8eff397fca6ad5b3a /media | |
parent | 464d5b3da21c84ba13dc69c611d40f6bed49badb (diff) | |
download | frameworks_base-44ff4cd8be50768d5bd471bc6c034acefa0b59ca.zip frameworks_base-44ff4cd8be50768d5bd471bc6c034acefa0b59ca.tar.gz frameworks_base-44ff4cd8be50768d5bd471bc6c034acefa0b59ca.tar.bz2 |
AudioRecord JAVA: expose audio session Id
Added getAudioSessionId() method to AudioRecord class so that applications can
retrieve the AudioRecord's session ID and attach audio pre processes.
Change-Id: I1914770f0e54d97c9aef6a9eb36fff69b6d31552
Diffstat (limited to 'media')
-rw-r--r-- | media/java/android/media/AudioRecord.java | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/media/java/android/media/AudioRecord.java b/media/java/android/media/AudioRecord.java index c567a6e..855e831 100644 --- a/media/java/android/media/AudioRecord.java +++ b/media/java/android/media/AudioRecord.java @@ -185,7 +185,10 @@ public class AudioRecord * Size of the native audio buffer. */ private int mNativeBufferSizeInBytes = 0; - + /** + * Audio session ID + */ + private int mSessionId = 0; //--------------------------------------------------------- // Constructor, Finalize @@ -227,15 +230,20 @@ public class AudioRecord audioBuffSizeCheck(bufferSizeInBytes); // native initialization + int[] session = new int[1]; + session[0] = 0; //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), - mRecordSource, mSampleRate, mChannels, mAudioFormat, mNativeBufferSizeInBytes); + mRecordSource, mSampleRate, mChannels, mAudioFormat, mNativeBufferSizeInBytes, + session); if (initResult != SUCCESS) { loge("Error code "+initResult+" when initializing native AudioRecord object."); return; // with mState == STATE_UNINITIALIZED } + mSessionId = session[0]; + mState = STATE_INITIALIZED; } @@ -485,6 +493,15 @@ public class AudioRecord } } + /** + * Returns the audio session ID. + * + * @return the ID of the audio session this AudioRecord belongs to. + * @hide + */ + public int getAudioSessionId() { + return mSessionId; + } //--------------------------------------------------------- // Transport control methods @@ -763,7 +780,8 @@ public class AudioRecord //-------------------- private native final int native_setup(Object audiorecord_this, - int recordSource, int sampleRate, int nbChannels, int audioFormat, int buffSizeInBytes); + int recordSource, int sampleRate, int nbChannels, int audioFormat, + int buffSizeInBytes, int[] sessionId); private native final void native_finalize(); |