am 29fe8cb9: am c4de6f81: Merge "MediaPlayer: properly handle released surfaces" into ics-mr0

* commit '29fe8cb941648cbd9d684680f2660a95c565ad51':
  MediaPlayer: properly handle released surfaces
This commit is contained in:
Jamie Gennis
2011-10-17 12:42:47 -07:00
committed by Android Git Automerger

View File

@@ -274,8 +274,14 @@ setVideoSurface(JNIEnv *env, jobject thiz, jobject jsurface, jboolean mediaPlaye
sp<ISurfaceTexture> new_st;
if (jsurface) {
sp<Surface> surface(Surface_getSurface(env, jsurface));
new_st = surface->getSurfaceTexture();
new_st->incStrong(thiz);
if (surface != NULL) {
new_st = surface->getSurfaceTexture();
new_st->incStrong(thiz);
} else {
jniThrowException(env, "java/lang/IllegalArgumentException",
"The surface has been released");
return;
}
}
env->SetIntField(thiz, fields.surface_texture, (int)new_st.get());