Skip to content

Commit c4de6f8

Browse files
Jamie GennisAndroid (Google) Code Review
authored andcommitted
Merge "MediaPlayer: properly handle released surfaces" into ics-mr0
2 parents 63fae9d + f76afc8 commit c4de6f8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

media/jni/android_media_MediaPlayer.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,14 @@ setVideoSurface(JNIEnv *env, jobject thiz, jobject jsurface, jboolean mediaPlaye
274274
sp<ISurfaceTexture> new_st;
275275
if (jsurface) {
276276
sp<Surface> surface(Surface_getSurface(env, jsurface));
277-
new_st = surface->getSurfaceTexture();
278-
new_st->incStrong(thiz);
277+
if (surface != NULL) {
278+
new_st = surface->getSurfaceTexture();
279+
new_st->incStrong(thiz);
280+
} else {
281+
jniThrowException(env, "java/lang/IllegalArgumentException",
282+
"The surface has been released");
283+
return;
284+
}
279285
}
280286

281287
env->SetIntField(thiz, fields.surface_texture, (int)new_st.get());

0 commit comments

Comments
 (0)