Fix some RTP queue bugs

This commit is contained in:
Cameron Gutman 2015-05-28 09:06:51 -05:00
parent f837f24998
commit 0b6727e92d
2 changed files with 8 additions and 3 deletions

View File

@ -15,7 +15,7 @@ void RtpqCleanupQueue(PRTP_REORDER_QUEUE queue) {
while (queue->queueHead != NULL) {
PRTP_QUEUE_ENTRY entry = queue->queueHead;
queue->queueHead = entry->next;
free(entry);
free(entry->packet);
}
}
@ -47,6 +47,7 @@ static int queuePacket(PRTP_REORDER_QUEUE queue, PRTP_QUEUE_ENTRY newEntry, int
if (queue->oldestQueuedTimeMs == UINT64_MAX) {
queue->oldestQueuedTimeMs = newEntry->queueTimeMs;
queue->oldestQueuedEntry = newEntry;
}
if (queue->queueHead == NULL) {
@ -144,7 +145,7 @@ static PRTP_QUEUE_ENTRY validateQueueConstraints(PRTP_REORDER_QUEUE queue) {
// Check that the queue's time constraint is satisfied
if (PltGetMillis() - queue->oldestQueuedTimeMs > queue->maxQueueTimeMs) {
Limelog("Discarding RTP packet queued for too long");
Limelog("Discarding RTP packet queued for too long\n");
removeEntry(queue, queue->oldestQueuedEntry);
free(queue->oldestQueuedEntry->packet);
needsUpdate = 1;
@ -152,7 +153,7 @@ static PRTP_QUEUE_ENTRY validateQueueConstraints(PRTP_REORDER_QUEUE queue) {
// Check that the queue's size constraint is satisfied
if (!needsUpdate && queue->queueSize == queue->maxSize) {
Limelog("Discarding RTP packet after queue overgrowth");
Limelog("Discarding RTP packet after queue overgrowth\n");
removeEntry(queue, queue->oldestQueuedEntry);
free(queue->oldestQueuedEntry->packet);
needsUpdate = 1;

View File

@ -113,6 +113,10 @@ static void ReceiveThreadProc(void* context) {
free(buffer);
}
}
else if (queueStatus == RTPQ_RET_QUEUED_NOTHING_READY) {
// The queue owns the buffer
buffer = NULL;
}
}
if (buffer != NULL) {