From: Mati Shabtay <35010736+m4ntis@users.noreply.github.com> Date: Fri, 5 Apr 2019 11:37:51 +0000 (+0300) Subject: Added optional PreFrameAck callback to RdpgfxClientContext (#5303) X-Git-Tag: 2.0.0~496 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6e8c02c9eefea7979847d5fd4107166b6f756cc7;p=platform%2Fupstream%2Ffreerdp.git 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 --- diff --git a/channels/rdpgfx/client/rdpgfx_main.c b/channels/rdpgfx/client/rdpgfx_main.c index bd3b993..987c787 100644 --- a/channels/rdpgfx/client/rdpgfx_main.c +++ b/channels/rdpgfx/client/rdpgfx_main.c @@ -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); } diff --git a/include/freerdp/client/rdpgfx.h b/include/freerdp/client/rdpgfx.h index 84f5219..7de72ed 100644 --- a/include/freerdp/client/rdpgfx.h +++ b/include/freerdp/client/rdpgfx.h @@ -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) };