From 6a695d2c72146e553d73c82ee1cf51b68f9d5969 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 11 Jan 2014 14:27:46 -0500 Subject: [PATCH] Fix H264 decoding artifacts when a frame has fewer than 3 bytes of padding at the end --- .../limelight/nvstream/av/video/VideoDepacketizer.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/moonlight-common/src/com/limelight/nvstream/av/video/VideoDepacketizer.java b/moonlight-common/src/com/limelight/nvstream/av/video/VideoDepacketizer.java index 8cfdba5a..61d8a1d2 100644 --- a/moonlight-common/src/com/limelight/nvstream/av/video/VideoDepacketizer.java +++ b/moonlight-common/src/com/limelight/nvstream/av/video/VideoDepacketizer.java @@ -107,6 +107,15 @@ public class VideoDepacketizer { { ByteBufferDescriptor location = packet.getNewPayloadDescriptor(); + if (location.length == 968) { + if (packet.getPacketIndex() < packet.getTotalPackets()) { + location.length = packet.getPayloadLength(); + } + else { + return; + } + } + while (location.length != 0) { // Remember the start of the NAL data in this packet