Disable FEC on Gen 4 and earlier and assert that FLAG_EXTENSION is present

This commit is contained in:
Cameron Gutman 2020-05-03 15:51:49 -07:00
parent f911d974c9
commit 495b269a10

View File

@ -108,8 +108,9 @@ static int reconstructFrame(PRTP_FEC_QUEUE queue) {
}
#ifdef FEC_VALIDATION_MODE
// If FEC is disabled for this frame, we must bail early here.
if (queue->fecPercentage == 0 && queue->receivedBufferDataPackets == queue->bufferDataPackets) {
// If FEC is disabled or unsupported for this frame, we must bail early here.
if ((queue->fecPercentage == 0 || AppVersionQuad[0] < 5) &&
queue->receivedBufferDataPackets == queue->bufferDataPackets) {
#else
if (queue->receivedBufferDataPackets == queue->bufferDataPackets) {
#endif
@ -117,6 +118,13 @@ static int reconstructFrame(PRTP_FEC_QUEUE queue) {
return 0;
}
if (AppVersionQuad[0] < 5) {
// Our FEC recovery code doesn't work properly until Gen 5
Limelog("FEC recovery not supported on Gen %d servers\n",
AppVersionQuad[0]);
return -1;
}
reed_solomon* rs = NULL;
unsigned char** packets = malloc(totalPackets * sizeof(unsigned char*));
unsigned char* marks = malloc(totalPackets * sizeof(unsigned char));
@ -393,6 +401,9 @@ int RtpfAddPacket(PRTP_FEC_QUEUE queue, PRTP_PACKET packet, int length, PRTPFEC_
return RTPF_RET_REJECTED;
}
// FLAG_EXTENSION is required for all supported versions of GFE.
LC_ASSERT(packet->header & FLAG_EXTENSION);
int dataOffset = sizeof(*packet);
if (packet->header & FLAG_EXTENSION) {
dataOffset += 4; // 2 additional fields