Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <shellapi.h>
#endif

#ifndef __APPLE__
#if !defined(__APPLE__) && !defined(__ANDROID__)
Comment thread
Laurie-Lin marked this conversation as resolved.
Outdated
// For NVENC legacy constants
#include <ffnvcodec/nvEncodeAPI.h>
#endif
Expand Down Expand Up @@ -1039,9 +1039,12 @@ namespace config {
}

void apply_config(std::unordered_map<std::string, std::string> &&vars) {
#ifndef __ANDROID__
// TODO(Lin): May android also can support this
Comment thread
Laurie-Lin marked this conversation as resolved.
Outdated
if (!fs::exists(stream.file_apps.c_str())) {
fs::copy_file(SUNSHINE_ASSETS_DIR "/apps.json", stream.file_apps);
}
#endif

for (auto &[name, val] : vars) {
std::cout << "["sv << name << "] -- ["sv << val << ']' << std::endl;
Expand All @@ -1066,7 +1069,7 @@ namespace config {
bool_f(vars, "nvenc_opengl_vulkan_on_dxgi", video.nv_opengl_vulkan_on_dxgi);
bool_f(vars, "nvenc_latency_over_power", video.nv_sunshine_high_power_mode);

#ifndef __APPLE__
#if !defined(__APPLE__) && !defined(__ANDROID__)
video.nv_legacy.preset = video.nv.quality_preset + 11;
video.nv_legacy.multipass = video.nv.two_pass == nvenc::nvenc_two_pass::quarter_resolution ? NV_ENC_TWO_PASS_QUARTER_RESOLUTION :
video.nv.two_pass == nvenc::nvenc_two_pass::full_resolution ? NV_ENC_TWO_PASS_FULL_RESOLUTION :
Expand Down
36 changes: 35 additions & 1 deletion src/logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
#include <boost/log/expressions.hpp>
#include <boost/log/sinks.hpp>
#include <boost/log/sources/severity_logger.hpp>
#include <display_device/logging.h>
#ifdef __ANDROID__
#include <android/log.h>
#else
#include <display_device/logging.h>
Comment thread
Laurie-Lin marked this conversation as resolved.
#endif
Comment thread
Laurie-Lin marked this conversation as resolved.

// local includes
#include "logging.h"
Expand Down Expand Up @@ -86,6 +90,32 @@ namespace logging {
#endif
};

#ifdef __ANDROID__
Comment thread
Laurie-Lin marked this conversation as resolved.
android_LogPriority android_priority;
Comment thread
Laurie-Lin marked this conversation as resolved.
switch (log_level) {
case 0:
android_priority = ANDROID_LOG_VERBOSE;
break;
case 1:
android_priority = ANDROID_LOG_DEBUG;
break;
case 2:
android_priority = ANDROID_LOG_INFO;
break;
case 3:
android_priority = ANDROID_LOG_WARN;
break;
case 4:
android_priority = ANDROID_LOG_ERROR;
break;
case 5:
android_priority = ANDROID_LOG_FATAL;
break;
};
// get log adn input to andorid
Comment thread
Laurie-Lin marked this conversation as resolved.
Outdated
std::string log_message = view.attribute_values()[message].extract<std::string>().get();
__android_log_print(android_priority, "Sunshine", "%s%s", log_type.data(), log_message.c_str());
#endif
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)
Expand All @@ -105,7 +135,9 @@ namespace logging {
}

setup_av_logging(min_log_level);
#ifndef __ANDROID__
setup_libdisplaydevice_logging(min_log_level);
#endif
Comment thread
Laurie-Lin marked this conversation as resolved.

sink = boost::make_shared<text_sink>();

Expand Down Expand Up @@ -153,6 +185,7 @@ namespace logging {
});
}

#ifndef __ANDROID__
void setup_libdisplaydevice_logging(int min_log_level) {
constexpr int min_level {static_cast<int>(display_device::Logger::LogLevel::verbose)};
constexpr int max_level {static_cast<int>(display_device::Logger::LogLevel::fatal)};
Expand Down Expand Up @@ -182,6 +215,7 @@ namespace logging {
}
});
}
#endif

void log_flush() {
if (sink) {
Expand Down