From dbf81dcb63d90ed7cd239298a96c5ddc2c8f3c02 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Wed, 28 Oct 2020 20:35:45 -0500 Subject: [PATCH] Don't enable QoS for remote IPv4 streams Some broken routers/CPE will drop all QoS tagged packets --- src/SdpGenerator.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/SdpGenerator.c b/src/SdpGenerator.c index f5e4248..8e551c2 100644 --- a/src/SdpGenerator.c +++ b/src/SdpGenerator.c @@ -246,9 +246,20 @@ static PSDP_OPTION getAttributesList(char*urlSafeAddr) { err |= addAttributeString(&optionHead, "x-nv-vqos[0].videoQualityScoreUpdateTime", "5000"); - // Enable DSCP marking to hopefully increase QoS priority - err |= addAttributeString(&optionHead, "x-nv-vqos[0].qosTrafficType", "5"); - err |= addAttributeString(&optionHead, "x-nv-aqos.qosTrafficType", "4"); + // If the remote host is local (RFC 1918) or IPv6 (where it's hard to tell based on the address + // alone), enable QoS tagging for our traffic. Windows qWave will disable it if the host is + // off-link, *however* Windows may get it wrong in cases where the host is directly connected + // to the Internet without a NAT. In this case, it may send DSCP marked traffic off-link and + // it could lead to black holes due to misconfigured ISP hardware or CPE. For this reason, + // we only enable it in cases where it looks like it will work. + if (StreamConfig.streamingRemotely == STREAM_CFG_LOCAL || RemoteAddr.ss_family == AF_INET6) { + err |= addAttributeString(&optionHead, "x-nv-vqos[0].qosTrafficType", "5"); + err |= addAttributeString(&optionHead, "x-nv-aqos.qosTrafficType", "4"); + } + else { + err |= addAttributeString(&optionHead, "x-nv-vqos[0].qosTrafficType", "0"); + err |= addAttributeString(&optionHead, "x-nv-aqos.qosTrafficType", "0"); + } if (AppVersionQuad[0] == 3) { err |= addGen3Options(&optionHead, urlSafeAddr);