Merge "MediaRecorder: Fix crash when given a released Camera object" into lmp-dev

This commit is contained in:
Eino-Ville Talvala
2014-07-14 22:36:01 +00:00
committed by Android (Google) Code Review

View File

@@ -157,6 +157,10 @@ static void android_media_MediaRecorder_setCamera(JNIEnv* env, jobject thiz, job
return;
}
sp<Camera> c = get_native_camera(env, camera, NULL);
if (c == NULL) {
// get_native_camera will throw an exception in this case
return;
}
sp<MediaRecorder> mr = getMediaRecorder(env, thiz);
process_media_recorder_call(env, mr->setCamera(c->remote(), c->getRecordingProxy()),
"java/lang/RuntimeException", "setCamera failed.");