From c5491ef92809ce9da1164ad9d880b5842e8f05b5 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 28 Jun 2014 23:54:50 -0700 Subject: [PATCH] Fix SDP generator bugs based on testing within the test harness --- limelight-common/Limelight-internal.h | 2 ++ limelight-common/SdpGenerator.c | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/limelight-common/Limelight-internal.h b/limelight-common/Limelight-internal.h index 3f9cf81..eb1d46e 100644 --- a/limelight-common/Limelight-internal.h +++ b/limelight-common/Limelight-internal.h @@ -6,6 +6,8 @@ #include "PlatformThreads.h" #include "Video.h" +char* getSdpPayloadForStreamConfig(PSTREAM_CONFIGURATION streamConfig, struct in_addr targetAddress, int *length); + int initializeControlStream(IP_ADDRESS host, PSTREAM_CONFIGURATION streamConfig, PCONNECTION_LISTENER_CALLBACKS clCallbacks); int startControlStream(void); int stopControlStream(void); diff --git a/limelight-common/SdpGenerator.c b/limelight-common/SdpGenerator.c index 3f21c85..9b71658 100644 --- a/limelight-common/SdpGenerator.c +++ b/limelight-common/SdpGenerator.c @@ -117,6 +117,7 @@ static int addAttributeBinary(PSDP_OPTION *head, char* name, const void* payload return -1; } + option->next = NULL; option->payloadLen = payloadLen; strcpy(option->name, name); option->payload = (void*)(option + 1); @@ -150,6 +151,7 @@ static PSDP_OPTION getAttributesList(PSTREAM_CONFIGURATION streamConfig, struct optionHead = NULL; + err = 0; err |= addAttributeBinary(&optionHead, "x-nv-callbacks", ATTRIB_X_NV_CALLBACKS, sizeof(ATTRIB_X_NV_CALLBACKS)); err |= addAttributeBinary(&optionHead, "x-nv-videoDecoder", @@ -335,14 +337,14 @@ ExitFailure: return NULL; } -int fillSdpHeader(char* buffer, struct in_addr targetAddress) { +static int fillSdpHeader(char* buffer, struct in_addr targetAddress) { return sprintf(buffer, "v=0\r\n" "o=android 0 9 IN IPv4 %s\r\n" "s=NVIDIA Streaming Client\r\n", inet_ntoa(targetAddress)); } -int fillSdpTail(char* buffer) { +static int fillSdpTail(char* buffer) { return sprintf(buffer, "t=0 0\r\n" "m=video 47996 \r\n"); @@ -369,6 +371,7 @@ char* getSdpPayloadForStreamConfig(PSTREAM_CONFIGURATION streamConfig, struct in offset += fillSerializedAttributeList(&payload[offset], attributeList); offset += fillSdpTail(&payload[offset]); + freeAttributeList(attributeList); *length = offset; return payload; }