summaryrefslogtreecommitdiffstats
path: root/core/jni/android_media_AudioRecord.cpp
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2009-12-05 05:20:01 -0800
committerEric Laurent <elaurent@google.com>2009-12-07 05:37:47 -0800
commit9cc489a2196e449dbe090ad9bdbc5cedd0b8334f (patch)
tree6f6faede20b355f2a89bd45f2cd05d7d02d3e1db /core/jni/android_media_AudioRecord.cpp
parentae952b3bcc3eb744cceb5cd0ae65b2c7a83f9de7 (diff)
downloadframeworks_base-9cc489a2196e449dbe090ad9bdbc5cedd0b8334f.zip
frameworks_base-9cc489a2196e449dbe090ad9bdbc5cedd0b8334f.tar.gz
frameworks_base-9cc489a2196e449dbe090ad9bdbc5cedd0b8334f.tar.bz2
Fix issue 2304669: VoiceIME: starting and canceling voice IME yields persistent "error 8" state on future attempts and breaks voice search.
Fixed AudioFlinger::openInput() broken in change ddb78e7753be03937ad57ce7c3c842c52bdad65e so that an invalid IO handle (0) is returned in case of failure. Applied the same correction to openOutput(). Modified RecordThread start procedure so that a failure occuring during the first read from audio input stream is detected and causes the record start to fail. Modified RecordThread stop procedure to make sure that audio input stream fd is closed before we exit the stop function. Fixed AudioRecord JAVA and JNI implementation to take status of native AudioRecord::start() into account and not change mRecordingState to RECORDSTATE_RECORDING if start fails.
Diffstat (limited to 'core/jni/android_media_AudioRecord.cpp')
-rw-r--r--core/jni/android_media_AudioRecord.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/jni/android_media_AudioRecord.cpp b/core/jni/android_media_AudioRecord.cpp
index 0be996d..d7485ae 100644
--- a/core/jni/android_media_AudioRecord.cpp
+++ b/core/jni/android_media_AudioRecord.cpp
@@ -224,17 +224,17 @@ native_track_failure:
// ----------------------------------------------------------------------------
-static void
+static int
android_media_AudioRecord_start(JNIEnv *env, jobject thiz)
{
AudioRecord *lpRecorder =
(AudioRecord *)env->GetIntField(thiz, javaAudioRecordFields.nativeRecorderInJavaObj);
if (lpRecorder == NULL ) {
jniThrowException(env, "java/lang/IllegalStateException", NULL);
- return;
+ return AUDIORECORD_ERROR;
}
- lpRecorder->start();
+ return android_media_translateRecorderErrorCode(lpRecorder->start());
}
@@ -482,7 +482,7 @@ static jint android_media_AudioRecord_get_min_buff_size(JNIEnv *env, jobject th
// ----------------------------------------------------------------------------
static JNINativeMethod gMethods[] = {
// name, signature, funcPtr
- {"native_start", "()V", (void *)android_media_AudioRecord_start},
+ {"native_start", "()I", (void *)android_media_AudioRecord_start},
{"native_stop", "()V", (void *)android_media_AudioRecord_stop},
{"native_setup", "(Ljava/lang/Object;IIIII)I",
(void *)android_media_AudioRecord_setup},