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