-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build(android): support android platform (config and logging) #3741
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR! I'm looking forward to this.
I expected more changes for in order for initial Android support. Is there more coming? Maybe something in the ./cmake
directory?
LGTM Co-authored-by: ReenigneArcher <[email protected]>
LGTM Co-authored-by: ReenigneArcher <[email protected]>
Sorry for the delayed response. Unfortunately, I don't have much time either. My main tech stack is Flutter (UI Framework) and Android Native. Typically, the compilation of an Android app differs significantly from C/C++ and requires the Java environment and Gradle. So, from my current perspective, it seems quite difficult to make the Sunshine workflow directly produce an APK. Additionally, I'm concerned that my lack of proficiency in C/C++ might disrupt the original workflow, so I plan to submit PRs in multiple stages. However, I can start with some compilation adaptations to ensure that future Sunshine APKs for Android can be imported and compiled smoothly. As seen in the patches, I can now directly use the Sunshine Source along with a Patch Script to make Android compilation work properly. My initial idea is to submit these patches to Sunshine so that the Android-compiled Sunshine and the Sunshine source code can remain consistent. Additionally, I’d like to share some recent comparisons with scrcpy. I’ve studied a lot of scrcpy’s code. In fact, scrcpy is already very efficient. It’s possible that the client’s use of SDL2 results in rendering that’s not as extremely efficient (just a guess). However, in terms of the server side, scrcpy and the ported Sunshine for Android should be roughly the same. That said, porting to Android still has significant value because it allows users to use Moonlight to stream their Android devices. I will continue to push this process forward. |
#ifdef __ANDROID__ | ||
#include <android/log.h> | ||
#else | ||
#include <display_device/logging.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless there are some compilation issues, I would not touch the display_device
. This function
Sunshine/src/display_device.cpp
Line 615 in 5da5293
std::unique_ptr<SettingsManagerInterface> make_settings_manager([[maybe_unused]] const std::filesystem::path &persistence_filepath, [[maybe_unused]] const config::video_t &video_config) { |
This means that every display_device
function will either do nothing or act as a "pass-trough". Same for logging - nothing should be logged via setup_libdisplaydevice_logging
, so maybe just keep it as it is?
@@ -86,6 +92,32 @@ namespace logging { | |||
#endif | |||
}; | |||
|
|||
#ifdef __ANDROID__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole section is not correct way to log to android via boost. You need to create a custom sink (like here https://gist.github.com/cawka/ca21d79605bf51621d6206d2cd76b638) and then probably replace the default sink (
Line 110 in 5da5293
sink = boost::make_shared<text_sink>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I will try to modify this part, but it will be a little later. Thank you for your review
|
#ifndef __ANDROID__ | ||
setup_av_logging(min_log_level); | ||
setup_libdisplaydevice_logging(min_log_level); | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it compile if you remove the ifndef
?
Description
Adapt config and logging for Android:
Type of Change
.github/...
)Checklist