Added optional PreFrameAck callback to RdpgfxClientContext (#5303)

* RdpgfxClientContext: Add PreFrameAck callback

* client/rdpgfx_main.c: Call PreFrameAck callback before acking frame

* client/rdpgfx_main.c: Fix windows_msbuild_vs2010 CI build

* client/rdpgfx_main.c: Fix error logs log level
This commit is contained in:
Mati Shabtay 2019-04-05 14:37:51 +03:00 committed by akallabeth
parent e0d60a0310
commit 6e8c02c9ee
2 changed files with 22 additions and 13 deletions

View File

@ -148,7 +148,6 @@ static UINT rdpgfx_send_caps_advertise_pdu(RDPGFX_CHANNEL_CALLBACK* callback)
capsSet->version = RDPGFX_CAPVERSION_105;
capsSet->length = 0x4;
capsSet->flags = caps10Flags;
/* TODO: Until RDPGFX_MAP_SURFACE_TO_SCALED_OUTPUT_PDU and
* RDPGFX_MAP_SURFACE_TO_SCALED_WINDOW_PDU are not implemented do not
* announce the following version */
@ -600,6 +599,7 @@ static UINT rdpgfx_recv_end_frame_pdu(RDPGFX_CHANNEL_CALLBACK* callback,
RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*) callback->plugin;
RdpgfxClientContext* context = (RdpgfxClientContext*) gfx->iface.pInterface;
UINT error = CHANNEL_RC_OK;
BOOL sendAck = TRUE;
if (Stream_GetRemainingLength(s) < RDPGFX_END_FRAME_PDU_SIZE)
{
@ -625,23 +625,27 @@ static UINT rdpgfx_recv_end_frame_pdu(RDPGFX_CHANNEL_CALLBACK* callback,
gfx->TotalDecodedFrames++;
ack.frameId = pdu.frameId;
ack.totalFramesDecoded = gfx->TotalDecodedFrames;
IFCALLRET(context->PreFrameAck, sendAck, context, &ack);
if (gfx->suspendFrameAcks)
if (sendAck)
{
ack.queueDepth = SUSPEND_FRAME_ACKNOWLEDGEMENT;
if (gfx->suspendFrameAcks)
{
ack.queueDepth = SUSPEND_FRAME_ACKNOWLEDGEMENT;
if (gfx->TotalDecodedFrames == 1)
if ((error = rdpgfx_send_frame_acknowledge_pdu(callback, &ack)))
WLog_Print(gfx->log, WLOG_ERROR, "rdpgfx_send_frame_acknowledge_pdu failed with error %"PRIu32"",
error);
}
else
{
ack.queueDepth = QUEUE_DEPTH_UNAVAILABLE;
if (gfx->TotalDecodedFrames == 1)
if ((error = rdpgfx_send_frame_acknowledge_pdu(callback, &ack)))
WLog_Print(gfx->log, WLOG_ERROR, "rdpgfx_send_frame_acknowledge_pdu failed with error %"PRIu32"",
error);
}
else
{
ack.queueDepth = QUEUE_DEPTH_UNAVAILABLE;
if ((error = rdpgfx_send_frame_acknowledge_pdu(callback, &ack)))
WLog_Print(gfx->log, WLOG_DEBUG, "rdpgfx_send_frame_acknowledge_pdu failed with error %"PRIu32"",
error);
}
}
switch (gfx->ConnectionCaps.version)
@ -663,7 +667,7 @@ static UINT rdpgfx_recv_end_frame_pdu(RDPGFX_CHANNEL_CALLBACK* callback,
qoe.timeDiffEDR = 1;
if ((error = rdpgfx_send_qoe_frame_acknowledge_pdu(callback, &qoe)))
WLog_Print(gfx->log, WLOG_DEBUG, "rdpgfx_send_frame_acknowledge_pdu failed with error %"PRIu32"",
WLog_Print(gfx->log, WLOG_ERROR, "rdpgfx_send_frame_acknowledge_pdu failed with error %"PRIu32"",
error);
}

View File

@ -83,6 +83,9 @@ typedef UINT(*pcRdpgfxUpdateSurfaces)(RdpgfxClientContext* context);
typedef UINT(*pcRdpgfxUpdateSurfaceArea)(RdpgfxClientContext* context, UINT16 surfaceId,
UINT32 nrRects, const RECTANGLE_16* rects);
typedef BOOL(*pcRdpgfxPreFrameAck)(RdpgfxClientContext* context,
RDPGFX_FRAME_ACKNOWLEDGE_PDU* frameAcknowledge);
struct _rdpgfx_client_context
{
void* handle;
@ -118,6 +121,8 @@ struct _rdpgfx_client_context
pcRdpgfxUpdateSurfaces UpdateSurfaces;
pcRdpgfxUpdateSurfaceArea UpdateSurfaceArea;
pcRdpgfxPreFrameAck PreFrameAck;
CRITICAL_SECTION mux;
PROFILER_DEFINE(SurfaceProfiler)
};