Improve FEC queue packet submission and retrieval from O(n) to O(1)

This commit is contained in:
Cameron Gutman
2019-04-25 23:02:01 -07:00
parent f395d3056a
commit fe7cb006da
3 changed files with 94 additions and 95 deletions

View File

@@ -122,15 +122,8 @@ static void ReceiveThreadProc(void* context) {
packet->sequenceNumber = htons(packet->sequenceNumber);
queueStatus = RtpfAddPacket(&rtpQueue, packet, err, (PRTPFEC_QUEUE_ENTRY)&buffer[receiveSize]);
if (queueStatus == RTPF_RET_QUEUED_PACKETS_READY) {
// The packet queue now has packets ready
buffer = NULL;
while ((queueEntry = RtpfGetQueuedPacket(&rtpQueue)) != NULL) {
// queueRtpPacket takes ownership of the packet
queueRtpPacket(queueEntry);
}
}
else if (queueStatus == RTPF_RET_QUEUED_NOTHING_READY) {
if (queueStatus == RTPF_RET_QUEUED) {
// The queue owns the buffer
buffer = NULL;
}