From 298f356acbb57f56863680d41c0d307a2fd5cb91 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 14 Jan 2024 18:42:41 -0600 Subject: [PATCH] Adjust the requested packet size to account for the encryption header --- src/SdpGenerator.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/SdpGenerator.c b/src/SdpGenerator.c index 831856c..dc1c621 100644 --- a/src/SdpGenerator.c +++ b/src/SdpGenerator.c @@ -311,6 +311,12 @@ static PSDP_OPTION getAttributesList(char*urlSafeAddr) { snprintf(payloadStr, sizeof(payloadStr), "%d", StreamConfig.fps); err |= addAttributeString(&optionHead, "x-nv-video[0].maxFPS", payloadStr); + // Adjust the video packet size to account for encryption overhead + if (EncryptionFeaturesEnabled & SS_ENC_VIDEO) { + LC_ASSERT(StreamConfig.packetSize % 16 == 0); + StreamConfig.packetSize -= sizeof(ENC_VIDEO_HEADER); + LC_ASSERT(StreamConfig.packetSize % 16 == 0); + } snprintf(payloadStr, sizeof(payloadStr), "%d", StreamConfig.packetSize); err |= addAttributeString(&optionHead, "x-nv-video[0].packetSize", payloadStr);