mirror of
https://github.com/moonlight-stream/moonlight-chrome.git
synced 2025-08-17 16:46:31 +00:00
now choosing video parameters makes a difference
This commit is contained in:
parent
8dfa196a13
commit
acfe4d8be6
@ -28,9 +28,8 @@
|
|||||||
<div class="mdl-select">
|
<div class="mdl-select">
|
||||||
<select id="selectResolution">
|
<select id="selectResolution">
|
||||||
<option selected="NONE">Stream Resolution</option>
|
<option selected="NONE">Stream Resolution</option>
|
||||||
<option value="720">1280x720</option>
|
<option value="1280:720">1280x720</option>
|
||||||
<option value="768">1366x768</option>
|
<option value="1920:1080">1920x1080</option>
|
||||||
<option value="1280">1920x1080</option>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="mdl-select">
|
<div class="mdl-select">
|
||||||
|
34
main.cpp
34
main.cpp
@ -135,11 +135,37 @@ void MoonlightInstance::HandleMessage(const pp::Var& var_message) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void split(const std::string& s, char c, std::vector<std::string>& v) {
|
||||||
|
std::string::size_type i = 0;
|
||||||
|
std::string::size_type j = s.find(c);
|
||||||
|
|
||||||
|
while (j != std::string::npos) {
|
||||||
|
v.push_back(s.substr(i, j-i));
|
||||||
|
i = ++j;
|
||||||
|
j = s.find(c, j);
|
||||||
|
|
||||||
|
if (j == std::string::npos) v.push_back(s.substr(i, s.length()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void MoonlightInstance::handleStartStream(std::string startStreamMessage) {
|
void MoonlightInstance::handleStartStream(std::string startStreamMessage) {
|
||||||
|
// request:host:width:height:fps:bitrate
|
||||||
|
std::vector<std::string> splitString;
|
||||||
|
split(startStreamMessage, ':', splitString);
|
||||||
|
|
||||||
|
pp::Var response("Setting stream width to: " + splitString.at(2));
|
||||||
|
PostMessage(response);
|
||||||
|
response = ("Setting stream height to: " + splitString.at(3));
|
||||||
|
PostMessage(response);
|
||||||
|
response = ("Setting stream fps to: " + splitString.at(4));
|
||||||
|
PostMessage(response);
|
||||||
|
response = ("Setting stream host to: " + splitString.at(1));
|
||||||
|
PostMessage(response);
|
||||||
// Populate the stream configuration
|
// Populate the stream configuration
|
||||||
m_StreamConfig.width = 1280;
|
m_StreamConfig.width = stoi(splitString.at(2));
|
||||||
m_StreamConfig.height = 720;
|
m_StreamConfig.height = stoi(splitString.at(3));
|
||||||
m_StreamConfig.fps = 60;
|
m_StreamConfig.fps = stoi(splitString.at(4));
|
||||||
m_StreamConfig.bitrate = 15000; // kilobits per second
|
m_StreamConfig.bitrate = 15000; // kilobits per second
|
||||||
m_StreamConfig.packetSize = 1024;
|
m_StreamConfig.packetSize = 1024;
|
||||||
m_StreamConfig.streamingRemotely = 0;
|
m_StreamConfig.streamingRemotely = 0;
|
||||||
@ -148,7 +174,7 @@ void MoonlightInstance::handleStartStream(std::string startStreamMessage) {
|
|||||||
m_ServerMajorVersion = 4;
|
m_ServerMajorVersion = 4;
|
||||||
|
|
||||||
// Store the host from the start message
|
// Store the host from the start message
|
||||||
m_Host = startStreamMessage.substr(strlen(MSG_START_REQUEST));
|
m_Host = splitString.at(1);
|
||||||
|
|
||||||
// Start the worker thread to establish the connection
|
// Start the worker thread to establish the connection
|
||||||
pthread_create(&m_ConnectionThread, NULL, MoonlightInstance::ConnectionThreadFunc, this);
|
pthread_create(&m_ConnectionThread, NULL, MoonlightInstance::ConnectionThreadFunc, this);
|
||||||
|
@ -63,7 +63,10 @@ function startPushed() {
|
|||||||
var e = document.getElementById("selectHost");
|
var e = document.getElementById("selectHost");
|
||||||
target = e.options[e.selectedIndex].value;
|
target = e.options[e.selectedIndex].value;
|
||||||
}
|
}
|
||||||
common.naclModule.postMessage('startRequest:' + target);
|
var frameRate = document.getElementById('selectFramerate').value;
|
||||||
|
var resolution = document.getElementById('selectResolution').value;
|
||||||
|
console.log('startRequest:' + target + ":" + resolution + ":" + frameRate);
|
||||||
|
common.naclModule.postMessage('startRequest:' + target + ":" + resolution + ":" + frameRate + ":");
|
||||||
// we just finished the gameSelection section. only expose the NaCl section
|
// we just finished the gameSelection section. only expose the NaCl section
|
||||||
playGameMode();
|
playGameMode();
|
||||||
}
|
}
|
||||||
@ -133,7 +136,7 @@ function readData(key, callbackFunction) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function loadResolution(previousValue) {
|
function loadResolution(previousValue) {
|
||||||
document.getElementById('selectResolution').value = previousValue.resolution != null ? previousValue.resolution : '720';
|
document.getElementById('selectResolution').value = previousValue.resolution != null ? previousValue.resolution : '1280:720';
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveResolution() {
|
function saveResolution() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user