使用新的互斥锁等待超时方法

使用新的互斥锁等待超时方法
pull/107/head
xufulong 5 years ago
parent 09f830ddd1
commit 054f6dfb27
  1. 8
      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);
}

Loading…
Cancel
Save