summaryrefslogtreecommitdiffstats
path: root/media/jni
diff options
context:
space:
mode:
authorGloria Wang <gwang@google.com>2011-08-09 15:29:34 -0700
committerGloria Wang <gwang@google.com>2011-08-09 15:31:30 -0700
commit91784c996f95483e3041169215c0d6635e27ffcc (patch)
tree4ae8badfa2529f83e8747e687b971bdc79012b32 /media/jni
parent1467ec343309821b215cb3e049a6746d07030c07 (diff)
downloadframeworks_base-91784c996f95483e3041169215c0d6635e27ffcc.zip
frameworks_base-91784c996f95483e3041169215c0d6635e27ffcc.tar.gz
frameworks_base-91784c996f95483e3041169215c0d6635e27ffcc.tar.bz2
To support for switching from a non-null surface/ surface texture to
a null one, and vice versa. Fix for bug 5137445. Change-Id: Ifca2997f8ad27a843abbdaa7e89a56329bc40fde
Diffstat (limited to 'media/jni')
-rw-r--r--media/jni/android_media_MediaPlayer.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp
index 5663683..9090daa 100644
--- a/media/jni/android_media_MediaPlayer.cpp
+++ b/media/jni/android_media_MediaPlayer.cpp
@@ -247,9 +247,8 @@ android_media_MediaPlayer_setDataSourceFD(JNIEnv *env, jobject thiz, jobject fil
static void setVideoSurfaceOrSurfaceTexture(
const sp<MediaPlayer>& mp, JNIEnv *env, jobject thiz, const char *prefix)
{
- // The Java MediaPlayer class makes sure that at most one of mSurface and
- // mParcelSurfaceTexture is non-null. But just in case, we give priority to
- // mSurface over mParcelSurfaceTexture.
+ // Both mSurface and mParcelSurfaceTexture could be null.
+ // We give priority to mSurface over mParcelSurfaceTexture.
jobject surface = env->GetObjectField(thiz, fields.surface);
if (surface != NULL) {
sp<Surface> native_surface(get_surface(env, surface));
@@ -263,6 +262,8 @@ static void setVideoSurfaceOrSurfaceTexture(
ParcelSurfaceTexture_getISurfaceTexture(env, parcelSurfaceTexture));
LOGV("%s: texture=%p", prefix, native_surfaceTexture.get());
mp->setVideoSurfaceTexture(native_surfaceTexture);
+ } else {
+ mp->setVideoSurfaceTexture(NULL);
}
}
}