mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2025-08-17 17:05:50 +00:00
Avoid spurious audio data loss warning on connection start
This commit is contained in:
parent
ef33aaa3c8
commit
a8aed6b344
@ -167,6 +167,15 @@ static PRTPA_FEC_BLOCK getFecBlockForRtpPacket(PRTP_AUDIO_QUEUE queue, PRTP_PACK
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Synchronize the nextRtpSequenceNumber and oldestRtpBaseSequenceNumber values
|
||||
// when the connection begins. Start on the next FEC block boundary, so we can
|
||||
// be sure we aren't starting in the middle (which will lead to a spurious audio
|
||||
// data block recovery warning on connection start if we miss more than 2 packets).
|
||||
if (queue->nextRtpSequenceNumber == UINT16_MAX && queue->oldestRtpBaseSequenceNumber == 0) {
|
||||
queue->nextRtpSequenceNumber = queue->oldestRtpBaseSequenceNumber = fecBlockBaseSeqNum + RTPA_DATA_SHARDS;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Drop packets from FEC blocks that have already been completed
|
||||
if (isBefore16(fecBlockBaseSeqNum, queue->oldestRtpBaseSequenceNumber)) {
|
||||
return NULL;
|
||||
@ -390,13 +399,6 @@ int RtpaAddPacket(PRTP_AUDIO_QUEUE queue, PRTP_PACKET packet, uint16_t length) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Synchronize the nextRtpSequenceNumber and oldestRtpBaseSequenceNumber values
|
||||
// when the connection begins. We want to always start on FEC block boundaries.
|
||||
if (queue->nextRtpSequenceNumber == UINT16_MAX && queue->oldestRtpBaseSequenceNumber == 0) {
|
||||
queue->nextRtpSequenceNumber = queue->oldestRtpBaseSequenceNumber = fecBlock->fecHeader.baseSequenceNumber;
|
||||
validateFecBlockState(queue);
|
||||
}
|
||||
|
||||
if (packet->packetType == 97) {
|
||||
uint16_t pos = packet->sequenceNumber - fecBlock->fecHeader.baseSequenceNumber;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user