Fix packet size allocation for video stream

This commit is contained in:
Cameron Gutman 2014-06-29 18:30:55 -07:00 committed by Michelle Bergeron
parent f2af6c8bd9
commit 7f590a7601

View File

@ -60,8 +60,11 @@ static void UdpPingThreadProc(void *context) {
static void ReceiveThreadProc(void* context) { static void ReceiveThreadProc(void* context) {
int err; 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) { if (buffer == NULL) {
Limelog("Receive thread terminating\n"); Limelog("Receive thread terminating\n");
listenerCallbacks->connectionTerminated(-1); listenerCallbacks->connectionTerminated(-1);
@ -69,7 +72,7 @@ static void ReceiveThreadProc(void* context) {
} }
while (!PltIsThreadInterrupted(&receiveThread)) { while (!PltIsThreadInterrupted(&receiveThread)) {
err = recv(rtpSocket, buffer, configuration.packetSize, 0); err = recv(rtpSocket, buffer, bufferSize, 0);
if (err <= 0) { if (err <= 0) {
Limelog("Receive thread terminating #2\n"); Limelog("Receive thread terminating #2\n");
listenerCallbacks->connectionTerminated(LastSocketError()); listenerCallbacks->connectionTerminated(LastSocketError());