From a5961dd9b539aee68a708c421a115131c2c1d61f Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Wed, 21 Nov 2018 21:03:08 -0800 Subject: [PATCH] Use lower MTU for remote streaming and higher MTU for local networks --- Limelight/Stream/Connection.m | 24 +++++++++--------------- moonlight-common/moonlight-common-c | 2 +- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/Limelight/Stream/Connection.m b/Limelight/Stream/Connection.m index 3d0d1483..2e6e5c38 100644 --- a/Limelight/Stream/Connection.m +++ b/Limelight/Stream/Connection.m @@ -298,9 +298,17 @@ void ClLogMessage(const char* format, ...) _streamConfig.height = config.height; _streamConfig.fps = config.frameRate; _streamConfig.bitrate = config.bitRate; - _streamConfig.streamingRemotely = config.streamingRemotely; _streamConfig.enableHdr = config.enableHdr; + // Use some of the HEVC encoding efficiency improvements to + // reduce bandwidth usage while still gaining some image + // quality improvement. + _streamConfig.hevcBitratePercentageMultiplier = 75; + + // Detect remote streaming automatically based on the IP address of the target + _streamConfig.streamingRemotely = STREAM_CFG_AUTO; + _streamConfig.packetSize = 1392; + switch (config.audioChannelCount) { case 2: _streamConfig.audioConfiguration = AUDIO_CONFIGURATION_STEREO; @@ -337,20 +345,6 @@ void ClLogMessage(const char* format, ...) // HEVC must be supported when HDR is enabled assert(!_streamConfig.enableHdr || _streamConfig.supportsHevc); - - // Use some of the HEVC encoding efficiency improvements to - // reduce bandwidth usage while still gaining some image - // quality improvement. - if (config.streamingRemotely) { - // In the case of remotely streaming, we want the best possible qualtity for a limited bandwidth, so we set the multiplier to 0 - _streamConfig.hevcBitratePercentageMultiplier = 0; - // When streaming remotely we want to use a packet size of 1024 - _streamConfig.packetSize = 1024; - } - else { - _streamConfig.hevcBitratePercentageMultiplier = 75; - _streamConfig.packetSize = 1292; - } memcpy(_streamConfig.remoteInputAesKey, [config.riKey bytes], [config.riKey length]); memset(_streamConfig.remoteInputAesIv, 0, 16); diff --git a/moonlight-common/moonlight-common-c b/moonlight-common/moonlight-common-c index 396b02a9..639ff18d 160000 --- a/moonlight-common/moonlight-common-c +++ b/moonlight-common/moonlight-common-c @@ -1 +1 @@ -Subproject commit 396b02a94db4db291524a867106464357db1fdac +Subproject commit 639ff18dbbcde35ca918c2e898e20bd2a624fdc5