Loading media/jni/android_media_MediaPlayer.cpp +13 −5 Original line number Diff line number Diff line Loading @@ -189,6 +189,7 @@ android_media_MediaPlayer_setDataSourceAndHeaders( if (tmp == NULL) { // Out of memory return; } LOGV("setDataSource: path %s", tmp); String8 pathStr(tmp); env->ReleaseStringUTFChars(path, tmp); Loading @@ -201,7 +202,6 @@ android_media_MediaPlayer_setDataSourceAndHeaders( return; } LOGV("setDataSource: path %s", pathStr); status_t opStatus = mp->setDataSource( pathStr, Loading Loading @@ -243,11 +243,13 @@ getVideoSurfaceTexture(JNIEnv* env, jobject thiz) { } static void android_media_MediaPlayer_setVideoSurface(JNIEnv *env, jobject thiz, jobject jsurface) setVideoSurface(JNIEnv *env, jobject thiz, jobject jsurface, jboolean mediaPlayerMustBeAlive) { sp<MediaPlayer> mp = getMediaPlayer(env, thiz); if (mp == NULL) { if (mediaPlayerMustBeAlive) { jniThrowException(env, "java/lang/IllegalStateException", NULL); } return; } Loading @@ -270,6 +272,12 @@ android_media_MediaPlayer_setVideoSurface(JNIEnv *env, jobject thiz, jobject jsu mp->setVideoSurfaceTexture(new_st); } static void android_media_MediaPlayer_setVideoSurface(JNIEnv *env, jobject thiz, jobject jsurface) { setVideoSurface(env, thiz, jsurface, true /* mediaPlayerMustBeAlive */); } static void android_media_MediaPlayer_prepare(JNIEnv *env, jobject thiz) { Loading Loading @@ -615,6 +623,7 @@ static void android_media_MediaPlayer_release(JNIEnv *env, jobject thiz) { LOGV("release"); setVideoSurface(env, thiz, NULL, false /* mediaPlayerMustBeAlive */); sp<MediaPlayer> mp = setMediaPlayer(env, thiz, 0); if (mp != NULL) { // this prevents native callbacks after the object is released Loading @@ -627,7 +636,6 @@ static void android_media_MediaPlayer_native_finalize(JNIEnv *env, jobject thiz) { LOGV("native_finalize"); android_media_MediaPlayer_setVideoSurface(env, thiz, NULL); android_media_MediaPlayer_release(env, thiz); } Loading Loading
media/jni/android_media_MediaPlayer.cpp +13 −5 Original line number Diff line number Diff line Loading @@ -189,6 +189,7 @@ android_media_MediaPlayer_setDataSourceAndHeaders( if (tmp == NULL) { // Out of memory return; } LOGV("setDataSource: path %s", tmp); String8 pathStr(tmp); env->ReleaseStringUTFChars(path, tmp); Loading @@ -201,7 +202,6 @@ android_media_MediaPlayer_setDataSourceAndHeaders( return; } LOGV("setDataSource: path %s", pathStr); status_t opStatus = mp->setDataSource( pathStr, Loading Loading @@ -243,11 +243,13 @@ getVideoSurfaceTexture(JNIEnv* env, jobject thiz) { } static void android_media_MediaPlayer_setVideoSurface(JNIEnv *env, jobject thiz, jobject jsurface) setVideoSurface(JNIEnv *env, jobject thiz, jobject jsurface, jboolean mediaPlayerMustBeAlive) { sp<MediaPlayer> mp = getMediaPlayer(env, thiz); if (mp == NULL) { if (mediaPlayerMustBeAlive) { jniThrowException(env, "java/lang/IllegalStateException", NULL); } return; } Loading @@ -270,6 +272,12 @@ android_media_MediaPlayer_setVideoSurface(JNIEnv *env, jobject thiz, jobject jsu mp->setVideoSurfaceTexture(new_st); } static void android_media_MediaPlayer_setVideoSurface(JNIEnv *env, jobject thiz, jobject jsurface) { setVideoSurface(env, thiz, jsurface, true /* mediaPlayerMustBeAlive */); } static void android_media_MediaPlayer_prepare(JNIEnv *env, jobject thiz) { Loading Loading @@ -615,6 +623,7 @@ static void android_media_MediaPlayer_release(JNIEnv *env, jobject thiz) { LOGV("release"); setVideoSurface(env, thiz, NULL, false /* mediaPlayerMustBeAlive */); sp<MediaPlayer> mp = setMediaPlayer(env, thiz, 0); if (mp != NULL) { // this prevents native callbacks after the object is released Loading @@ -627,7 +636,6 @@ static void android_media_MediaPlayer_native_finalize(JNIEnv *env, jobject thiz) { LOGV("native_finalize"); android_media_MediaPlayer_setVideoSurface(env, thiz, NULL); android_media_MediaPlayer_release(env, thiz); } Loading