Add separate LC_ASSERT_VT() for asserts that only apply for valid traffic

This commit is contained in:
Cameron Gutman committed 2023-10-11 20:01:39 -05:00
1 parent 574ad6e676
commit 620b4be477
7 files changed
+89 -74

No files matched your search

+5 -5
View File
@@ -197,14 +197,14 @@ static void decodeInputData(PQUEUED_AUDIO_PACKET packet) {
(unsigned char*)(rtp + 1), dataLength,
decryptedOpusData, &dataLength)) {
Limelog("Failed to decrypt audio packet (sequence number: %u)\n", rtp->sequenceNumber);
LC_ASSERT(false);
LC_ASSERT_VT(false);
return;
}
#ifdef LC_DEBUG
if (opusHeaderByte == INVALID_OPUS_HEADER) {
opusHeaderByte = decryptedOpusData[0];
LC_ASSERT(opusHeaderByte != INVALID_OPUS_HEADER);
LC_ASSERT_VT(opusHeaderByte != INVALID_OPUS_HEADER);
}
else {
// Opus header should stay constant for the entire stream.
@@ -212,7 +212,7 @@ static void decodeInputData(PQUEUED_AUDIO_PACKET packet) {
// incorrectly recovered a data shard or the decryption
// of the audio packet failed. Sunshine violates this for
// surround sound in some cases, so just ignore it.
LC_ASSERT(decryptedOpusData[0] == opusHeaderByte || IS_SUNSHINE());
LC_ASSERT_VT(decryptedOpusData[0] == opusHeaderByte || IS_SUNSHINE());
}
#endif
@@ -222,13 +222,13 @@ static void decodeInputData(PQUEUED_AUDIO_PACKET packet) {
#ifdef LC_DEBUG
if (opusHeaderByte == INVALID_OPUS_HEADER) {
opusHeaderByte = ((uint8_t*)(rtp + 1))[0];
LC_ASSERT(opusHeaderByte != INVALID_OPUS_HEADER);
LC_ASSERT_VT(opusHeaderByte != INVALID_OPUS_HEADER);
}
else {
// Opus header should stay constant for the entire stream.
// If it doesn't, it may indicate that the RtpAudioQueue
// incorrectly recovered a data shard.
LC_ASSERT(((uint8_t*)(rtp + 1))[0] == opusHeaderByte);
LC_ASSERT_VT(((uint8_t*)(rtp + 1))[0] == opusHeaderByte);
}
#endif