From 3511fb8d59f1c3fc5d8b2216f7bdf558f3883538 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sun, 9 Aug 2020 12:29:52 +1000 Subject: [PATCH] [obs] microsttuer fix, be sure to always grab the latest frame --- VERSION | 2 +- obs/lg.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 94bf94f8..9acae70a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -B2-rc2-23-g977d7b277d+1 \ No newline at end of file +B2-rc2-24-g1d6d640b6e+1 \ No newline at end of file diff --git a/obs/lg.c b/obs/lg.c index 7bed224a..0435f495 100644 --- a/obs/lg.c +++ b/obs/lg.c @@ -1,3 +1,5 @@ +#define _GNU_SOURCE //needed for pthread_setname_np + #include #include @@ -193,6 +195,7 @@ static void lgUpdate(void * data, obs_data_t * settings) this->state = STATE_STARTING; pthread_create(&this->frameThread, NULL, frameThread, this); + pthread_setname_np(this->frameThread, "LGFrameThread"); } static void lgVideoTick(void * data, float seconds) @@ -212,6 +215,17 @@ static void lgVideoTick(void * data, float seconds) return; } + if ((status = lgmpClientAdvanceToLast(this->frameQueue)) != LGMP_OK) + { + if (status != LGMP_ERR_QUEUE_EMPTY) + { + os_sem_post(this->frameSem); + printf("lgmpClientAdvanceToLast: %s\n", lgmpStatusString(status)); + return; + } + } + + if ((status = lgmpClientProcess(this->frameQueue, &msg)) != LGMP_OK) { if (status == LGMP_ERR_QUEUE_EMPTY)