Skip to content
Permalink
Browse files

ijkplayer: ijkmp_reset update, not recreate player, just wait_stop.

  • Loading branch information
befovy committed Aug 16, 2019
1 parent 131eb28 commit 91c17c14f2e9b630c271ec4486eaf76463756b2f
@@ -390,10 +390,7 @@ IjkMediaPlayer_reset(JNIEnv *env, jobject thiz)
if (!mp)
return;

jobject weak_thiz = (jobject) ijkmp_set_weak_thiz(mp, NULL );

IjkMediaPlayer_release(env, thiz);
IjkMediaPlayer_native_setup(env, thiz, weak_thiz);
ijkmp_reset(mp);

ijkmp_dec_ref_p(&mp);
}
@@ -553,6 +553,18 @@ int ijkmp_stop(IjkMediaPlayer *mp)
return retval;
}

int ijkmp_reset(IjkMediaPlayer *mp)
{
assert(mp);
MPTRACE("ijkmp_reset()\n");
pthread_mutex_lock(&mp->mutex);
int retval = ffp_wait_stop_l(mp->ffplayer);
pthread_mutex_unlock(&mp->mutex);
MPTRACE("ijkmp_reset()=%d\n", retval);
ijkmp_change_state_l(mp, MP_STATE_IDLE);
return retval;
}

bool ijkmp_is_playing(IjkMediaPlayer *mp)
{
assert(mp);
@@ -201,6 +201,7 @@ int ijkmp_prepare_async(IjkMediaPlayer *mp);
int ijkmp_start(IjkMediaPlayer *mp);
int ijkmp_pause(IjkMediaPlayer *mp);
int ijkmp_stop(IjkMediaPlayer *mp);
int ijkmp_reset(IjkMediaPlayer *mp);
int ijkmp_seek_to(IjkMediaPlayer *mp, long msec);
int ijkmp_get_state(IjkMediaPlayer *mp);
bool ijkmp_is_playing(IjkMediaPlayer *mp);
@@ -241,8 +241,8 @@ - (void) shutdown

- (int) reset
{
[self shutdown];
[self nativeSetup];
ijkmp_stop(_nativeMediaPlayer);
ijkmp_reset(_nativeMediaPlayer);
return 0;
}

0 comments on commit 91c17c1

Please sign in to comment.
You can’t perform that action at this time.