Commit 55bfe1ae authored by Thomas Guillem's avatar Thomas Guillem

libvlcjni: jni_LockAndGetSubtitlesSurface returns immediatly

parent 53002afc
......@@ -27,7 +27,6 @@
extern JNIEnv *jni_get_env(const char *name);
pthread_mutex_t vout_android_lock;
pthread_cond_t vout_android_surf_attached;
static void *vout_android_gui = NULL;
static jobject vout_android_java_surf = NULL;
static jobject vout_android_subtitles_surf = NULL;
......@@ -35,15 +34,19 @@ static bool vout_video_player_activity_created = false;
void *jni_LockAndGetSubtitlesSurface() {
pthread_mutex_lock(&vout_android_lock);
while (vout_android_subtitles_surf == NULL)
pthread_cond_wait(&vout_android_surf_attached, &vout_android_lock);
if (!vout_android_subtitles_surf) {
pthread_mutex_unlock(&vout_android_lock);
return NULL;
}
return vout_android_subtitles_surf;
}
jobject jni_LockAndGetAndroidJavaSurface() {
pthread_mutex_lock(&vout_android_lock);
while (vout_android_java_surf == NULL)
pthread_cond_wait(&vout_android_surf_attached, &vout_android_lock);
if (!vout_android_java_surf) {
pthread_mutex_unlock(&vout_android_lock);
return NULL;
}
return vout_android_java_surf;
}
......@@ -181,7 +184,6 @@ void Java_org_videolan_libvlc_LibVLC_attachSurface(JNIEnv *env, jobject thiz, jo
(*env)->DeleteGlobalRef(env, vout_android_java_surf);
vout_android_gui = (*env)->NewGlobalRef(env, gui);
vout_android_java_surf = (*env)->NewGlobalRef(env, surf);
pthread_cond_signal(&vout_android_surf_attached);
pthread_mutex_unlock(&vout_android_lock);
}
......@@ -201,7 +203,6 @@ void Java_org_videolan_libvlc_LibVLC_attachSubtitlesSurface(JNIEnv *env, jobject
if (vout_android_subtitles_surf != NULL)
(*env)->DeleteGlobalRef(env, vout_android_subtitles_surf);
vout_android_subtitles_surf = (*env)->NewGlobalRef(env, surf);
pthread_cond_signal(&vout_android_surf_attached);
pthread_mutex_unlock(&vout_android_lock);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment