diff options
author | Marco Nelissen <marcone@google.com> | 2009-07-10 09:34:59 -0700 |
---|---|---|
committer | Marco Nelissen <marcone@google.com> | 2009-07-10 13:43:41 -0700 |
commit | 0fc736f321b01995d9f5913d2490cbb479554266 (patch) | |
tree | 091b71ef6efb72b9dea36bb4d70d6ff5f8f1af87 /media/jni | |
parent | b88993f073a353fba6a2d6e4510fad5a2a5b170d (diff) | |
download | frameworks_base-0fc736f321b01995d9f5913d2490cbb479554266.zip frameworks_base-0fc736f321b01995d9f5913d2490cbb479554266.tar.gz frameworks_base-0fc736f321b01995d9f5913d2490cbb479554266.tar.bz2 |
Don't pass references to temporary objects, and handle the case where we dont have a Surface.
Diffstat (limited to 'media/jni')
-rw-r--r-- | media/jni/android_media_MediaPlayer.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp index b173129..d26d039 100644 --- a/media/jni/android_media_MediaPlayer.cpp +++ b/media/jni/android_media_MediaPlayer.cpp @@ -101,10 +101,9 @@ void JNIMediaPlayerListener::notify(int msg, int ext1, int ext2) // ---------------------------------------------------------------------------- -static sp<Surface> get_surface(JNIEnv* env, jobject clazz) +static Surface* get_surface(JNIEnv* env, jobject clazz) { - Surface* const p = (Surface*)env->GetIntField(clazz, fields.surface_native); - return sp<Surface>(p); + return (Surface*)env->GetIntField(clazz, fields.surface_native); } static sp<MediaPlayer> getMediaPlayer(JNIEnv* env, jobject thiz) @@ -205,7 +204,7 @@ static void setVideoSurface(const sp<MediaPlayer>& mp, 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); LOGV("prepare: surface=%p (id=%d)", native_surface.get(), native_surface->ID()); mp->setVideoSurface(native_surface); @@ -245,7 +244,7 @@ android_media_MediaPlayer_prepareAsync(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); LOGV("prepareAsync: surface=%p (id=%d)", native_surface.get(), native_surface->ID()); mp->setVideoSurface(native_surface); |