From 7f590a7601b38a525e9b791d87f87bfc874f7c66 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 29 Jun 2014 18:30:55 -0700 Subject: [PATCH] Fix packet size allocation for video stream --- limelight-common/VideoStream.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/limelight-common/VideoStream.c b/limelight-common/VideoStream.c index 28172ca..d5d2b6b 100644 --- a/limelight-common/VideoStream.c +++ b/limelight-common/VideoStream.c @@ -60,8 +60,11 @@ static void UdpPingThreadProc(void *context) { static void ReceiveThreadProc(void* context) { int err; + int bufferSize; + char* buffer; - char* buffer = (char*) malloc(configuration.packetSize); + bufferSize = configuration.packetSize + sizeof(RTP_PACKET); + buffer = (char*)malloc(bufferSize); if (buffer == NULL) { Limelog("Receive thread terminating\n"); listenerCallbacks->connectionTerminated(-1); @@ -69,7 +72,7 @@ static void ReceiveThreadProc(void* context) { } while (!PltIsThreadInterrupted(&receiveThread)) { - err = recv(rtpSocket, buffer, configuration.packetSize, 0); + err = recv(rtpSocket, buffer, bufferSize, 0); if (err <= 0) { Limelog("Receive thread terminating #2\n"); listenerCallbacks->connectionTerminated(LastSocketError());