From 054f6dfb270bc74d193b2e22da2061aa150f3673 Mon Sep 17 00:00:00 2001 From: xufulong <839789740@qq.com> Date: Sun, 8 Dec 2019 16:13:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8=E6=96=B0=E7=9A=84=E4=BA=92?= =?UTF-8?q?=E6=96=A5=E9=94=81=E7=AD=89=E5=BE=85=E8=B6=85=E6=97=B6=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 使用新的互斥锁等待超时方法 --- app/src/main/cpp/media_player.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/cpp/media_player.c b/app/src/main/cpp/media_player.c index d58a25b..4ad6d98 100644 --- a/app/src/main/cpp/media_player.c +++ b/app/src/main/cpp/media_player.c @@ -183,10 +183,10 @@ void player_wait_for_frame(MediaPlayer *player, int64_t stream_time) { //TODO:等待指定时长 // pthread_cond_timeout_np(&player->cond, &player->mutex, // (unsigned int) (sleep_time / 1000ll)); -// gettimeofday(&now, NULL); -// timeout.tv_sec = now.tv_sec; -// timeout.tv_nsec = (now.tv_usec + sleep_time) * 1000; -// pthread_cond_timedwait(&player->cond, &player->mutex, &timeout); + gettimeofday(&now, NULL); + timeout.tv_sec = now.tv_sec; + timeout.tv_nsec = (now.tv_usec + sleep_time) * 1000; + pthread_cond_timedwait(&player->cond, &player->mutex, &timeout); } pthread_mutex_unlock(&player->mutex); }