mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-14 21:17:54 +00:00
[c-host] dxgi: fix segfault with maxTextures=1 on client reconnect
This commit is contained in:
parent
8ada29e25f
commit
0bd19cfd38
2 changed files with 30 additions and 21 deletions
|
@ -222,6 +222,9 @@ static bool dxgi_init(void * pointerShape, const unsigned int pointerSize)
|
||||||
this->texWIndex = 0;
|
this->texWIndex = 0;
|
||||||
this->texReady = 0;
|
this->texReady = 0;
|
||||||
|
|
||||||
|
os_resetEvent(this->frameEvent );
|
||||||
|
os_resetEvent(this->pointerEvent);
|
||||||
|
|
||||||
status = CreateDXGIFactory1(&IID_IDXGIFactory1, (void **)&this->factory);
|
status = CreateDXGIFactory1(&IID_IDXGIFactory1, (void **)&this->factory);
|
||||||
if (FAILED(status))
|
if (FAILED(status))
|
||||||
{
|
{
|
||||||
|
|
|
@ -162,6 +162,7 @@ static int frameThread(void * opaque)
|
||||||
volatile KVMFRFrame * fi = &(app.shmHeader->frame);
|
volatile KVMFRFrame * fi = &(app.shmHeader->frame);
|
||||||
|
|
||||||
bool frameValid = false;
|
bool frameValid = false;
|
||||||
|
bool repeatFrame = false;
|
||||||
int frameIndex = 0;
|
int frameIndex = 0;
|
||||||
unsigned int clientInstance = 0;
|
unsigned int clientInstance = 0;
|
||||||
CaptureFrame frame = { 0 };
|
CaptureFrame frame = { 0 };
|
||||||
|
@ -171,6 +172,7 @@ static int frameThread(void * opaque)
|
||||||
switch(app.iface->waitFrame(&frame))
|
switch(app.iface->waitFrame(&frame))
|
||||||
{
|
{
|
||||||
case CAPTURE_RESULT_OK:
|
case CAPTURE_RESULT_OK:
|
||||||
|
repeatFrame = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CAPTURE_RESULT_REINIT:
|
case CAPTURE_RESULT_REINIT:
|
||||||
|
@ -191,8 +193,7 @@ static int frameThread(void * opaque)
|
||||||
if (frameValid && clientInstance != app.clientInstance)
|
if (frameValid && clientInstance != app.clientInstance)
|
||||||
{
|
{
|
||||||
// resend the last frame
|
// resend the last frame
|
||||||
if (--frameIndex < 0)
|
repeatFrame = true;
|
||||||
frameIndex = MAX_FRAMES - 1;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,6 +207,10 @@ static int frameThread(void * opaque)
|
||||||
while(fi->flags & KVMFR_FRAME_FLAG_UPDATE && app.running)
|
while(fi->flags & KVMFR_FRAME_FLAG_UPDATE && app.running)
|
||||||
usleep(1000);
|
usleep(1000);
|
||||||
|
|
||||||
|
if (repeatFrame)
|
||||||
|
INTERLOCKED_OR8(&fi->flags, KVMFR_FRAME_FLAG_UPDATE);
|
||||||
|
else
|
||||||
|
{
|
||||||
switch(frame.format)
|
switch(frame.format)
|
||||||
{
|
{
|
||||||
case CAPTURE_FMT_BGRA : fi->type = FRAME_TYPE_BGRA ; break;
|
case CAPTURE_FMT_BGRA : fi->type = FRAME_TYPE_BGRA ; break;
|
||||||
|
@ -227,6 +232,7 @@ static int frameThread(void * opaque)
|
||||||
framebuffer_prepare(app.frame[frameIndex]);
|
framebuffer_prepare(app.frame[frameIndex]);
|
||||||
INTERLOCKED_OR8(&fi->flags, KVMFR_FRAME_FLAG_UPDATE);
|
INTERLOCKED_OR8(&fi->flags, KVMFR_FRAME_FLAG_UPDATE);
|
||||||
app.iface->getFrame(app.frame[frameIndex]);
|
app.iface->getFrame(app.frame[frameIndex]);
|
||||||
|
}
|
||||||
|
|
||||||
if (++frameIndex == MAX_FRAMES)
|
if (++frameIndex == MAX_FRAMES)
|
||||||
frameIndex = 0;
|
frameIndex = 0;
|
||||||
|
|
Loading…
Reference in a new issue