From 612de004c47586d74d5a93901a2d94ca1fc3f5e3 Mon Sep 17 00:00:00 2001 From: Christian Beier Date: Fri, 17 Apr 2015 12:20:59 +0200 Subject: Revert "LibVNCClient: Add H.264 encoding for framebuffer updates" This reverts commit d891478ec985660c03f95cffda0e6a1ad4ba350c. Conflicts: configure.ac libvncclient/h264.c --- libvncclient/vncviewer.c | 7 ------- 1 file changed, 7 deletions(-) (limited to 'libvncclient/vncviewer.c') diff --git a/libvncclient/vncviewer.c b/libvncclient/vncviewer.c index b12116c..4f87f01 100644 --- a/libvncclient/vncviewer.c +++ b/libvncclient/vncviewer.c @@ -116,11 +116,7 @@ static rfbBool MallocFrameBuffer(rfbClient* client) { static void initAppData(AppData* data) { data->shareDesktop=TRUE; data->viewOnly=FALSE; -#ifdef LIBVNCSERVER_CONFIG_LIBVA - data->encodingsString="h264 tight zrle ultra copyrect hextile zlib corre rre raw"; -#else data->encodingsString="tight zrle ultra copyrect hextile zlib corre rre raw"; -#endif data->useBGR233=FALSE; data->nColours=0; data->forceOwnCmap=FALSE; @@ -158,9 +154,6 @@ rfbClient* rfbGetClient(int bitsPerSample,int samplesPerPixel, /* default: use complete frame buffer */ client->updateRect.x = -1; - client->frameBuffer = NULL; - client->outputWindow = 0; - client->format.bitsPerPixel = bytesPerPixel*8; client->format.depth = bitsPerSample*samplesPerPixel; client->appData.requestedDepth=client->format.depth; -- cgit v1.2.3 From 7c7e8e765c06a8af13c1f2662f1c7084c937738a Mon Sep 17 00:00:00 2001 From: Christian Beier Date: Fri, 17 Apr 2015 12:31:13 +0200 Subject: Re-add the useful bits of 9aa9ac59b4cb10bfca93456a3098e348de172d7f. --- libvncclient/rfbproto.c | 4 ++++ libvncclient/vncviewer.c | 3 +++ 2 files changed, 7 insertions(+) (limited to 'libvncclient/vncviewer.c') diff --git a/libvncclient/rfbproto.c b/libvncclient/rfbproto.c index 721c3ae..e2a583c 100644 --- a/libvncclient/rfbproto.c +++ b/libvncclient/rfbproto.c @@ -167,6 +167,10 @@ static void FillRectangle(rfbClient* client, int x, int y, int w, int h, uint32_ static void CopyRectangle(rfbClient* client, uint8_t* buffer, int x, int y, int w, int h) { int j; + if (client->frameBuffer == NULL) { + return; + } + #define COPY_RECT(BPP) \ { \ int rs = w * BPP / 8, rs2 = client->width * BPP / 8; \ diff --git a/libvncclient/vncviewer.c b/libvncclient/vncviewer.c index 4f87f01..af0a50b 100644 --- a/libvncclient/vncviewer.c +++ b/libvncclient/vncviewer.c @@ -154,6 +154,9 @@ rfbClient* rfbGetClient(int bitsPerSample,int samplesPerPixel, /* default: use complete frame buffer */ client->updateRect.x = -1; + client->frameBuffer = NULL; + client->outputWindow = 0; + client->format.bitsPerPixel = bytesPerPixel*8; client->format.depth = bitsPerSample*samplesPerPixel; client->appData.requestedDepth=client->format.depth; -- cgit v1.2.3 From 1da7872784a78446284b4e8ef71691458296026c Mon Sep 17 00:00:00 2001 From: gbdj Date: Sat, 23 Apr 2016 14:42:49 +0400 Subject: libvncclient/tls_gnutls.c: Add hooks to WriteToTLS() for optional protection by mutex. Fix upstream issue #100 Squashed commit of the pull request #101 : commit 1c7e01e81862bc46508e675e83c74cc6d63224b0 commit 1e749b094d6696380d3f0540a00138d7e3427874 --- libvncclient/tls_gnutls.c | 21 +++++++++++++++++++++ libvncclient/vncviewer.c | 2 ++ rfb/rfbclient.h | 6 ++++++ 3 files changed, 29 insertions(+) (limited to 'libvncclient/vncviewer.c') diff --git a/libvncclient/tls_gnutls.c b/libvncclient/tls_gnutls.c index 3daa416..91cea67 100644 --- a/libvncclient/tls_gnutls.c +++ b/libvncclient/tls_gnutls.c @@ -480,6 +480,14 @@ WriteToTLS(rfbClient* client, char *buf, unsigned int n) unsigned int offset = 0; ssize_t ret; + if (client->LockWriteToTLS) + { + if (!client->LockWriteToTLS(client)) + { + rfbClientLog("Callback to get lock in WriteToTLS() failed\n"); + return -1; + } + } while (offset < n) { ret = gnutls_record_send((gnutls_session_t)client->tlsSession, buf+offset, (size_t)(n-offset)); @@ -488,10 +496,23 @@ WriteToTLS(rfbClient* client, char *buf, unsigned int n) { if (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED) continue; rfbClientLog("Error writing to TLS: %s.\n", gnutls_strerror(ret)); + if (client->UnlockWriteToTLS) + { + if (!client->UnlockWriteToTLS(client)) + rfbClientLog("Callback to unlock WriteToTLS() failed\n"); + } return -1; } offset += (unsigned int)ret; } + if (client->UnlockWriteToTLS) + { + if (!client->UnlockWriteToTLS(client)) + { + rfbClientLog("Callback to unlock WriteToTLS() failed\n"); + return -1; + } + } return offset; } diff --git a/libvncclient/vncviewer.c b/libvncclient/vncviewer.c index af0a50b..d81e298 100644 --- a/libvncclient/vncviewer.c +++ b/libvncclient/vncviewer.c @@ -220,6 +220,8 @@ rfbClient* rfbGetClient(int bitsPerSample,int samplesPerPixel, client->subAuthScheme = 0; client->GetCredential = NULL; client->tlsSession = NULL; + client->LockWriteToTLS = NULL; + client->UnlockWriteToTLS = NULL; client->sock = -1; client->listenSock = -1; client->listenAddress = NULL; diff --git a/rfb/rfbclient.h b/rfb/rfbclient.h index 157461e..c18eaf9 100644 --- a/rfb/rfbclient.h +++ b/rfb/rfbclient.h @@ -182,6 +182,8 @@ typedef void (*BellProc)(struct _rfbClient* client); */ typedef void (*GotCursorShapeProc)(struct _rfbClient* client, int xhot, int yhot, int width, int height, int bytesPerPixel); typedef void (*GotCopyRectProc)(struct _rfbClient* client, int src_x, int src_y, int w, int h, int dest_x, int dest_y); +typedef rfbBool (*LockWriteToTLSProc)(struct _rfbClient* client); +typedef rfbBool (*UnlockWriteToTLSProc)(struct _rfbClient* client); typedef struct _rfbClient { uint8_t* frameBuffer; @@ -361,6 +363,10 @@ typedef struct _rfbClient { /* Output Window ID. When set, client application enables libvncclient to perform direct rendering in its window */ unsigned long outputWindow; + /** Hooks for optional protection WriteToTLS() by mutex */ + LockWriteToTLSProc LockWriteToTLS; + UnlockWriteToTLSProc UnlockWriteToTLS; + } rfbClient; /* cursor.c */ -- cgit v1.2.3