mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2025-08-18 09:25:49 +00:00
Leave the zero padding bytes on FEC-recovered packets alone. Decoders are required to cope with trailing zero bytes in NALUs and they are not safe to remove because they may actually be part of the byte stream itself.
This commit is contained in:
parent
417c8be124
commit
20821e7eb6
@ -141,14 +141,12 @@ cleanup_packets:
|
||||
PNV_VIDEO_PACKET nvPacket = (PNV_VIDEO_PACKET)(((char*)rtpPacket) + dataOffset);
|
||||
nvPacket->frameIndex = queue->currentFrameNumber;
|
||||
|
||||
//Remove padding of generated packet
|
||||
int size = StreamConfig.packetSize + dataOffset;
|
||||
if (rtpPacket->sequenceNumber == ushort(queue->bufferLowestSequenceNumber + queue->bufferDataPackets - 1)) {
|
||||
while (packets[i][size-1] == 0) {
|
||||
size--;
|
||||
}
|
||||
}
|
||||
// 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
|
||||
// it may be a legitimate part of the H.264 bytestream.
|
||||
|
||||
int size = StreamConfig.packetSize + dataOffset;
|
||||
memcpy(&packets[i][receiveSize], &size, sizeof(int));
|
||||
queuePacket(queue, queueEntry, 0, rtpPacket);
|
||||
} else if (packets[i] != NULL) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user