diff --git a/limelight-common/Limelight-internal.h b/limelight-common/Limelight-internal.h index eb1d46e..dec0db6 100644 --- a/limelight-common/Limelight-internal.h +++ b/limelight-common/Limelight-internal.h @@ -17,7 +17,7 @@ void connectionDetectedFrameLoss(int startFrame, int endFrame); void connectionReceivedFrame(int frameIndex); void connectionLostPackets(int lastReceivedPacket, int nextReceivedPacket); -void initializeVideoDepacketizer(void); +void initializeVideoDepacketizer(int pktSize); void destroyVideoDepacketizer(void); void processRtpPayload(PNV_VIDEO_PACKET videoPacket, int length); int getNextDecodeUnit(PDECODE_UNIT *du); diff --git a/limelight-common/VideoDepacketizer.c b/limelight-common/VideoDepacketizer.c index ccd16dc..fc3406b 100644 --- a/limelight-common/VideoDepacketizer.c +++ b/limelight-common/VideoDepacketizer.c @@ -15,17 +15,19 @@ static int gotNextFrameStart; static int lastPacketInStream = 0; static LINKED_BLOCKING_QUEUE decodeUnitQueue; +static int packetSize; static unsigned short lastSequenceNumber; typedef struct _BUFFER_DESC { char* data; - int offset; - int length; + unsigned int offset; + unsigned int length; } BUFFER_DESC, *PBUFFER_DESC; -void initializeVideoDepacketizer(void) { +void initializeVideoDepacketizer(int pktSize) { LbqInitializeLinkedBlockingQueue(&decodeUnitQueue, 15); + packetSize = pktSize; } static void clearAvcNalState(void) { @@ -243,7 +245,7 @@ void processRtpPayload(PNV_VIDEO_PACKET videoPacket, int length) { currentPos.offset = 0; currentPos.length = length - sizeof(*videoPacket); - if (currentPos.length < 968) { + if (currentPos.length < packetSize - sizeof(NV_VIDEO_PACKET)) { processRtpPayloadSlow(videoPacket, ¤tPos); return; } diff --git a/limelight-common/VideoStream.c b/limelight-common/VideoStream.c index ce3f852..6629dbd 100644 --- a/limelight-common/VideoStream.c +++ b/limelight-common/VideoStream.c @@ -32,7 +32,7 @@ void initializeVideoStream(IP_ADDRESS host, PSTREAM_CONFIGURATION streamConfig, LbqInitializeLinkedBlockingQueue(&packetQueue, 30); - initializeVideoDepacketizer(); + initializeVideoDepacketizer(configuration.packetSize); } void destroyVideoStream(void) {