From bf97d3e041c70eb3431545ec17800c1625b18053 Mon Sep 17 00:00:00 2001 From: kubistika Date: Wed, 5 Jun 2019 16:18:00 +0300 Subject: [PATCH] rdpgfx/client: Expose QoeFrameAck --- channels/rdpgfx/client/rdpgfx_main.c | 53 ++++++++++++++++++++++++------------ include/freerdp/client/rdpgfx.h | 3 ++ 2 files changed, 38 insertions(+), 18 deletions(-) diff --git a/channels/rdpgfx/client/rdpgfx_main.c b/channels/rdpgfx/client/rdpgfx_main.c index 48996ba..8bd9559 100644 --- a/channels/rdpgfx/client/rdpgfx_main.c +++ b/channels/rdpgfx/client/rdpgfx_main.c @@ -368,16 +368,31 @@ fail: return error; } -static UINT rdpgfx_send_qoe_frame_acknowledge_pdu(RDPGFX_CHANNEL_CALLBACK* callback, +static UINT rdpgfx_send_qoe_frame_acknowledge_pdu(RdpgfxClientContext* context, const RDPGFX_QOE_FRAME_ACKNOWLEDGE_PDU* pdu) { UINT error; wStream* s; RDPGFX_HEADER header; - RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*) callback->plugin; + RDPGFX_CHANNEL_CALLBACK* callback; + RDPGFX_PLUGIN* gfx; header.flags = 0; header.cmdId = RDPGFX_CMDID_QOEFRAMEACKNOWLEDGE; header.pduLength = RDPGFX_HEADER_SIZE + 12; + + if (!context || !pdu) + return ERROR_BAD_ARGUMENTS; + + gfx = (RDPGFX_PLUGIN*) context->handle; + + if (!gfx) + return ERROR_BAD_CONFIGURATION; + + callback = gfx->listener_callback->channel_callback; + + if (!callback) + return ERROR_BAD_CONFIGURATION; + DEBUG_RDPGFX(gfx->log, "SendQoeFrameAcknowledgePdu: %"PRIu32"", pdu->frameId); s = Stream_New(NULL, header.pduLength); @@ -791,28 +806,29 @@ static UINT rdpgfx_recv_end_frame_pdu(RDPGFX_CHANNEL_CALLBACK* callback, gfx->UnacknowledgedFrames--; gfx->TotalDecodedFrames++; + + if (!gfx->sendFrameAcks) + return error; + ack.frameId = pdu.frameId; ack.totalFramesDecoded = gfx->TotalDecodedFrames; - if (gfx->sendFrameAcks) + if (gfx->suspendFrameAcks) { - if (gfx->suspendFrameAcks) - { - ack.queueDepth = SUSPEND_FRAME_ACKNOWLEDGEMENT; - - if (gfx->TotalDecodedFrames == 1) - if ((error = rdpgfx_send_frame_acknowledge_pdu(context, &ack))) - WLog_Print(gfx->log, WLOG_ERROR, "rdpgfx_send_frame_acknowledge_pdu failed with error %"PRIu32"", - error); - } - else - { - ack.queueDepth = QUEUE_DEPTH_UNAVAILABLE; + ack.queueDepth = SUSPEND_FRAME_ACKNOWLEDGEMENT; + if (gfx->TotalDecodedFrames == 1) if ((error = rdpgfx_send_frame_acknowledge_pdu(context, &ack))) WLog_Print(gfx->log, WLOG_ERROR, "rdpgfx_send_frame_acknowledge_pdu failed with error %"PRIu32"", - error); - } + error); + } + else + { + ack.queueDepth = QUEUE_DEPTH_UNAVAILABLE; + + if ((error = rdpgfx_send_frame_acknowledge_pdu(context, &ack))) + WLog_Print(gfx->log, WLOG_ERROR, "rdpgfx_send_frame_acknowledge_pdu failed with error %"PRIu32"", + error); } switch (gfx->ConnectionCaps.version) @@ -836,7 +852,7 @@ static UINT rdpgfx_recv_end_frame_pdu(RDPGFX_CHANNEL_CALLBACK* callback, qoe.timeDiffSE = diff; qoe.timeDiffEDR = 1; - if ((error = rdpgfx_send_qoe_frame_acknowledge_pdu(callback, &qoe))) + if ((error = rdpgfx_send_qoe_frame_acknowledge_pdu(context, &qoe))) WLog_Print(gfx->log, WLOG_ERROR, "rdpgfx_send_qoe_frame_acknowledge_pdu failed with error %"PRIu32"", error); @@ -2105,6 +2121,7 @@ UINT DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints) context->CapsAdvertise = rdpgfx_send_caps_advertise_pdu; context->FrameAcknowledge = rdpgfx_send_frame_acknowledge_pdu; context->CacheImportOffer = rdpgfx_send_cache_import_offer_pdu; + context->QoeFrameAcknowledge = rdpgfx_send_qoe_frame_acknowledge_pdu; gfx->iface.pInterface = (void*) context; gfx->zgfx = zgfx_context_new(FALSE); diff --git a/include/freerdp/client/rdpgfx.h b/include/freerdp/client/rdpgfx.h index 793f0e0..b33786a 100644 --- a/include/freerdp/client/rdpgfx.h +++ b/include/freerdp/client/rdpgfx.h @@ -92,6 +92,8 @@ typedef UINT(*pcRdpgfxCapsConfirm)(RdpgfxClientContext* context, const RDPGFX_CAPS_CONFIRM_PDU* capsConfirm); typedef UINT(*pcRdpgfxFrameAcknowledge)(RdpgfxClientContext* context, const RDPGFX_FRAME_ACKNOWLEDGE_PDU* frameAcknowledge); +typedef UINT(*pcRdpgfxQoeFrameAcknowledge)(RdpgfxClientContext* context, + const RDPGFX_QOE_FRAME_ACKNOWLEDGE_PDU* qoeFrameAcknowledge); typedef UINT(*pcRdpgfxMapWindowForSurface)(RdpgfxClientContext* context, UINT16 surfaceID, UINT64 windowID); @@ -134,6 +136,7 @@ struct _rdpgfx_client_context pcRdpgfxCapsAdvertise CapsAdvertise; pcRdpgfxCapsConfirm CapsConfirm; pcRdpgfxFrameAcknowledge FrameAcknowledge; + pcRdpgfxQoeFrameAcknowledge QoeFrameAcknowledge; /* No locking required */ pcRdpgfxUpdateSurfaces UpdateSurfaces; -- 2.7.4