From 777b5c57deb0e03333bacd5ca7bbe9b7acf032a8 Mon Sep 17 00:00:00 2001 From: Lauri Kasanen Date: Tue, 22 Jun 2021 13:03:29 +0300 Subject: [PATCH] Fix NAL parsing logic --- common/rfb/TightX264Encoder.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/rfb/TightX264Encoder.cxx b/common/rfb/TightX264Encoder.cxx index c1d90f4..2c20486 100644 --- a/common/rfb/TightX264Encoder.cxx +++ b/common/rfb/TightX264Encoder.cxx @@ -201,10 +201,10 @@ void TightX264Encoder::writeRect(const PixelBuffer* pb, const Palette& palette) if (!next) break; - nalstarts[i_nals] = next + 3; + remlen -= (next + 3) - nalptr; + nalptr = nalstarts[i_nals] = next + 3; - nalptr += 4; // 3 prefix, 1 type - remlen -= 4; + i_nals++; }; // Lens