mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-28 00:07:19 +00:00
[client] spice: more fixes to video source transition
This commit is contained in:
parent
47b2a26898
commit
b2221b114e
@ -179,6 +179,11 @@ bool app_guestIsOSX(void);
|
|||||||
bool app_guestIsBSD(void);
|
bool app_guestIsBSD(void);
|
||||||
bool app_guestIsOther(void);
|
bool app_guestIsOther(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable/disable the LG display
|
||||||
|
*/
|
||||||
|
void app_stopVideo(bool stop);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable/disable the spice display
|
* Enable/disable the spice display
|
||||||
*/
|
*/
|
||||||
|
@ -1009,17 +1009,48 @@ bool app_guestIsOther(void)
|
|||||||
return g_state.guestOS == KVMFR_OS_OTHER;
|
return g_state.guestOS == KVMFR_OS_OTHER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void app_stopVideo(bool stop)
|
||||||
|
{
|
||||||
|
if (g_state.stopVideo == stop)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// do not change the state if the host app is not connected
|
||||||
|
if (!g_state.lgHostConnected)
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_state.stopVideo = stop;
|
||||||
|
|
||||||
|
app_alert(
|
||||||
|
LG_ALERT_INFO,
|
||||||
|
stop ? "Video Stream Disabled" : "Video Stream Enabled"
|
||||||
|
);
|
||||||
|
|
||||||
|
if (stop)
|
||||||
|
{
|
||||||
|
core_stopCursorThread();
|
||||||
|
core_stopFrameThread();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
core_startCursorThread();
|
||||||
|
core_startFrameThread();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void app_useSpiceDisplay(bool enable)
|
void app_useSpiceDisplay(bool enable)
|
||||||
{
|
{
|
||||||
static bool enabled = false;
|
static bool lastState = false;
|
||||||
|
if (!g_params.useSpice || lastState == enable)
|
||||||
if (!g_params.useSpice || enabled == enable)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!purespice_hasChannel(PS_CHANNEL_DISPLAY))
|
if (!purespice_hasChannel(PS_CHANNEL_DISPLAY))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
enabled = enable;
|
// do not allow stopping of the host app is not connected
|
||||||
|
if (!enable && !g_state.lgHostConnected)
|
||||||
|
return;
|
||||||
|
|
||||||
|
lastState = enable;
|
||||||
if (enable)
|
if (enable)
|
||||||
{
|
{
|
||||||
purespice_connectChannel(PS_CHANNEL_DISPLAY);
|
purespice_connectChannel(PS_CHANNEL_DISPLAY);
|
||||||
|
@ -35,22 +35,7 @@ static void bind_fullscreen(int sc, void * opaque)
|
|||||||
|
|
||||||
static void bind_video(int sc, void * opaque)
|
static void bind_video(int sc, void * opaque)
|
||||||
{
|
{
|
||||||
g_state.stopVideo = !g_state.stopVideo;
|
app_stopVideo(!g_state.stopVideo);
|
||||||
app_alert(
|
|
||||||
LG_ALERT_INFO,
|
|
||||||
g_state.stopVideo ? "Video Stream Disabled" : "Video Stream Enabled"
|
|
||||||
);
|
|
||||||
|
|
||||||
if (g_state.stopVideo)
|
|
||||||
{
|
|
||||||
core_stopCursorThread();
|
|
||||||
core_stopFrameThread();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
core_startCursorThread();
|
|
||||||
core_startFrameThread();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bind_rotate(int sc, void * opaque)
|
static void bind_rotate(int sc, void * opaque)
|
||||||
|
@ -600,9 +600,6 @@ int main_frameThread(void * unused)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// disable the spice display as we have a frame from the LG host
|
|
||||||
app_useSpiceDisplay(false);
|
|
||||||
|
|
||||||
KVMFRFrame * frame = (KVMFRFrame *)msg.mem;
|
KVMFRFrame * frame = (KVMFRFrame *)msg.mem;
|
||||||
|
|
||||||
// ignore any repeated frames, this happens when a new client connects to
|
// ignore any repeated frames, this happens when a new client connects to
|
||||||
@ -805,6 +802,9 @@ int main_frameThread(void * unused)
|
|||||||
lgSignalEvent(g_state.frameEvent);
|
lgSignalEvent(g_state.frameEvent);
|
||||||
|
|
||||||
lgmpClientMessageDone(queue);
|
lgmpClientMessageDone(queue);
|
||||||
|
|
||||||
|
// switch over to the LG stream
|
||||||
|
app_useSpiceDisplay(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
lgmpClientUnsubscribe(&queue);
|
lgmpClientUnsubscribe(&queue);
|
||||||
@ -890,8 +890,7 @@ static void spice_surfaceCreate(unsigned int surfaceId, PSSurfaceFormat format,
|
|||||||
static void spice_surfaceDestroy(unsigned int surfaceId)
|
static void spice_surfaceDestroy(unsigned int surfaceId)
|
||||||
{
|
{
|
||||||
DEBUG_INFO("Destroy spice surface %d", surfaceId);
|
DEBUG_INFO("Destroy spice surface %d", surfaceId);
|
||||||
if (g_state.lgr)
|
app_useSpiceDisplay(false);
|
||||||
RENDERER(spiceShow, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void spice_drawFill(unsigned int surfaceId, int x, int y, int width,
|
static void spice_drawFill(unsigned int surfaceId, int x, int y, int width,
|
||||||
@ -933,6 +932,7 @@ int spiceThread(void * arg)
|
|||||||
.display =
|
.display =
|
||||||
{
|
{
|
||||||
.enable = true,
|
.enable = true,
|
||||||
|
.autoConnect = false,
|
||||||
.surfaceCreate = spice_surfaceCreate,
|
.surfaceCreate = spice_surfaceCreate,
|
||||||
.surfaceDestroy = spice_surfaceDestroy,
|
.surfaceDestroy = spice_surfaceDestroy,
|
||||||
.drawFill = spice_drawFill,
|
.drawFill = spice_drawFill,
|
||||||
@ -1316,9 +1316,8 @@ static int lg_run(void)
|
|||||||
if (g_state.cbAvailable)
|
if (g_state.cbAvailable)
|
||||||
g_state.cbRequestList = ll_new();
|
g_state.cbRequestList = ll_new();
|
||||||
|
|
||||||
// fallback to the spice display
|
// use the spice display until we get frames from the LG host application
|
||||||
if (g_params.useSpice && purespice_hasChannel(PS_CHANNEL_DISPLAY))
|
app_useSpiceDisplay(true);
|
||||||
purespice_connectChannel(PS_CHANNEL_DISPLAY);
|
|
||||||
|
|
||||||
LGMP_STATUS status;
|
LGMP_STATUS status;
|
||||||
|
|
||||||
@ -1574,7 +1573,10 @@ restart:
|
|||||||
checkUUID();
|
checkUUID();
|
||||||
|
|
||||||
if (g_state.state == APP_STATE_RUNNING)
|
if (g_state.state == APP_STATE_RUNNING)
|
||||||
|
{
|
||||||
DEBUG_INFO("Starting session");
|
DEBUG_INFO("Starting session");
|
||||||
|
g_state.lgHostConnected = true;
|
||||||
|
}
|
||||||
|
|
||||||
g_state.kvmfrFeatures = udata->features;
|
g_state.kvmfrFeatures = udata->features;
|
||||||
|
|
||||||
@ -1589,6 +1591,7 @@ restart:
|
|||||||
{
|
{
|
||||||
if (!lgmpClientSessionValid(g_state.lgmp))
|
if (!lgmpClientSessionValid(g_state.lgmp))
|
||||||
{
|
{
|
||||||
|
g_state.lgHostConnected = false;
|
||||||
DEBUG_INFO("Waiting for the host to restart...");
|
DEBUG_INFO("Waiting for the host to restart...");
|
||||||
g_state.state = APP_STATE_RESTART;
|
g_state.state = APP_STATE_RESTART;
|
||||||
break;
|
break;
|
||||||
@ -1604,11 +1607,8 @@ restart:
|
|||||||
core_stopFrameThread();
|
core_stopFrameThread();
|
||||||
core_stopCursorThread();
|
core_stopCursorThread();
|
||||||
|
|
||||||
|
|
||||||
g_state.state = APP_STATE_RUNNING;
|
g_state.state = APP_STATE_RUNNING;
|
||||||
lgInit();
|
lgInit();
|
||||||
|
|
||||||
RENDERER(onRestart);
|
|
||||||
goto restart;
|
goto restart;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1721,7 +1721,6 @@ int main(int argc, char * argv[])
|
|||||||
app_registerOverlay(&LGOverlayMsg , NULL);
|
app_registerOverlay(&LGOverlayMsg , NULL);
|
||||||
app_registerOverlay(&LGOverlayRecord, NULL);
|
app_registerOverlay(&LGOverlayRecord, NULL);
|
||||||
|
|
||||||
|
|
||||||
// early renderer setup for option registration
|
// early renderer setup for option registration
|
||||||
for(unsigned int i = 0; i < LG_RENDERER_COUNT; ++i)
|
for(unsigned int i = 0; i < LG_RENDERER_COUNT; ++i)
|
||||||
LG_Renderers[i]->setup();
|
LG_Renderers[i]->setup();
|
||||||
|
@ -75,6 +75,8 @@ struct AppState
|
|||||||
bool guestUUIDValid;
|
bool guestUUIDValid;
|
||||||
KVMFROS guestOS;
|
KVMFROS guestOS;
|
||||||
|
|
||||||
|
bool lgHostConnected;
|
||||||
|
|
||||||
bool stopVideo;
|
bool stopVideo;
|
||||||
bool ignoreInput;
|
bool ignoreInput;
|
||||||
bool escapeActive;
|
bool escapeActive;
|
||||||
|
@ -54,6 +54,9 @@ void renderQueue_clear(void)
|
|||||||
|
|
||||||
void renderQueue_spiceConfigure(int width, int height)
|
void renderQueue_spiceConfigure(int width, int height)
|
||||||
{
|
{
|
||||||
|
// reconfigurations invalidate the entire queue
|
||||||
|
renderQueue_clear();
|
||||||
|
|
||||||
RenderCommand * cmd = malloc(sizeof(*cmd));
|
RenderCommand * cmd = malloc(sizeof(*cmd));
|
||||||
cmd->op = SPICE_OP_CONFIGURE;
|
cmd->op = SPICE_OP_CONFIGURE;
|
||||||
cmd->configure.width = width;
|
cmd->configure.width = width;
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 44aafd252723ecc5117d6c4bb699f035adcc4f1a
|
Subproject commit 1a91bbb760d5e70d7e7fffad2eb2b1cb1a22f6a1
|
Loading…
Reference in New Issue
Block a user