Merge remote-tracking branch 'origin/master'

This commit is contained in:
Yukino Song
2024-08-10 00:21:20 +08:00
6 changed files with 39 additions and 28 deletions

View File

@@ -262,6 +262,8 @@ brew install sunshine
brew uninstall sunshine
```
@tip{For beta you can replace `sunshine` with `sunshine-beta` in the above commands.}
#### Portfile
This package requires that you have [MacPorts](https://www.macports.org/install.php) installed.

View File

@@ -1,6 +1,7 @@
require "language/node"
class @PROJECT_NAME@ < Formula
# conflicts_with "sunshine", because: "sunshine and sunshine-beta cannot be installed at the same time"
desc "@PROJECT_DESCRIPTION@"
homepage "@PROJECT_HOMEPAGE_URL@"
url "@GITHUB_CLONE_URL@",

View File

@@ -4,10 +4,12 @@
*/
// standard includes
#include <fstream>
#include <iomanip>
#include <iostream>
// lib includes
#include <boost/core/null_deleter.hpp>
#include <boost/format.hpp>
#include <boost/log/attributes/clock.hpp>
#include <boost/log/common.hpp>
#include <boost/log/expressions.hpp>
@@ -67,7 +69,6 @@ namespace logging {
sink->set_formatter([](const bl::record_view &view, bl::formatting_ostream &os) {
constexpr const char *message = "Message";
constexpr const char *severity = "Severity";
constexpr int DATE_BUFFER_SIZE = 21 + 2 + 1; // Full string plus ": \0"
auto log_level = view.attribute_values()[severity].extract<int>().get();
@@ -93,11 +94,15 @@ namespace logging {
break;
};
char _date[DATE_BUFFER_SIZE];
std::time_t t = std::time(nullptr);
strftime(_date, DATE_BUFFER_SIZE, "[%Y:%m:%d:%H:%M:%S]: ", std::localtime(&t));
auto now = std::chrono::system_clock::now();
auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(
now - std::chrono::time_point_cast<std::chrono::seconds>(now));
os << _date << log_type << view.attribute_values()[message].extract<std::string>();
auto t = std::chrono::system_clock::to_time_t(now);
auto lt = *std::localtime(&t);
os << "["sv << std::put_time(&lt, "%Y-%m-%d %H:%M:%S.") << boost::format("%03u") % ms.count() << "]: "sv
<< log_type << view.attribute_values()[message].extract<std::string>();
});
// Flush after each log record to ensure log file contents on disk isn't stale.

View File

@@ -1746,28 +1746,6 @@ namespace video {
std::unique_ptr<encode_session_t>
make_encode_session(platf::display_t *disp, const encoder_t &encoder, const config_t &config, int width, int height, std::unique_ptr<platf::encode_device_t> encode_device) {
if (encode_device) {
switch (encode_device->colorspace.colorspace) {
case colorspace_e::bt2020:
BOOST_LOG(info) << "HDR color coding [Rec. 2020 + SMPTE 2084 PQ]"sv;
break;
case colorspace_e::rec601:
BOOST_LOG(info) << "SDR color coding [Rec. 601]"sv;
break;
case colorspace_e::rec709:
BOOST_LOG(info) << "SDR color coding [Rec. 709]"sv;
break;
case colorspace_e::bt2020sdr:
BOOST_LOG(info) << "SDR color coding [Rec. 2020]"sv;
break;
}
BOOST_LOG(info) << "Color depth: " << encode_device->colorspace.bit_depth << "-bit";
BOOST_LOG(info) << "Color range: ["sv << (encode_device->colorspace.full_range ? "JPEG"sv : "MPEG"sv) << ']';
}
if (dynamic_cast<platf::avcodec_encode_device_t *>(encode_device.get())) {
auto avcodec_encode_device = boost::dynamic_pointer_cast<platf::avcodec_encode_device_t>(std::move(encode_device));
return make_avcodec_encode_session(disp, encoder, config, width, height, std::move(avcodec_encode_device));
@@ -1901,6 +1879,25 @@ namespace video {
auto colorspace = colorspace_from_client_config(config, disp.is_hdr());
auto pix_fmt = (colorspace.bit_depth == 10) ? encoder.platform_formats->pix_fmt_10bit : encoder.platform_formats->pix_fmt_8bit;
{
auto encoder_name = config.videoFormat == 0 ? encoder.h264.name :
config.videoFormat == 1 ? encoder.hevc.name :
config.videoFormat == 2 ? encoder.av1.name :
"unknown";
BOOST_LOG(info) << "Creating encoder " << logging::bracket(encoder_name);
auto color_coding = colorspace.colorspace == colorspace_e::bt2020 ? "HDR (Rec. 2020 + SMPTE 2084 PQ)" :
colorspace.colorspace == colorspace_e::rec601 ? "SDR (Rec. 601)" :
colorspace.colorspace == colorspace_e::rec709 ? "SDR (Rec. 709)" :
colorspace.colorspace == colorspace_e::bt2020sdr ? "SDR (Rec. 2020)" :
"unknown";
BOOST_LOG(info) << "Color coding: " << color_coding;
BOOST_LOG(info) << "Color depth: " << colorspace.bit_depth << "-bit";
BOOST_LOG(info) << "Color range: " << (colorspace.full_range ? "JPEG" : "MPEG");
}
if (dynamic_cast<const encoder_platform_formats_avcodec *>(encoder.platform_formats.get())) {
result = disp.make_avcodec_encode_device(pix_fmt);
}

View File

@@ -144,7 +144,7 @@
/** Parse the text errors, calculating the text, the timestamp and the level */
fancyLogs() {
if (!this.logs) return [];
let regex = /(\[\d{4}:\d{2}:\d{2}:\d{2}:\d{2}:\d{2}\]):\s/g;
let regex = /(\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3}]):\s/g;
let rawLogLines = (this.logs.split(regex)).splice(1);
let logLines = []
for (let i = 0; i < rawLogLines.length; i += 2) {

View File

@@ -70,4 +70,10 @@ target_compile_definitions(${PROJECT_NAME} PUBLIC ${SUNSHINE_DEFINITIONS} ${TEST
target_compile_options(${PROJECT_NAME} PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${SUNSHINE_COMPILE_OPTIONS}>;$<$<COMPILE_LANGUAGE:CUDA>:${SUNSHINE_COMPILE_OPTIONS_CUDA};-std=c++17>) # cmake-lint: disable=C0301
target_link_options(${PROJECT_NAME} PRIVATE)
if (WIN32)
# prefer static libraries since we're linking statically
# this fixes gtest_main and libcurl linking errors, when using non MSYS2 version of CMake
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_SEARCH_START_STATIC 1)
endif ()
add_test(NAME ${PROJECT_NAME} COMMAND sunshine_test)