mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2024-12-17 14:43:09 +00:00
Consolidate launch and resume and skip FPS hack for Sunshine
This commit is contained in:
parent
5de29928cd
commit
80659160d3
3 changed files with 26 additions and 53 deletions
|
@ -187,7 +187,9 @@ NvHTTP::getServerInfo(NvLogLevel logLevel, bool fastFail)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
NvHTTP::launchApp(int appId,
|
NvHTTP::startApp(QString verb,
|
||||||
|
bool isGfe,
|
||||||
|
int appId,
|
||||||
PSTREAM_CONFIGURATION streamConfig,
|
PSTREAM_CONFIGURATION streamConfig,
|
||||||
bool sops,
|
bool sops,
|
||||||
bool localAudio,
|
bool localAudio,
|
||||||
|
@ -201,15 +203,15 @@ NvHTTP::launchApp(int appId,
|
||||||
|
|
||||||
QString response =
|
QString response =
|
||||||
openConnectionToString(m_BaseUrlHttps,
|
openConnectionToString(m_BaseUrlHttps,
|
||||||
"launch",
|
verb,
|
||||||
"appid="+QString::number(appId)+
|
"appid="+QString::number(appId)+
|
||||||
"&mode="+QString::number(streamConfig->width)+"x"+
|
"&mode="+QString::number(streamConfig->width)+"x"+
|
||||||
QString::number(streamConfig->height)+"x"+
|
QString::number(streamConfig->height)+"x"+
|
||||||
// Using an FPS value over 60 causes SOPS to default to 720p60,
|
// Using an FPS value over 60 causes SOPS to default to 720p60,
|
||||||
// so force it to 0 to ensure the correct resolution is set. We
|
// so force it to 0 to ensure the correct resolution is set. We
|
||||||
// used to use 60 here but that locked the frame rate to 60 FPS
|
// used to use 60 here but that locked the frame rate to 60 FPS
|
||||||
// on GFE 3.20.3.
|
// on GFE 3.20.3. We don't need this hack for Sunshine.
|
||||||
QString::number(streamConfig->fps > 60 ? 0 : streamConfig->fps)+
|
QString::number((streamConfig->fps > 60 && isGfe) ? 0 : streamConfig->fps)+
|
||||||
"&additionalStates=1&sops="+QString::number(sops ? 1 : 0)+
|
"&additionalStates=1&sops="+QString::number(sops ? 1 : 0)+
|
||||||
"&rikey="+QByteArray(streamConfig->remoteInputAesKey, sizeof(streamConfig->remoteInputAesKey)).toHex()+
|
"&rikey="+QByteArray(streamConfig->remoteInputAesKey, sizeof(streamConfig->remoteInputAesKey)).toHex()+
|
||||||
"&rikeyid="+QString::number(riKeyId)+
|
"&rikeyid="+QString::number(riKeyId)+
|
||||||
|
@ -230,30 +232,6 @@ NvHTTP::launchApp(int appId,
|
||||||
rtspSessionUrl = getXmlString(response, "sessionUrl0");
|
rtspSessionUrl = getXmlString(response, "sessionUrl0");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
NvHTTP::resumeApp(PSTREAM_CONFIGURATION streamConfig, QString& rtspSessionUrl)
|
|
||||||
{
|
|
||||||
int riKeyId;
|
|
||||||
|
|
||||||
memcpy(&riKeyId, streamConfig->remoteInputAesIv, sizeof(riKeyId));
|
|
||||||
riKeyId = qFromBigEndian(riKeyId);
|
|
||||||
|
|
||||||
QString response =
|
|
||||||
openConnectionToString(m_BaseUrlHttps,
|
|
||||||
"resume",
|
|
||||||
"rikey="+QString(QByteArray(streamConfig->remoteInputAesKey, sizeof(streamConfig->remoteInputAesKey)).toHex())+
|
|
||||||
"&rikeyid="+QString::number(riKeyId)+
|
|
||||||
"&surroundAudioInfo="+QString::number(SURROUNDAUDIOINFO_FROM_AUDIO_CONFIGURATION(streamConfig->audioConfiguration)),
|
|
||||||
RESUME_TIMEOUT_MS);
|
|
||||||
|
|
||||||
qInfo() << "Resume response:" << response;
|
|
||||||
|
|
||||||
// Throws if the request failed
|
|
||||||
verifyResponseStatus(response);
|
|
||||||
|
|
||||||
rtspSessionUrl = getXmlString(response, "sessionUrl0");
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
NvHTTP::quitApp()
|
NvHTTP::quitApp()
|
||||||
{
|
{
|
||||||
|
|
|
@ -162,11 +162,9 @@ public:
|
||||||
quitApp();
|
quitApp();
|
||||||
|
|
||||||
void
|
void
|
||||||
resumeApp(PSTREAM_CONFIGURATION streamConfig,
|
startApp(QString verb,
|
||||||
QString& rtspSessionUrl);
|
bool isGfe,
|
||||||
|
int appId,
|
||||||
void
|
|
||||||
launchApp(int appId,
|
|
||||||
PSTREAM_CONFIGURATION streamConfig,
|
PSTREAM_CONFIGURATION streamConfig,
|
||||||
bool sops,
|
bool sops,
|
||||||
bool localAudio,
|
bool localAudio,
|
||||||
|
|
|
@ -1172,16 +1172,13 @@ bool Session::startConnectionAsync()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
NvHTTP http(m_Computer);
|
NvHTTP http(m_Computer);
|
||||||
if (m_Computer->currentGameId != 0) {
|
http.startApp(m_Computer->currentGameId != 0 ? "resume" : "launch",
|
||||||
http.resumeApp(&m_StreamConfig, rtspSessionUrl);
|
m_Computer->isNvidiaServerSoftware,
|
||||||
}
|
m_App.id, &m_StreamConfig,
|
||||||
else {
|
|
||||||
http.launchApp(m_App.id, &m_StreamConfig,
|
|
||||||
enableGameOptimizations,
|
enableGameOptimizations,
|
||||||
m_Preferences->playAudioOnHost,
|
m_Preferences->playAudioOnHost,
|
||||||
m_InputHandler->getAttachedGamepadMask(),
|
m_InputHandler->getAttachedGamepadMask(),
|
||||||
rtspSessionUrl);
|
rtspSessionUrl);
|
||||||
}
|
|
||||||
} catch (const GfeHttpResponseException& e) {
|
} catch (const GfeHttpResponseException& e) {
|
||||||
emit displayLaunchError(tr("GeForce Experience returned error: %1").arg(e.toQString()));
|
emit displayLaunchError(tr("GeForce Experience returned error: %1").arg(e.toQString()));
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue