Fix a potential(observed sometimes) media server crash
The problem is that we are referring an temp object returned from a function call. When the function call returned, the temp object is gone; and thus the reference may be invalidated. -- rebased bug - 2734946 Change-Id: I1993c4462df95610ca478f816adc30058af5850e
This commit is contained in:
@@ -317,7 +317,7 @@ android_media_MediaRecorder_prepare(JNIEnv *env, jobject thiz)
|
||||
|
||||
jobject surface = env->GetObjectField(thiz, fields.surface);
|
||||
if (surface != NULL) {
|
||||
const sp<Surface>& native_surface = get_surface(env, surface);
|
||||
const sp<Surface> native_surface = get_surface(env, surface);
|
||||
LOGI("prepare: surface=%p (identity=%d)", native_surface.get(), native_surface->getIdentity());
|
||||
if (process_media_recorder_call(env, mr->setPreviewSurface(native_surface), "java/lang/RuntimeException", "setPreviewSurface failed.")) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user