[obs] microsttuer fix, be sure to always grab the latest frame

This commit is contained in:
Geoffrey McRae 2020-08-09 12:29:52 +10:00
parent 1d6d640b6e
commit 3511fb8d59
2 changed files with 15 additions and 1 deletions

View File

@ -1 +1 @@
B2-rc2-23-g977d7b277d+1 B2-rc2-24-g1d6d640b6e+1

View File

@ -1,3 +1,5 @@
#define _GNU_SOURCE //needed for pthread_setname_np
#include <obs/obs-module.h> #include <obs/obs-module.h>
#include <obs/util/threading.h> #include <obs/util/threading.h>
@ -193,6 +195,7 @@ static void lgUpdate(void * data, obs_data_t * settings)
this->state = STATE_STARTING; this->state = STATE_STARTING;
pthread_create(&this->frameThread, NULL, frameThread, this); pthread_create(&this->frameThread, NULL, frameThread, this);
pthread_setname_np(this->frameThread, "LGFrameThread");
} }
static void lgVideoTick(void * data, float seconds) static void lgVideoTick(void * data, float seconds)
@ -212,6 +215,17 @@ static void lgVideoTick(void * data, float seconds)
return; 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 = lgmpClientProcess(this->frameQueue, &msg)) != LGMP_OK)
{ {
if (status == LGMP_ERR_QUEUE_EMPTY) if (status == LGMP_ERR_QUEUE_EMPTY)