fix typos and comment formatting

This commit is contained in:
ReenigneArcher
2022-08-28 16:42:00 -04:00
parent f7d4f49809
commit 58ed5ba3ce
34 changed files with 73 additions and 128 deletions

View File

@@ -135,7 +135,7 @@ void capture(safe::mail_t mail, config_t config, void *channel_data) {
return; return;
} }
// Order of priorty: // Order of priority:
// 1. Config // 1. Config
// 2. Virtual if available // 2. Virtual if available
// 3. Host // 3. Host

View File

@@ -105,14 +105,14 @@ enum quality_e : int {
enum class rc_hevc_e : int { enum class rc_hevc_e : int {
constqp, /**< Constant QP mode */ constqp, /**< Constant QP mode */
vbr_latency, /**< Latency Constrained Variable Bitrate */ vbr_latency, /**< Latency Constrained Variable Bitrate */
vbr_peak, /**< Peak Contrained Variable Bitrate */ vbr_peak, /**< Peak Constrained Variable Bitrate */
cbr, /**< Constant bitrate mode */ cbr, /**< Constant bitrate mode */
}; };
enum class rc_h264_e : int { enum class rc_h264_e : int {
constqp, /**< Constant QP mode */ constqp, /**< Constant QP mode */
cbr, /**< Constant bitrate mode */ cbr, /**< Constant bitrate mode */
vbr_peak, /**< Peak Contrained Variable Bitrate */ vbr_peak, /**< Peak Constrained Variable Bitrate */
vbr_latency, /**< Latency Constrained Variable Bitrate */ vbr_latency, /**< Latency Constrained Variable Bitrate */
}; };

View File

@@ -1,4 +1,3 @@
//
// Created by TheElixZammuto on 2021-05-09. // Created by TheElixZammuto on 2021-05-09.
// TODO: Authentication, better handling of routes common to nvhttp, cleanup // TODO: Authentication, better handling of routes common to nvhttp, cleanup
@@ -335,7 +334,7 @@ void saveApp(resp_https_t response, req_https_t request) {
apps_node.push_back(std::make_pair("", inputTree)); apps_node.push_back(std::make_pair("", inputTree));
} }
else { else {
//Unfortuantely Boost PT does not allow to directly edit the array, copy should do the trick // Unfortunately Boost PT does not allow to directly edit the array, copy should do the trick
pt::ptree newApps; pt::ptree newApps;
int i = 0; int i = 0;
for(const auto &kv : apps_node) { for(const auto &kv : apps_node) {
@@ -388,7 +387,7 @@ void deleteApp(resp_https_t response, req_https_t request) {
return; return;
} }
else { else {
//Unfortuantely Boost PT does not allow to directly edit the array, copy should do the trick // Unfortunately Boost PT does not allow to directly edit the array, copy should do the trick
pt::ptree newApps; pt::ptree newApps;
int i = 0; int i = 0;
for(const auto &kv : apps_node) { for(const auto &kv : apps_node) {

View File

@@ -1,6 +1,4 @@
//
// Created by loki on 6/3/19. // Created by loki on 6/3/19.
//
#ifndef SUNSHINE_CONFIGHTTP_H #ifndef SUNSHINE_CONFIGHTTP_H
#define SUNSHINE_CONFIGHTTP_H #define SUNSHINE_CONFIGHTTP_H

View File

@@ -1,6 +1,4 @@
//
// Created by loki on 5/31/19. // Created by loki on 5/31/19.
//
#include "crypto.h" #include "crypto.h"
#include <openssl/pem.h> #include <openssl/pem.h>

View File

@@ -1,6 +1,4 @@
//
// Created by loki on 6/1/19. // Created by loki on 6/1/19.
//
#ifndef SUNSHINE_CRYPTO_H #ifndef SUNSHINE_CRYPTO_H
#define SUNSHINE_CRYPTO_H #define SUNSHINE_CRYPTO_H

View File

@@ -44,7 +44,7 @@ int init() {
if(clean_slate) { if(clean_slate) {
unique_id = util::uuid_t::generate().string(); unique_id = util::uuid_t::generate().string();
auto dir = std::filesystem::temp_directory_path() / "Sushine"sv; auto dir = std::filesystem::temp_directory_path() / "Sunshine"sv;
config::nvhttp.cert = (dir / ("cert-"s + unique_id)).string(); config::nvhttp.cert = (dir / ("cert-"s + unique_id)).string();
config::nvhttp.pkey = (dir / ("pkey-"s + unique_id)).string(); config::nvhttp.pkey = (dir / ("pkey-"s + unique_id)).string();
} }

View File

@@ -1,6 +1,4 @@
//
// Created by loki on 6/20/19. // Created by loki on 6/20/19.
//
// define uint32_t for <moonlight-common-c/src/Input.h> // define uint32_t for <moonlight-common-c/src/Input.h>
#include <cstdint> #include <cstdint>
@@ -89,7 +87,7 @@ struct gamepad_t {
// When emulating the HOME button, we may need to artificially release the back button. // When emulating the HOME button, we may need to artificially release the back button.
// Afterwards, the gamepad state on sunshine won't match the state on Moonlight. // Afterwards, the gamepad state on sunshine won't match the state on Moonlight.
// To prevent Sunshine from sending erronious input data to the active application, // To prevent Sunshine from sending erroneous input data to the active application,
// Sunshine forces the button to be in a specific state until the gamepad state matches that of // Sunshine forces the button to be in a specific state until the gamepad state matches that of
// Moonlight once more. // Moonlight once more.
button_state_e back_button_state; button_state_e back_button_state;
@@ -316,11 +314,11 @@ void passthrough(std::shared_ptr<input_t> &input, PNV_MOUSE_BUTTON_PACKET packet
/*/ /*/
* When Moonlight sends mouse input through absolute coordinates, * When Moonlight sends mouse input through absolute coordinates,
* it's possible that BUTTON_RIGHT is pressed down immediately after releasing BUTTON_LEFT. * it's possible that BUTTON_RIGHT is pressed down immediately after releasing BUTTON_LEFT.
* As a result, Sunshine will left click on hyperlinks in the browser before right clicking * As a result, Sunshine will left-click on hyperlinks in the browser before right-clicking
* *
* This can be solved by delaying BUTTON_LEFT, however, any delay on input is undesirable during gaming * This can be solved by delaying BUTTON_LEFT, however, any delay on input is undesirable during gaming
* As a compromise, Sunshine will only put delays on BUTTON_LEFT when * As a compromise, Sunshine will only put delays on BUTTON_LEFT when
* absolute mouse coordinates have been send. * absolute mouse coordinates have been sent.
* *
* Try to make sure BUTTON_RIGHT gets called before BUTTON_LEFT is released. * Try to make sure BUTTON_RIGHT gets called before BUTTON_LEFT is released.
* *
@@ -428,7 +426,7 @@ void passthrough(std::shared_ptr<input_t> &input, PNV_KEYBOARD_PACKET packet) {
if(!pressed) { if(!pressed) {
if(!release) { if(!release) {
// A new key has been pressed down, we need to check for key combo's // A new key has been pressed down, we need to check for key combo's
// If a keycombo has been pressed down, don't pass it through // If a key-combo has been pressed down, don't pass it through
if(input->shortcutFlags == input_t::SHORTCUT && apply_shortcut(keyCode) > 0) { if(input->shortcutFlags == input_t::SHORTCUT && apply_shortcut(keyCode) > 0) {
return; return;
} }

View File

@@ -1,6 +1,4 @@
//
// Created by loki on 6/20/19. // Created by loki on 6/20/19.
//
#ifndef SUNSHINE_INPUT_H #ifndef SUNSHINE_INPUT_H
#define SUNSHINE_INPUT_H #define SUNSHINE_INPUT_H

View File

@@ -1,6 +1,4 @@
//
// Created by loki on 5/30/19. // Created by loki on 5/30/19.
//
#include "process.h" #include "process.h"

View File

@@ -1,6 +1,4 @@
//
// Created by loki on 12/22/19. // Created by loki on 12/22/19.
//
#ifndef SUNSHINE_MAIN_H #ifndef SUNSHINE_MAIN_H
#define SUNSHINE_MAIN_H #define SUNSHINE_MAIN_H

View File

@@ -1,6 +1,4 @@
//
// Created by loki on 12/27/19. // Created by loki on 12/27/19.
//
#include "network.h" #include "network.h"
#include "utility.h" #include "utility.h"

View File

@@ -1,6 +1,4 @@
//
// Created by loki on 12/27/19. // Created by loki on 12/27/19.
//
#ifndef SUNSHINE_NETWORK_H #ifndef SUNSHINE_NETWORK_H
#define SUNSHINE_NETWORK_H #define SUNSHINE_NETWORK_H

View File

@@ -1,6 +1,4 @@
//
// Created by loki on 6/3/19. // Created by loki on 6/3/19.
//
#define BOOST_BIND_GLOBAL_PLACEHOLDERS #define BOOST_BIND_GLOBAL_PLACEHOLDERS

View File

@@ -1,6 +1,4 @@
//
// Created by loki on 6/3/19. // Created by loki on 6/3/19.
//
#ifndef SUNSHINE_NVHTTP_H #ifndef SUNSHINE_NVHTTP_H
#define SUNSHINE_NVHTTP_H #define SUNSHINE_NVHTTP_H

View File

@@ -167,7 +167,7 @@ static std::uint32_t from_view(const std::string_view &string) {
_CONVERT("eDP"sv, eDP); _CONVERT("eDP"sv, eDP);
_CONVERT("DSI"sv, DSI); _CONVERT("DSI"sv, DSI);
BOOST_LOG(error) << "Unknown Monitor connector type ["sv << string << "]: Please report this to the Github issue tracker"sv; BOOST_LOG(error) << "Unknown Monitor connector type ["sv << string << "]: Please report this to the GitHub issue tracker"sv;
return DRM_MODE_CONNECTOR_Unknown; return DRM_MODE_CONNECTOR_Unknown;
} }

View File

@@ -1,6 +1,4 @@
//
// Created by loki on 12/14/19. // Created by loki on 12/14/19.
//
#define BOOST_BIND_GLOBAL_PLACEHOLDERS #define BOOST_BIND_GLOBAL_PLACEHOLDERS
@@ -47,7 +45,7 @@ int exe(const std::string &cmd, bp::environment &env, file_t &file, std::error_c
int proc_t::execute(int app_id) { int proc_t::execute(int app_id) {
if(!running() && _app_id != -1) { if(!running() && _app_id != -1) {
// previous process exited on it's own, reset _process_handle // previous process exited on its own, reset _process_handle
_process_handle = bp::group(); _process_handle = bp::group();
_app_id = -1; _app_id = -1;
@@ -193,9 +191,9 @@ std::vector<ctx_t> &proc_t::get_apps() {
return _apps; return _apps;
} }
/// Gets application image from application list. // Gets application image from application list.
/// Returns default image if image configuration is not set. // Returns default image if image configuration is not set.
/// returns http content-type header compatible image type // returns http content-type header compatible image type
std::string proc_t::get_app_image(int app_id) { std::string proc_t::get_app_image(int app_id) {
auto app_index = app_id - 1; auto app_index = app_id - 1;
if(app_index < 0 || app_index >= _apps.size()) { if(app_index < 0 || app_index >= _apps.size()) {

View File

@@ -1,6 +1,4 @@
//
// Created by loki on 12/14/19. // Created by loki on 12/14/19.
//
#ifndef SUNSHINE_PROCESS_H #ifndef SUNSHINE_PROCESS_H
#define SUNSHINE_PROCESS_H #define SUNSHINE_PROCESS_H

View File

@@ -1,6 +1,4 @@
//
// Created by loki on 2/2/20. // Created by loki on 2/2/20.
//
#define BOOST_BIND_GLOBAL_PLACEHOLDERS #define BOOST_BIND_GLOBAL_PLACEHOLDERS
@@ -123,7 +121,7 @@ public:
socket->read_payload(); socket->read_payload();
}); });
auto content_lenght = 0; auto content_length = 0;
for(auto option = req->options; option != nullptr; option = option->next) { for(auto option = req->options; option != nullptr; option = option->next) {
if("Content-length"sv == option->option) { if("Content-length"sv == option->option) {
BOOST_LOG(debug) << "Found Content-Length: "sv << option->content << " bytes"sv; BOOST_LOG(debug) << "Found Content-Length: "sv << option->content << " bytes"sv;
@@ -133,14 +131,14 @@ public:
std::string_view content { option->content }; std::string_view content { option->content };
auto begin = std::find_if(std::begin(content), std::end(content), [](auto ch) { return (bool)std::isdigit(ch); }); auto begin = std::find_if(std::begin(content), std::end(content), [](auto ch) { return (bool)std::isdigit(ch); });
content_lenght = util::from_chars(begin, std::end(content)); content_length = util::from_chars(begin, std::end(content));
break; break;
} }
} }
if(end - socket->crlf >= content_lenght) { if(end - socket->crlf >= content_length) {
if(end - socket->crlf > content_lenght) { if(end - socket->crlf > content_length) {
BOOST_LOG(warning) << "(end - socket->crlf) > content_lenght -- "sv << (std::size_t)(end - socket->crlf) << " > "sv << content_lenght; BOOST_LOG(warning) << "(end - socket->crlf) > content_length -- "sv << (std::size_t)(end - socket->crlf) << " > "sv << content_length;
} }
fg.disable(); fg.disable();
@@ -380,7 +378,7 @@ void launch_session_raise(launch_session_t launch_session) {
} }
int session_count() { int session_count() {
// Ensure session_count is up to date // Ensure session_count is up-to-date
server.clear(false); server.clear(false);
return server.session_count(); return server.session_count();

View File

@@ -1,6 +1,4 @@
//
// Created by loki on 2/2/20. // Created by loki on 2/2/20.
//
#ifndef SUNSHINE_RTSP_H #ifndef SUNSHINE_RTSP_H
#define SUNSHINE_RTSP_H #define SUNSHINE_RTSP_H

View File

@@ -1,6 +1,4 @@
//
// Created by loki on 6/5/19. // Created by loki on 6/5/19.
//
#include "process.h" #include "process.h"
@@ -240,8 +238,7 @@ struct broadcast_ctx_t {
udp::socket video_sock { io }; udp::socket video_sock { io };
udp::socket audio_sock { io }; udp::socket audio_sock { io };
// This is purely for adminitrative purposes. // This is purely for administrative purposes.
//
// It's possible two instances of Moonlight are behind a NAT. // It's possible two instances of Moonlight are behind a NAT.
// From Sunshine's point of view, the ip addresses are identical // From Sunshine's point of view, the ip addresses are identical
// We need some way to know what ports are already used for different streams // We need some way to know what ports are already used for different streams
@@ -767,7 +764,7 @@ void controlBroadcastThread(control_server_t *server) {
} }
// Let all remaining connections know the server is shutting down // Let all remaining connections know the server is shutting down
// reason: gracefull termination // reason: graceful termination
std::uint32_t reason = 0x80030023; std::uint32_t reason = 0x80030023;
control_terminate_t plaintext; control_terminate_t plaintext;
@@ -932,7 +929,7 @@ void videoBroadcastThread(udp::socket &sock) {
// With a fecpercentage of 255, if payload_new is broken up into more than a 100 data_shards // With a fecpercentage of 255, if payload_new is broken up into more than a 100 data_shards
// it will generate greater than DATA_SHARDS_MAX shards. // it will generate greater than DATA_SHARDS_MAX shards.
// Therefore, we start breaking the data up into three seperate fec blocks. // Therefore, we start breaking the data up into three separate fec blocks.
auto multi_fec_threshold = 90 * blocksize; auto multi_fec_threshold = 90 * blocksize;
// We can go up to 4 fec blocks, but 3 is plenty // We can go up to 4 fec blocks, but 3 is plenty

View File

@@ -1,6 +1,4 @@
//
// Created by loki on 6/5/19. // Created by loki on 6/5/19.
//
#ifndef SUNSHINE_STREAM_H #ifndef SUNSHINE_STREAM_H
#define SUNSHINE_STREAM_H #define SUNSHINE_STREAM_H

View File

@@ -1,6 +1,4 @@
//
// Created by loki on 16-4-19. // Created by loki on 16-4-19.
//
#ifndef SUNSHINE_SYNC_H #ifndef SUNSHINE_SYNC_H
#define SUNSHINE_SYNC_H #define SUNSHINE_SYNC_H
@@ -92,4 +90,4 @@ private:
} // namespace util } // namespace util
#endif //T_MAN_SYNC_H #endif // SUNSHINE_SYNC_H

View File

@@ -7,7 +7,7 @@
namespace util { namespace util {
/* /*
* Allow threads to execute unhindered * Allow threads to execute unhindered
* while keeping full controll over the threads. * while keeping full control over the threads.
*/ */
class ThreadPool : public TaskPool { class ThreadPool : public TaskPool {
public: public:

View File

@@ -1,6 +1,4 @@
//
// Created by loki on 6/10/19. // Created by loki on 6/10/19.
//
#ifndef SUNSHINE_THREAD_SAFE_H #ifndef SUNSHINE_THREAD_SAFE_H
#define SUNSHINE_THREAD_SAFE_H #define SUNSHINE_THREAD_SAFE_H
@@ -37,7 +35,7 @@ public:
_cv.notify_all(); _cv.notify_all();
} }
// pop and view shoud not be used interchangebly // pop and view shoud not be used interchangeably
status_t pop() { status_t pop() {
std::unique_lock ul { _lock }; std::unique_lock ul { _lock };
@@ -58,7 +56,7 @@ public:
return val; return val;
} }
// pop and view shoud not be used interchangebly // pop and view shoud not be used interchangeably
template<class Rep, class Period> template<class Rep, class Period>
status_t pop(std::chrono::duration<Rep, Period> delay) { status_t pop(std::chrono::duration<Rep, Period> delay) {
std::unique_lock ul { _lock }; std::unique_lock ul { _lock };
@@ -78,7 +76,7 @@ public:
return val; return val;
} }
// pop and view shoud not be used interchangebly // pop and view shoud not be used interchangeably
const status_t &view() { const status_t &view() {
std::unique_lock ul { _lock }; std::unique_lock ul { _lock };

View File

@@ -1,6 +1,4 @@
//
// Created by loki on 8-2-19. // Created by loki on 8-2-19.
//
#ifndef T_MAN_UUID_H #ifndef T_MAN_UUID_H
#define T_MAN_UUID_H #define T_MAN_UUID_H

View File

@@ -1,6 +1,4 @@
//
// Created by loki on 6/6/19. // Created by loki on 6/6/19.
//
#include <atomic> #include <atomic>
#include <bitset> #include <bitset>
@@ -225,7 +223,7 @@ public:
~swdevice_t() override {} ~swdevice_t() override {}
// Store ownsership when frame is hw_frame // Store ownership when frame is hw_frame
frame_t hw_frame; frame_t hw_frame;
frame_t sw_frame; frame_t sw_frame;
@@ -239,7 +237,7 @@ public:
enum flag_e { enum flag_e {
DEFAULT = 0x00, DEFAULT = 0x00,
PARALLEL_ENCODING = 0x01, PARALLEL_ENCODING = 0x01,
H264_ONLY = 0x02, // When HEVC is to heavy H264_ONLY = 0x02, // When HEVC is too heavy
LIMITED_GOP_SIZE = 0x04, // Some encoders don't like it when you have an infinite GOP_SIZE. *cough* VAAPI *cough* LIMITED_GOP_SIZE = 0x04, // Some encoders don't like it when you have an infinite GOP_SIZE. *cough* VAAPI *cough*
SINGLE_SLICE_ONLY = 0x08, // Never use multiple slices <-- Older intel iGPU's ruin it for everyone else :P SINGLE_SLICE_ONLY = 0x08, // Never use multiple slices <-- Older intel iGPU's ruin it for everyone else :P
}; };
@@ -1622,12 +1620,7 @@ retry:
} }
int init() { int init() {
BOOST_LOG(info) << "//////////////////////////////////////////////////////////////////"sv; BOOST_LOG(info) << "// Testing for available encoders, this may generate errors. You can safely ignore those errors. //"sv;
BOOST_LOG(info) << "// //"sv;
BOOST_LOG(info) << "// Testing for available encoders, this may generate errors. //"sv;
BOOST_LOG(info) << "// You can safely ignore those errors. //"sv;
BOOST_LOG(info) << "// //"sv;
BOOST_LOG(info) << "//////////////////////////////////////////////////////////////////"sv;
KITTY_WHILE_LOOP(auto pos = std::begin(encoders), pos != std::end(encoders), { KITTY_WHILE_LOOP(auto pos = std::begin(encoders), pos != std::end(encoders), {
if( if(
@@ -1643,11 +1636,7 @@ int init() {
}) })
BOOST_LOG(info); BOOST_LOG(info);
BOOST_LOG(info) << "//////////////////////////////////////////////////////////////"sv; BOOST_LOG(info) << "// Ignore any errors mentioned above, they are not relevant. //"sv;
BOOST_LOG(info) << "// //"sv;
BOOST_LOG(info) << "// Ignore any errors mentioned above, they are not relevant //"sv;
BOOST_LOG(info) << "// //"sv;
BOOST_LOG(info) << "//////////////////////////////////////////////////////////////"sv;
BOOST_LOG(info); BOOST_LOG(info);
if(encoders.empty()) { if(encoders.empty()) {

View File

@@ -1,6 +1,4 @@
//
// Created by loki on 6/9/19. // Created by loki on 6/9/19.
//
#ifndef SUNSHINE_VIDEO_H #ifndef SUNSHINE_VIDEO_H
#define SUNSHINE_VIDEO_H #define SUNSHINE_VIDEO_H