merge from upstream

This commit is contained in:
pigeatgarlic 2024-04-21 10:09:11 +07:00
parent acbf446337
commit 90408bff2e
22 changed files with 227 additions and 87 deletions

View File

@ -8,6 +8,7 @@
!/.rstcheck.cfg
# ignore repo directories and files
docker/
gh-pages-template/
scripts/
tools/
@ -15,6 +16,7 @@ crowdin.yml
# ignore dev directories
build/
cmake-*/
venv/
# ignore artifacts

View File

@ -211,6 +211,7 @@ jobs:
then
echo "This is a PUSH event"
branch=${{ github.ref_name }}
build_version=${{ needs.check_changelog.outputs.next_version }}
commit=${{ github.sha }}
clone_url=${{ github.event.repository.clone_url }}
else
@ -227,6 +228,7 @@ jobs:
cd build
cmake -DGITHUB_CLONE_URL=${clone_url} \
-DBUILD_VERSION=${build_version} \
-DGITHUB_BRANCH=${branch} \
-DGITHUB_COMMIT=${commit} \
-DSUNSHINE_CONFIGURE_FLATPAK_MAN=ON \
@ -377,7 +379,7 @@ jobs:
- name: Build Linux
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
BUILD_VERSION: ${{ needs.check_changelog.outputs.next_version_bare }}
BUILD_VERSION: ${{ needs.check_changelog.outputs.next_version }}
COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
timeout-minutes: 5
run: |
@ -500,18 +502,24 @@ jobs:
run: |
${{ steps.python.outputs.python-path }} -m pip install gcovr
${{ steps.python.outputs.python-path }} -m gcovr -r .. \
--exclude ../tests/ \
--exclude ../third-party/ \
--exclude '.*tests/.*' \
--exclude '.*tests/.*' \
--xml-pretty \
-o coverage.xml
- name: Upload coverage
# any except canceled or skipped
if: always() && (steps.test_report.outcome == 'success')
uses: codecov/codecov-action@v3
if: >-
always() &&
(steps.test_report.outcome == 'success') &&
startsWith(github.repository, 'LizardByte/')
uses: codecov/codecov-action@v4
with:
disable_search: true
fail_ci_if_error: true
files: ./build/coverage.xml
flags: ${{ runner.os }}
token: ${{ secrets.CODECOV_TOKEN }}
- name: Create/Update GitHub Release
if: ${{ needs.setup_release.outputs.create_release == 'true' }}
@ -560,13 +568,16 @@ jobs:
if [ -z "$branch" ]
then
echo "This is a PUSH event"
build_version=${{ needs.check_changelog.outputs.next_version }}
clone_url=${{ github.event.repository.clone_url }}
branch="${{ github.ref_name }}"
commit=${{ github.sha }}
default_branch="${{ github.event.repository.default_branch }}"
else
echo "This is a PR event"
clone_url=${{ github.event.pull_request.head.repo.clone_url }}
branch="${{ github.event.pull_request.head.ref }}"
commit=${{ github.event.pull_request.head.sha }}
default_branch="${{ github.event.pull_request.head.repo.default_branch }}"
fi
echo "Branch: ${branch}"
@ -575,7 +586,9 @@ jobs:
mkdir build
cd build
cmake \
-DBUILD_VERSION="${build_version}" \
-DGITHUB_BRANCH="${branch}" \
-DGITHUB_COMMIT="${commit}" \
-DGITHUB_CLONE_URL="${clone_url}" \
-DGITHUB_DEFAULT_BRANCH="${default_branch}" \
-DSUNSHINE_CONFIGURE_HOMEBREW=ON \
@ -613,7 +626,7 @@ jobs:
echo "publish=${PUBLISH}" >> $GITHUB_OUTPUT
- name: Validate and Publish Homebrew Formula
uses: LizardByte/homebrew-release-action@v2024.314.134529
uses: LizardByte/homebrew-release-action@v2024.417.220943
with:
formula_file: ${{ github.workspace }}/homebrew/sunshine.rb
git_email: ${{ secrets.GH_BOT_EMAIL }}
@ -673,6 +686,8 @@ jobs:
if [ -z "$branch" ]
then
echo "This is a PUSH event"
branch="${{ github.ref_name }}"
build_version=${{ needs.check_changelog.outputs.next_version }}
commit=${{ github.sha }}
clone_url=${{ github.event.repository.clone_url }}
else
@ -686,6 +701,8 @@ jobs:
mkdir build
cd build
cmake \
-DBUILD_VERSION=${build_version} \
-DGITHUB_BRANCH=${branch} \
-DGITHUB_COMMIT=${commit} \
-DGITHUB_CLONE_URL=${clone_url} \
-DSUNSHINE_CONFIGURE_PORTFILE=ON \
@ -794,7 +811,6 @@ jobs:
done
- name: Run tests
if: always()
id: test
timeout-minutes: 10
run: |
@ -822,8 +838,8 @@ jobs:
cd ${build_dir}
${{ steps.python.outputs.python-path }} -m pip install gcovr
sudo ${{ steps.python.outputs.python-path }} -m gcovr -r ../${dir} \
--exclude ../${dir}/tests/ \
--exclude ../${dir}/third-party/ \
--exclude '.*${dir}/tests/.*' \
--exclude '.*${dir}/third-party/.*' \
--gcov-object-directory $(pwd) \
--verbose \
--xml-pretty \
@ -831,11 +847,17 @@ jobs:
- name: Upload coverage
# any except canceled or skipped
if: always() && (steps.test_report.outcome == 'success')
uses: codecov/codecov-action@v3
if: >-
always() &&
(steps.test_report.outcome == 'success') &&
startsWith(github.repository, 'LizardByte/')
uses: codecov/codecov-action@v4
with:
disable_search: true
fail_ci_if_error: false # todo: re-enable this when action is fixed
files: ./build/coverage.xml
flags: ${{ runner.os }}-${{ matrix.os_version }}
token: ${{ secrets.CODECOV_TOKEN }}
- name: Create/Update GitHub Release
if: ${{ needs.setup_release.outputs.create_release == 'true' && matrix.release }}
@ -1015,7 +1037,7 @@ jobs:
shell: msys2 {0}
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
BUILD_VERSION: ${{ needs.check_changelog.outputs.next_version_bare }}
BUILD_VERSION: ${{ needs.check_changelog.outputs.next_version }}
COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
run: |
mkdir build
@ -1060,18 +1082,24 @@ jobs:
run: |
${{ steps.python-path.outputs.python-path }} -m pip install gcovr
${{ steps.python-path.outputs.python-path }} -m gcovr -r .. \
--exclude ../tests/ \
--exclude ../third-party/ \
--exclude '.*tests/.*' \
--exclude '.*tests/.*' \
--xml-pretty \
-o coverage.xml
- name: Upload coverage
# any except canceled or skipped
if: always() && (steps.test_report.outcome == 'success')
uses: codecov/codecov-action@v3
if: >-
always() &&
(steps.test_report.outcome == 'success') &&
startsWith(github.repository, 'LizardByte/')
uses: codecov/codecov-action@v4
with:
disable_search: true
fail_ci_if_error: true
files: ./build/coverage.xml
flags: ${{ runner.os }}
token: ${{ secrets.CODECOV_TOKEN }}
- name: Package Windows Debug Info
working-directory: build

View File

@ -26,7 +26,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Autoapproving
uses: hmarr/auto-approve-action@v3
uses: hmarr/auto-approve-action@v4
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
@ -49,7 +49,7 @@ jobs:
steps:
- name: Automerging
uses: pascalgn/automerge-action@v0.15.6
uses: pascalgn/automerge-action@v0.16.3
env:
BASE_BRANCHES: nightly
GITHUB_TOKEN: ${{ secrets.GH_BOT_TOKEN }}

View File

@ -16,7 +16,7 @@ on:
- cron: '00 12 * * 0' # every Sunday at 12:00 UTC
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
@ -57,10 +57,25 @@ jobs:
console.log(`Remapping language: ${key} to ${remap_languages[key.toLowerCase()]}`)
key = remap_languages[key.toLowerCase()]
}
if (supported_languages.includes(key.toLowerCase()) &&
!matrix['include'].includes({"language": key.toLowerCase()})) {
if (supported_languages.includes(key.toLowerCase())) {
console.log(`Found supported language: ${key}`)
matrix['include'].push({"language": key.toLowerCase()})
let osList = ['ubuntu-latest'];
if (key.toLowerCase() === 'swift') {
osList = ['macos-latest'];
} else if (key.toLowerCase() === 'cpp') {
osList = ['macos-latest', 'ubuntu-latest', 'windows-latest'];
}
for (let os of osList) {
// set name for matrix
if (osList.length == 1) {
name = key.toLowerCase()
} else {
name = `${key.toLowerCase()}, ${os}`
}
// add to matrix
matrix['include'].push({"language": key.toLowerCase(), "os": os, "name": name})
}
}
}
@ -84,10 +99,15 @@ jobs:
}
analyze:
name: Analyze
name: Analyze (${{ matrix.name }})
if: ${{ needs.languages.outputs.continue == 'true' }}
defaults:
run:
shell: ${{ matrix.os == 'windows-latest' && 'msys2 {0}' || 'bash' }}
env:
GITHUB_CODEQL_BUILD: true
needs: [languages]
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
actions: read
@ -100,6 +120,7 @@ jobs:
steps:
- name: Maximize build space
if: runner.os == 'Linux'
uses: easimon/maximize-build-space@v8
with:
root-reserve-mb: 20480
@ -114,6 +135,12 @@ jobs:
with:
submodules: recursive
- name: Setup msys2
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
update: true
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
@ -129,16 +156,20 @@ jobs:
# Pre autobuild
# create a file named .codeql-prebuild-${{ matrix.language }}.sh in the root of your repository
# create a file named .codeql-build-${{ matrix.language }}.sh in the root of your repository
- name: Prebuild
id: prebuild
run: |
# check if .qodeql-prebuild-${{ matrix.language }}.sh exists
if [ -f "./.codeql-prebuild-${{ matrix.language }}.sh" ]; then
echo "Running .codeql-prebuild-${{ matrix.language }}.sh"
./.codeql-prebuild-${{ matrix.language }}.sh
# check if prebuild script exists
filename=".codeql-prebuild-${{ matrix.language }}-${{ runner.os }}.sh"
if [ -f "./${filename}" ]; then
echo "Running prebuild script: ${filename}"
./${filename}
fi
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
- name: Autobuild
if: steps.prebuild.outputs.skip_autobuild != 'true'
uses: github/codeql-action/autobuild@v3
- name: Perform CodeQL Analysis

View File

@ -55,7 +55,7 @@ jobs:
- name: Clang format lint
if: ${{ steps.find_files.outputs.found_files }}
uses: DoozyX/clang-format-lint-action@v0.16.2
uses: DoozyX/clang-format-lint-action@v0.17
with:
source: ${{ steps.find_files.outputs.found_files }}
extensions: 'cpp,h,m,mm'

View File

@ -51,7 +51,7 @@ jobs:
if: >-
(github.event_name == 'push' && github.ref == 'refs/heads/master') ||
(github.event_name == 'workflow_dispatch')
uses: actions-js/push@v1.4
uses: actions-js/push@v1.5
with:
github_token: ${{ secrets.GH_BOT_TOKEN }}
author_email: ${{ secrets.GH_BOT_EMAIL }}

43
.gitignore vendored
View File

@ -5,9 +5,48 @@ cmake-build*
.vs
*.swp
*.kdev4
# Prerequisites
*.d
.cache
.idea
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
# JetBrains IDE
.idea/
# VSCode IDE
.vscode/
# build directories
build/
cmake-*/
# npm
node_modules/

View File

@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.18)
# todo - set this conditionally
# todo - set version to 0.0.0 once confident in automated versioning
project(Sunshine VERSION 0.22.2
project(Sunshine VERSION 0.23.1
DESCRIPTION "Self-hosted game stream host for Moonlight"
HOMEPAGE_URL "https://app.lizardbyte.dev/Sunshine")
@ -29,6 +29,9 @@ include(${CMAKE_MODULE_PATH}/prep/build_version.cmake)
# cmake build flags
include(${CMAKE_MODULE_PATH}/prep/options.cmake)
# initial prep
include(${CMAKE_MODULE_PATH}/prep/init.cmake)
# configure special package files, such as sunshine.desktop, Flatpak manifest, Portfile , etc.
include(${CMAKE_MODULE_PATH}/prep/special_package_configuration.cmake)

View File

@ -8,10 +8,6 @@ if(${SUNSHINE_BUILD_APPIMAGE})
string(REPLACE "${CMAKE_INSTALL_PREFIX}" ".${CMAKE_INSTALL_PREFIX}" SUNSHINE_ASSETS_DIR_DEF ${SUNSHINE_ASSETS_DIR})
endif()
if(NOT DEFINED SUNSHINE_EXECUTABLE_PATH)
set(SUNSHINE_EXECUTABLE_PATH "sunshine")
endif()
# cuda
set(CUDA_FOUND OFF)
if(${SUNSHINE_ENABLE_CUDA})

View File

@ -121,24 +121,24 @@ namespace config {
};
enum class rc_av1_e : int {
cbr = AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_CBR,
cqp = AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_CONSTANT_QP,
vbr_latency = AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_LATENCY_CONSTRAINED_VBR,
vbr_peak = AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR,
cbr = AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_CBR
vbr_peak = AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR
};
enum class rc_hevc_e : int {
cbr = AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_CBR,
cqp = AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_CONSTANT_QP,
vbr_latency = AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_LATENCY_CONSTRAINED_VBR,
vbr_peak = AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR,
cbr = AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_CBR
vbr_peak = AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR
};
enum class rc_h264_e : int {
cbr = AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_CBR,
cqp = AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_CONSTANT_QP,
vbr_latency = AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_LATENCY_CONSTRAINED_VBR,
vbr_peak = AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR,
cbr = AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_CBR
vbr_peak = AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR
};
enum class usage_av1_e : int {
@ -173,41 +173,41 @@ namespace config {
template <class T>
std::optional<int>
quality_from_view(const std::string_view &quality_type) {
quality_from_view(const std::string_view &quality_type, const std::optional<int>(&original)) {
#define _CONVERT_(x) \
if (quality_type == #x##sv) return (int) T::x
_CONVERT_(balanced);
_CONVERT_(quality);
_CONVERT_(speed);
_CONVERT_(balanced);
#undef _CONVERT_
return std::nullopt;
return original;
}
template <class T>
std::optional<int>
rc_from_view(const std::string_view &rc) {
rc_from_view(const std::string_view &rc, const std::optional<int>(&original)) {
#define _CONVERT_(x) \
if (rc == #x##sv) return (int) T::x
_CONVERT_(cbr);
_CONVERT_(cqp);
_CONVERT_(vbr_latency);
_CONVERT_(vbr_peak);
_CONVERT_(cbr);
#undef _CONVERT_
return std::nullopt;
return original;
}
template <class T>
std::optional<int>
usage_from_view(const std::string_view &usage) {
usage_from_view(const std::string_view &usage, const std::optional<int>(&original)) {
#define _CONVERT_(x) \
if (usage == #x##sv) return (int) T::x
_CONVERT_(transcoding);
_CONVERT_(webcam);
_CONVERT_(lowlatency);
_CONVERT_(lowlatency_high_quality);
_CONVERT_(transcoding);
_CONVERT_(ultralowlatency);
_CONVERT_(webcam);
#undef _CONVERT_
return std::nullopt;
return original;
}
int
@ -216,7 +216,7 @@ namespace config {
if (coder == "cabac"sv || coder == "ac"sv) return cabac;
if (coder == "cavlc"sv || coder == "vlc"sv) return cavlc;
return -1;
return _auto;
}
} // namespace amd
@ -347,18 +347,18 @@ namespace config {
}, // qsv
{
(int) amd::quality_h264_e::balanced, // quality (h264)
(int) amd::quality_hevc_e::balanced, // quality (hevc)
(int) amd::quality_av1_e::balanced, // quality (av1)
(int) amd::rc_h264_e::cbr, // rate control (h264)
(int) amd::rc_hevc_e::cbr, // rate control (hevc)
(int) amd::rc_av1_e::cbr, // rate control (av1)
(int) amd::usage_h264_e::ultralowlatency, // usage (h264)
(int) amd::usage_hevc_e::ultralowlatency, // usage (hevc)
(int) amd::usage_av1_e::ultralowlatency, // usage (av1)
(int) amd::rc_h264_e::vbr_latency, // rate control (h264)
(int) amd::rc_hevc_e::vbr_latency, // rate control (hevc)
(int) amd::rc_av1_e::vbr_latency, // rate control (av1)
0, // enforce_hrd
(int) amd::quality_h264_e::balanced, // quality (h264)
(int) amd::quality_hevc_e::balanced, // quality (hevc)
(int) amd::quality_av1_e::balanced, // quality (av1)
0, // preanalysis
1, // vbaq
1, // enforce_hrd
(int) amd::coder_e::_auto, // coder
}, // amd

View File

@ -48,18 +48,18 @@ namespace config {
} qsv;
struct {
std::optional<int> amd_quality_h264;
std::optional<int> amd_quality_hevc;
std::optional<int> amd_quality_av1;
std::optional<int> amd_rc_h264;
std::optional<int> amd_rc_hevc;
std::optional<int> amd_rc_av1;
std::optional<int> amd_usage_h264;
std::optional<int> amd_usage_hevc;
std::optional<int> amd_usage_av1;
std::optional<int> amd_rc_h264;
std::optional<int> amd_rc_hevc;
std::optional<int> amd_rc_av1;
std::optional<int> amd_enforce_hrd;
std::optional<int> amd_quality_h264;
std::optional<int> amd_quality_hevc;
std::optional<int> amd_quality_av1;
std::optional<int> amd_preanalysis;
std::optional<int> amd_vbaq;
std::optional<int> amd_enforce_hrd;
int amd_coder;
} amd;

View File

@ -464,15 +464,19 @@ namespace input {
* @param input The input context.
* @param val The cartesian coordinate pair to convert.
* @param size The size of the client's surface containing the value.
* @return The host-relative coordinate pair.
* @return The host-relative coordinate pair if a touchport is available.
*/
std::pair<float, float>
std::optional<std::pair<float, float>>
client_to_touchport(std::shared_ptr<input_t> &input, const std::pair<float, float> &val, const std::pair<float, float> &size) {
auto &touch_port_event = input->touch_port_event;
auto &touch_port = input->touch_port;
if (touch_port_event->peek()) {
touch_port = *touch_port_event->pop();
}
if (!touch_port) {
BOOST_LOG(verbose) << "Ignoring early absolute input without a touch port"sv;
return std::nullopt;
}
auto scalarX = touch_port.width / size.first;
auto scalarY = touch_port.height / size.second;
@ -486,7 +490,7 @@ namespace input {
x = std::clamp(x, offsetX, (size.first * scalarX) - offsetX);
y = std::clamp(y, offsetY, (size.second * scalarY) - offsetY);
return { (x - offsetX) * touch_port.scalar_inv, (y - offsetY) * touch_port.scalar_inv };
return std::pair { (x - offsetX) * touch_port.scalar_inv, (y - offsetY) * touch_port.scalar_inv };
}
/**
@ -556,6 +560,9 @@ namespace input {
auto height = (float) util::endian::big(packet->height);
auto tpcoords = client_to_touchport(input, { x, y }, { width, height });
if (!tpcoords) {
return;
}
auto &touch_port = input->touch_port;
platf::touch_port_t abs_port {
@ -563,7 +570,7 @@ namespace input {
touch_port.env_width, touch_port.env_height
};
platf::abs_mouse(platf_input, abs_port, tpcoords.first, tpcoords.second);
platf::abs_mouse(platf_input, abs_port, tpcoords->first, tpcoords->second);
}
void
@ -913,6 +920,9 @@ namespace input {
{ from_clamped_netfloat(packet->x, 0.0f, 1.0f) * 65535.f,
from_clamped_netfloat(packet->y, 0.0f, 1.0f) * 65535.f },
{ 65535.f, 65535.f });
if (!coords) {
return;
}
auto &touch_port = input->touch_port;
platf::touch_port_t abs_port {
@ -921,8 +931,8 @@ namespace input {
};
// Renormalize the coordinates
coords.first /= abs_port.width;
coords.second /= abs_port.height;
coords->first /= abs_port.width;
coords->second /= abs_port.height;
// Normalize rotation value to 0-359 degree range
auto rotation = util::endian::little(packet->rotation);
@ -941,8 +951,8 @@ namespace input {
packet->eventType,
rotation,
util::endian::little(packet->pointerId),
coords.first,
coords.second,
coords->first,
coords->second,
from_clamped_netfloat(packet->pressureOrDistance, 0.0f, 1.0f),
contact_area.first,
contact_area.second,
@ -967,6 +977,9 @@ namespace input {
{ from_clamped_netfloat(packet->x, 0.0f, 1.0f) * 65535.f,
from_clamped_netfloat(packet->y, 0.0f, 1.0f) * 65535.f },
{ 65535.f, 65535.f });
if (!coords) {
return;
}
auto &touch_port = input->touch_port;
platf::touch_port_t abs_port {
@ -975,8 +988,8 @@ namespace input {
};
// Renormalize the coordinates
coords.first /= abs_port.width;
coords.second /= abs_port.height;
coords->first /= abs_port.width;
coords->second /= abs_port.height;
// Normalize rotation value to 0-359 degree range
auto rotation = util::endian::little(packet->rotation);
@ -997,8 +1010,8 @@ namespace input {
packet->penButtons,
packet->tilt,
rotation,
coords.first,
coords.second,
coords->first,
coords->second,
from_clamped_netfloat(packet->pressureOrDistance, 0.0f, 1.0f),
contact_area.first,
contact_area.second,

View File

@ -32,6 +32,11 @@ namespace input {
float client_offsetX, client_offsetY;
float scalar_inv;
explicit
operator bool() const {
return width != 0 && height != 0 && env_width != 0 && env_height != 0;
}
};
std::pair<float, float>

View File

@ -4,6 +4,7 @@
*/
// standard includes
#include <codecvt>
#include <csignal>
#include <fstream>
#include <iostream>

View File

@ -10,7 +10,9 @@
#include <mutex>
#include <string>
#include "src/config.h"
#include "src/logging.h"
#include "src/stat_trackers.h"
#include "src/thread_safe.h"
#include "src/utility.h"
#include "src/video_colorspace.h"
@ -19,6 +21,8 @@ extern "C" {
#include <moonlight-common-c/src/Limelight.h>
}
using namespace std::literals;
struct sockaddr;
struct AVFrame;
struct AVBufferRef;
@ -499,6 +503,22 @@ namespace platf {
int env_width, env_height;
int width, height;
protected:
// collect capture timing data (at loglevel debug)
stat_trackers::min_max_avg_tracker<double> sleep_overshoot_tracker;
void
log_sleep_overshoot(std::chrono::nanoseconds overshoot_ns) {
if (config::sunshine.min_log_level <= 1) {
// Print sleep overshoot stats to debug log every 20 seconds
auto print_info = [&](double min_overshoot, double max_overshoot, double avg_overshoot) {
auto f = stat_trackers::one_digit_after_decimal();
BOOST_LOG(debug) << "Sleep overshoot (min/max/avg): " << f % min_overshoot << "ms/" << f % max_overshoot << "ms/" << f % avg_overshoot << "ms";
};
// std::chrono::nanoseconds overshoot_ns = std::chrono::steady_clock::now() - next_frame;
sleep_overshoot_tracker.collect_and_callback_on_interval(overshoot_ns.count() / 1000000., print_info, 20s);
}
}
};
class mic_t {

View File

@ -796,6 +796,8 @@ namespace cuda {
handle.reset();
});
sleep_overshoot_tracker.reset();
while (true) {
std::shared_ptr<platf::img_t> img_out;
auto status = snapshot(pull_free_image_cb, img_out, 150ms, *cursor);

View File

@ -39,7 +39,7 @@ namespace gl {
}
tex_t::~tex_t() {
if (!size() == 0) {
if (size() != 0) {
ctx.DeleteTextures(size(), begin());
}
}

View File

@ -587,8 +587,8 @@ namespace platf {
weak_strong += data.rumble(tp);
}
std::clamp<std::uint32_t>(weak_strong.first, 0, 0xFFFF);
std::clamp<std::uint32_t>(weak_strong.second, 0, 0xFFFF);
weak_strong.first = std::clamp<std::uint32_t>(weak_strong.first, 0, 0xFFFF);
weak_strong.second = std::clamp<std::uint32_t>(weak_strong.second, 0, 0xFFFF);
old_rumble = weak_strong * gain / 0xFFFF;
return old_rumble;

View File

@ -1645,7 +1645,7 @@ namespace platf {
if (!fb->handles[0]) {
BOOST_LOG(error) << "Couldn't get handle for DRM Framebuffer ["sv << plane->fb_id << "]: Probably not permitted"sv;
BOOST_LOG((window_system != window_system_e::X11 || config::video.capture == "kms") ? fatal : error)
<< "You must run [sudo setcap cap_sys_admin+p $(readlink -f sunshine)] for KMS display capture to work!"sv;
<< "You must run [sudo setcap cap_sys_admin+p $(readlink -f $(which sunshine))] for KMS display capture to work!"sv;
break;
}

View File

@ -95,7 +95,7 @@ namespace video {
from_flag(flag_e flag) {
#define _CONVERT(x) \
case flag_e::x: \
std::string_view(#x)
return std::string_view(#x)
switch (flag) {
_CONVERT(PASSED);
_CONVERT(REF_FRAMES_RESTRICT);

@ -1 +1 @@
Subproject commit 46f201bd7b328ab5ac531231c030ca5c4090b1da
Subproject commit 08d1c7276d41379acfea353b5c739b72d51827e2

@ -1 +1 @@
Subproject commit 4264185db3b7e961e7f157e1cc4fd0ab75137568
Subproject commit 2b8d43325b7012cc3f9b55c08d26e50e42beac7d