提交 286a5198 编写于 作者: Z Zhang Rui

jni: ijkplayer: NULL check

上级 b1af7e58
......@@ -44,18 +44,15 @@ typedef struct player_fields_t {
} player_fields_t;
static player_fields_t g_clazz;
inline static int jni_get_int_fields(JNIEnv* env, jobject thiz, jfieldID field)
{
return (*env)->GetIntField(env, thiz, field);
}
static IjkMediaPlayer *get_media_player(JNIEnv* env, jobject thiz)
{
// FIXME: lock ref count
pthread_mutex_lock(&g_clazz.mutex);
IjkMediaPlayer *mp = (IjkMediaPlayer *) jni_get_int_fields(env, thiz, g_clazz.mNativeMediaPlayer);
ijkmp_inc_ref(mp);
IjkMediaPlayer *mp = (IjkMediaPlayer *) (*env)->GetLongField(env, thiz, g_clazz.mNativeMediaPlayer);
if (mp) {
ijkmp_inc_ref(mp);
}
pthread_mutex_unlock(&g_clazz.mutex);
return mp;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册