From cca7df6c25921914dc9a307aadbcd746b8d3fd1b Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 17 Nov 2013 16:50:45 -0500 Subject: [PATCH] Reassemble AVC NALs when padding is reached, rather than waiting through several packets until the next AVC frame start NAL. Improves video latency and vulnerability to packet loss. --- .../nvstream/av/video/AvVideoDepacketizer.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/com/limelight/nvstream/av/video/AvVideoDepacketizer.java b/src/com/limelight/nvstream/av/video/AvVideoDepacketizer.java index 7ad0d199..db1d6b01 100644 --- a/src/com/limelight/nvstream/av/video/AvVideoDepacketizer.java +++ b/src/com/limelight/nvstream/av/video/AvVideoDepacketizer.java @@ -168,9 +168,16 @@ public class AvVideoDepacketizer { } else { - // Not either sequence we want + // Check if this is padding after a full AVC frame + if (currentlyDecoding == AvDecodeUnit.TYPE_H264 && + NAL.isPadding(specialSeq)) { + // The decode unit is complete + reassembleAvcNal(); + } + + // Not decoding AVC currentlyDecoding = AvDecodeUnit.TYPE_UNKNOWN; - + // Just skip this byte location.length--; location.offset++;