mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2024-11-10 13:44:17 +00:00
Add --packet-size command-line option
This commit is contained in:
parent
ee5c61fb74
commit
7aff148e9f
4 changed files with 33 additions and 9 deletions
|
@ -280,6 +280,7 @@ void StreamCommandLineParser::parse(const QStringList &args, StreamingPreference
|
|||
parser.addToggleOption("vsync", "V-Sync");
|
||||
parser.addValueOption("fps", "FPS");
|
||||
parser.addValueOption("bitrate", "bitrate in Kbps");
|
||||
parser.addValueOption("packet-size", "video packet size");
|
||||
parser.addChoiceOption("display-mode", "display mode", m_WindowModeMap.keys());
|
||||
parser.addChoiceOption("audio-config", "audio config", m_AudioConfigMap.keys());
|
||||
parser.addToggleOption("multi-controller", "multiple controller support");
|
||||
|
@ -345,6 +346,14 @@ void StreamCommandLineParser::parse(const QStringList &args, StreamingPreference
|
|||
preferences->width, preferences->height, preferences->fps);
|
||||
}
|
||||
|
||||
// Resolve --packet-size option
|
||||
if (parser.isSet("packet-size")) {
|
||||
preferences->packetSize = parser.getIntOption("packet-size");
|
||||
if (preferences->packetSize < 1024) {
|
||||
parser.showError("Packet size must be greater than 1024 bytes");
|
||||
}
|
||||
}
|
||||
|
||||
// Resolve --display option
|
||||
if (parser.isSet("display-mode")) {
|
||||
preferences->windowMode = mapValue(m_WindowModeMap, parser.getChoiceOptionValue("display-mode"));
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#define SER_RICHPRESENCE "richpresence"
|
||||
#define SER_GAMEPADMOUSE "gamepadmouse"
|
||||
#define SER_DEFAULTVER "defaultver"
|
||||
#define SER_PACKETSIZE "packetsize"
|
||||
|
||||
#define CURRENT_DEFAULT_VER 1
|
||||
|
||||
|
@ -64,6 +65,7 @@ void StreamingPreferences::reload()
|
|||
connectionWarnings = settings.value(SER_CONNWARNINGS, true).toBool();
|
||||
richPresence = settings.value(SER_RICHPRESENCE, true).toBool();
|
||||
gamepadMouse = settings.value(SER_GAMEPADMOUSE, true).toBool();
|
||||
packetSize = settings.value(SER_PACKETSIZE, 0).toInt();
|
||||
audioConfig = static_cast<AudioConfig>(settings.value(SER_AUDIOCFG,
|
||||
static_cast<int>(AudioConfig::AC_STEREO)).toInt());
|
||||
videoCodecConfig = static_cast<VideoCodecConfig>(settings.value(SER_VIDEOCFG,
|
||||
|
@ -107,6 +109,7 @@ void StreamingPreferences::save()
|
|||
settings.setValue(SER_CONNWARNINGS, connectionWarnings);
|
||||
settings.setValue(SER_RICHPRESENCE, richPresence);
|
||||
settings.setValue(SER_GAMEPADMOUSE, gamepadMouse);
|
||||
settings.setValue(SER_PACKETSIZE, packetSize);
|
||||
settings.setValue(SER_AUDIOCFG, static_cast<int>(audioConfig));
|
||||
settings.setValue(SER_VIDEOCFG, static_cast<int>(videoCodecConfig));
|
||||
settings.setValue(SER_VIDEODEC, static_cast<int>(videoDecoderSelection));
|
||||
|
|
|
@ -90,6 +90,7 @@ public:
|
|||
bool connectionWarnings;
|
||||
bool richPresence;
|
||||
bool gamepadMouse;
|
||||
int packetSize;
|
||||
AudioConfig audioConfig;
|
||||
VideoCodecConfig videoCodecConfig;
|
||||
VideoDecoderSelection videoDecoderSelection;
|
||||
|
|
|
@ -942,17 +942,28 @@ void Session::exec(int displayOriginX, int displayOriginY)
|
|||
hostInfo.serverInfoGfeVersion = siGfeVersion.data();
|
||||
}
|
||||
|
||||
// isReachableOverVpn() does network I/O, so we only attempt to check
|
||||
// VPN reachability if we've already contacted the PC successfully
|
||||
if (m_Computer->isReachableOverVpn()) {
|
||||
// It looks like our route to this PC is over a VPN.
|
||||
// Treat it as remote even if the target address is in RFC 1918 address space.
|
||||
m_StreamConfig.streamingRemotely = STREAM_CFG_REMOTE;
|
||||
m_StreamConfig.packetSize = 1024;
|
||||
if (m_Preferences->packetSize != 0) {
|
||||
// Override default packet size and remote streaming detection
|
||||
// NB: Using STREAM_CFG_AUTO will cap our packet size at 1024 for remote hosts.
|
||||
m_StreamConfig.streamingRemotely = STREAM_CFG_LOCAL;
|
||||
m_StreamConfig.packetSize = m_Preferences->packetSize;
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Using custom packet size: %d bytes",
|
||||
m_Preferences->packetSize);
|
||||
}
|
||||
else {
|
||||
m_StreamConfig.streamingRemotely = STREAM_CFG_AUTO;
|
||||
m_StreamConfig.packetSize = 1392;
|
||||
// isReachableOverVpn() does network I/O, so we only attempt to check
|
||||
// VPN reachability if we've already contacted the PC successfully
|
||||
if (m_Computer->isReachableOverVpn()) {
|
||||
// It looks like our route to this PC is over a VPN.
|
||||
// Treat it as remote even if the target address is in RFC 1918 address space.
|
||||
m_StreamConfig.streamingRemotely = STREAM_CFG_REMOTE;
|
||||
m_StreamConfig.packetSize = 1024;
|
||||
}
|
||||
else {
|
||||
m_StreamConfig.streamingRemotely = STREAM_CFG_AUTO;
|
||||
m_StreamConfig.packetSize = 1392;
|
||||
}
|
||||
}
|
||||
|
||||
int err = LiStartConnection(&hostInfo, &m_StreamConfig, &k_ConnCallbacks,
|
||||
|
|
Loading…
Reference in a new issue