mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2025-08-18 01:15:46 +00:00
Assert that recovered packets are valid
This commit is contained in:
parent
ea0f06ded0
commit
ddab05c56e
@ -160,6 +160,18 @@ cleanup_packets:
|
||||
PNV_VIDEO_PACKET nvPacket = (PNV_VIDEO_PACKET)(((char*)rtpPacket) + dataOffset);
|
||||
nvPacket->frameIndex = queue->currentFrameNumber;
|
||||
|
||||
// Do some rudamentary checks to see that the recovered packet is sane
|
||||
if (i == 0) {
|
||||
LC_ASSERT(nvPacket->flags & FLAG_SOF);
|
||||
}
|
||||
if (i == queue->bufferDataPackets - 1) {
|
||||
LC_ASSERT(nvPacket->flags & FLAG_EOF);
|
||||
}
|
||||
if (i > 0 && i < queue->bufferDataPackets - 1) {
|
||||
LC_ASSERT(nvPacket->flags & FLAG_CONTAINS_PIC_DATA);
|
||||
}
|
||||
LC_ASSERT((nvPacket->flags & ~(FLAG_SOF | FLAG_EOF | FLAG_CONTAINS_PIC_DATA)) == 0);
|
||||
|
||||
// FEC recovered frames may have extra zero padding at the end. This is
|
||||
// fine per H.264 Annex B which states trailing zero bytes must be
|
||||
// discarded by decoders. It's not safe to strip all zero padding because
|
||||
|
@ -467,6 +467,8 @@ void processRtpPayload(PNV_VIDEO_PACKET videoPacket, int length, unsigned long l
|
||||
flags = videoPacket->flags;
|
||||
firstPacket = isFirstPacket(flags);
|
||||
|
||||
LC_ASSERT((flags & ~(FLAG_SOF | FLAG_EOF | FLAG_CONTAINS_PIC_DATA)) == 0);
|
||||
|
||||
streamPacketIndex = videoPacket->streamPacketIndex;
|
||||
|
||||
// The packets and frames must be in sequence from the FEC queue
|
||||
|
Loading…
x
Reference in New Issue
Block a user