mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2024-12-16 22:23:07 +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,12 +187,14 @@ NvHTTP::getServerInfo(NvLogLevel logLevel, bool fastFail)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
NvHTTP::launchApp(int appId,
|
NvHTTP::startApp(QString verb,
|
||||||
PSTREAM_CONFIGURATION streamConfig,
|
bool isGfe,
|
||||||
bool sops,
|
int appId,
|
||||||
bool localAudio,
|
PSTREAM_CONFIGURATION streamConfig,
|
||||||
int gamepadMask,
|
bool sops,
|
||||||
QString& rtspSessionUrl)
|
bool localAudio,
|
||||||
|
int gamepadMask,
|
||||||
|
QString& rtspSessionUrl)
|
||||||
{
|
{
|
||||||
int riKeyId;
|
int riKeyId;
|
||||||
|
|
||||||
|
@ -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,16 +162,14 @@ public:
|
||||||
quitApp();
|
quitApp();
|
||||||
|
|
||||||
void
|
void
|
||||||
resumeApp(PSTREAM_CONFIGURATION streamConfig,
|
startApp(QString verb,
|
||||||
QString& rtspSessionUrl);
|
bool isGfe,
|
||||||
|
int appId,
|
||||||
void
|
PSTREAM_CONFIGURATION streamConfig,
|
||||||
launchApp(int appId,
|
bool sops,
|
||||||
PSTREAM_CONFIGURATION streamConfig,
|
bool localAudio,
|
||||||
bool sops,
|
int gamepadMask,
|
||||||
bool localAudio,
|
QString& rtspSessionUrl);
|
||||||
int gamepadMask,
|
|
||||||
QString& rtspSessionUrl);
|
|
||||||
|
|
||||||
QVector<NvApp>
|
QVector<NvApp>
|
||||||
getAppList();
|
getAppList();
|
||||||
|
|
|
@ -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 {
|
enableGameOptimizations,
|
||||||
http.launchApp(m_App.id, &m_StreamConfig,
|
m_Preferences->playAudioOnHost,
|
||||||
enableGameOptimizations,
|
m_InputHandler->getAttachedGamepadMask(),
|
||||||
m_Preferences->playAudioOnHost,
|
rtspSessionUrl);
|
||||||
m_InputHandler->getAttachedGamepadMask(),
|
|
||||||
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