From b796b496dde912de685028398c09b2b9992f24c2 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 10 Mar 2016 22:37:26 -0800 Subject: [PATCH] Use the server major version pulled from serverinfo when starting a stream --- main.cpp | 5 ++++- static/js/index.js | 2 +- static/js/utils.js | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index 7b3e0da..d8e72aa 100644 --- a/main.cpp +++ b/main.cpp @@ -156,6 +156,7 @@ void MoonlightInstance::HandleStartStream(int32_t callbackId, pp::VarArray args) std::string height = args.Get(2).AsString(); std::string fps = args.Get(3).AsString(); std::string bitrate = args.Get(4).AsString(); + std::string serverMajorVersion = args.Get(5).AsString(); pp::Var response("Setting stream width to: " + width); PostMessage(response); @@ -167,6 +168,8 @@ void MoonlightInstance::HandleStartStream(int32_t callbackId, pp::VarArray args) PostMessage(response); response = ("Setting stream bitrate to: " + bitrate); PostMessage(response); + response = ("Setting server major version to: " + serverMajorVersion); + PostMessage(response); // Populate the stream configuration m_StreamConfig.width = stoi(width); @@ -177,7 +180,7 @@ void MoonlightInstance::HandleStartStream(int32_t callbackId, pp::VarArray args) m_StreamConfig.streamingRemotely = 0; m_StreamConfig.audioConfiguration = AUDIO_CONFIGURATION_STEREO; - m_ServerMajorVersion = 5; + m_ServerMajorVersion = stoi(serverMajorVersion); // Initialize the rendering surface before starting the connection InitializeRenderingSurface(m_StreamConfig.width, m_StreamConfig.height); diff --git a/static/js/index.js b/static/js/index.js index 799873a..17f7cda 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -112,7 +112,7 @@ function startPushed() { api.init().then(function (ret) { if (api.currentGame != 0) { api.resumeApp('00000000000000000000000000000000', 0).then(function (ret) { - sendMessage('startRequest', [target, streamWidth, streamHeight, frameRate, bitrate.toString()]); + sendMessage('startRequest', [target, streamWidth, streamHeight, frameRate, bitrate.toString(), api.serverMajorVersion.toString()]); }); } }); diff --git a/static/js/utils.js b/static/js/utils.js index fd075ac..050efcf 100644 --- a/static/js/utils.js +++ b/static/js/utils.js @@ -41,6 +41,7 @@ NvHTTP.prototype = { if($root.attr("status_code") == 200) { _self.paired = $root.find("PairStatus").text().trim() == 1; _self.currentGame = parseInt($root.find("currentgame").text().trim(), 10); + _self.serverMajorVersion = parseInt($root.find("appversion").text().trim().substring(0, 1), 10); } }); },