summaryrefslogtreecommitdiffstats
path: root/core/jni
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2014-05-16 16:04:00 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-05-16 16:04:00 +0000
commitc40c0c9d9cbf57ca731570ece2c26e80a898e948 (patch)
tree9479ad8b9b0f1d847ba0bcf358652a9f097880ea /core/jni
parentc5a88944f005e9c9bd69eaf4c9ef17a1f6948005 (diff)
parent2defed988f74c98d5af8d02551ebf7262490cc5b (diff)
downloadframeworks_base-c40c0c9d9cbf57ca731570ece2c26e80a898e948.zip
frameworks_base-c40c0c9d9cbf57ca731570ece2c26e80a898e948.tar.gz
frameworks_base-c40c0c9d9cbf57ca731570ece2c26e80a898e948.tar.bz2
Merge "AudioTrack JNI cleanup"
Diffstat (limited to 'core/jni')
-rw-r--r--core/jni/android_media_AudioTrack.cpp36
1 files changed, 3 insertions, 33 deletions
diff --git a/core/jni/android_media_AudioTrack.cpp b/core/jni/android_media_AudioTrack.cpp
index 463a0a8..5fcb5f3 100644
--- a/core/jni/android_media_AudioTrack.cpp
+++ b/core/jni/android_media_AudioTrack.cpp
@@ -201,22 +201,6 @@ android_media_AudioTrack_setup(JNIEnv *env, jobject thiz, jobject weak_this,
{
ALOGV("sampleRate=%d, audioFormat(from Java)=%d, channel mask=%x, buffSize=%d",
sampleRateInHertz, audioFormat, javaChannelMask, buffSizeInBytes);
- uint32_t afSampleRate;
- size_t afFrameCount;
-
- status_t status = AudioSystem::getOutputFrameCount(&afFrameCount,
- (audio_stream_type_t) streamType);
- if (status != NO_ERROR) {
- ALOGE("Error %d creating AudioTrack: Could not get AudioSystem frame count "
- "for stream type %d.", status, streamType);
- return (jint) AUDIOTRACK_ERROR_SETUP_AUDIOSYSTEM;
- }
- status = AudioSystem::getOutputSamplingRate(&afSampleRate, (audio_stream_type_t) streamType);
- if (status != NO_ERROR) {
- ALOGE("Error %d creating AudioTrack: Could not get AudioSystem sampling rate "
- "for stream type %d.", status, streamType);
- return (jint) AUDIOTRACK_ERROR_SETUP_AUDIOSYSTEM;
- }
// Java channel masks don't map directly to the native definition, but it's a simple shift
// to skip the two deprecated channel configurations "default" and "mono".
@@ -229,23 +213,8 @@ android_media_AudioTrack_setup(JNIEnv *env, jobject thiz, jobject weak_this,
uint32_t channelCount = popcount(nativeChannelMask);
- // check the stream type
- audio_stream_type_t atStreamType;
- switch (streamType) {
- case AUDIO_STREAM_VOICE_CALL:
- case AUDIO_STREAM_SYSTEM:
- case AUDIO_STREAM_RING:
- case AUDIO_STREAM_MUSIC:
- case AUDIO_STREAM_ALARM:
- case AUDIO_STREAM_NOTIFICATION:
- case AUDIO_STREAM_BLUETOOTH_SCO:
- case AUDIO_STREAM_DTMF:
- atStreamType = (audio_stream_type_t) streamType;
- break;
- default:
- ALOGE("Error creating AudioTrack: unknown stream type %d.", streamType);
- return (jint) AUDIOTRACK_ERROR_SETUP_INVALIDSTREAMTYPE;
- }
+ // stream type already checked in Java
+ audio_stream_type_t atStreamType = (audio_stream_type_t) streamType;
// check the format.
// This function was called from Java, so we compare the format against the Java constants
@@ -305,6 +274,7 @@ android_media_AudioTrack_setup(JNIEnv *env, jobject thiz, jobject weak_this,
lpJniStorage->mCallbackData.busy = false;
// initialize the native AudioTrack object
+ status_t status = NO_ERROR;
switch (memoryMode) {
case MODE_STREAM: