mirror of
https://github.com/VallierDev/uu-remote-linux.git
synced 2026-11-16 16:50:41 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a91f0024d3 | ||
|
|
68ad9759bd | ||
|
|
169edf2224 | ||
|
|
9994279b29 | ||
|
|
6733a117a2 | ||
|
|
e3cab32c75 |
No files matched your search
@@ -95,3 +95,28 @@ jobs:
|
|||||||
- uses: dtolnay/rust-toolchain@stable
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
- run: cargo test --locked --features inproc-av
|
- run: cargo test --locked --features inproc-av
|
||||||
|
|
||||||
|
test-linux-arm64:
|
||||||
|
# aarch64 hosts (Ampere A1, arm64 VMs, Apple-silicon VMs) build from source, so keep that
|
||||||
|
# build honest on a native arm64 runner instead of letting it rot between releases.
|
||||||
|
runs-on: ubuntu-24.04-arm
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Install build dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y build-essential pkg-config \
|
||||||
|
libx11-dev libxext-dev libxtst-dev libxfixes-dev libgtk-3-dev \
|
||||||
|
libwayland-dev libwayland-bin libxkbcommon-dev libglib2.0-dev libpipewire-0.3-dev libei-dev
|
||||||
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
|
- uses: Swatinem/rust-cache@v2
|
||||||
|
- run: cargo test --locked
|
||||||
|
- name: Release binary
|
||||||
|
run: |
|
||||||
|
cargo build --locked --release --bin uuremote-server
|
||||||
|
file target/release/uuremote-server
|
||||||
|
# The aarch64 release package ships both engine plugins.
|
||||||
|
- name: Release feature set
|
||||||
|
run: |
|
||||||
|
cargo build --locked --features wayland,portal,engine-plugins --bin uuremote-server
|
||||||
|
for lib in libuu-wayland.so libuu-portal.so; do test -f "target/debug/$lib"; done
|
||||||
@@ -12,7 +12,12 @@ jobs:
|
|||||||
# GNOME/KDE Wayland engine: libei >= 1.1 first ships in Ubuntu 24.04, so this plugin needs
|
# GNOME/KDE Wayland engine: libei >= 1.1 first ships in Ubuntu 24.04, so this plugin needs
|
||||||
# glibc >= 2.39. It is only loaded on portal sessions; X11 and wlroots hosts never open it.
|
# glibc >= 2.39. It is only loaded on portal sessions; X11 and wlroots hosts never open it.
|
||||||
portal-plugin:
|
portal-plugin:
|
||||||
runs-on: ubuntu-24.04
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- { arch: x86_64, runner: ubuntu-24.04 }
|
||||||
|
- { arch: aarch64, runner: ubuntu-24.04-arm }
|
||||||
|
runs-on: ${{ matrix.runner }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Install build dependencies
|
- name: Install build dependencies
|
||||||
@@ -24,13 +29,18 @@ jobs:
|
|||||||
- run: UU_NO_GTK=1 cargo build --release --locked --features portal,engine-plugins --bin uuremote-server
|
- run: UU_NO_GTK=1 cargo build --release --locked --features portal,engine-plugins --bin uuremote-server
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: libuu-portal
|
name: libuu-portal-${{ matrix.arch }}
|
||||||
path: target/release/libuu-portal.so
|
path: target/release/libuu-portal.so
|
||||||
|
|
||||||
release:
|
build:
|
||||||
needs: portal-plugin
|
needs: portal-plugin
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- { arch: x86_64, runner: ubuntu-22.04 }
|
||||||
|
- { arch: aarch64, runner: ubuntu-22.04-arm }
|
||||||
# Built on 22.04 so the binary also runs on Ubuntu 22.04/24.04 and newer Debian (glibc >= 2.35).
|
# Built on 22.04 so the binary also runs on Ubuntu 22.04/24.04 and newer Debian (glibc >= 2.35).
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ${{ matrix.runner }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Install build dependencies
|
- name: Install build dependencies
|
||||||
@@ -46,19 +56,34 @@ jobs:
|
|||||||
- run: cargo build --release --locked --features wayland,portal,engine-plugins
|
- run: cargo build --release --locked --features wayland,portal,engine-plugins
|
||||||
- uses: actions/download-artifact@v4
|
- uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: libuu-portal
|
name: libuu-portal-${{ matrix.arch }}
|
||||||
path: target/release
|
path: target/release
|
||||||
# Experimental viewer; built after the host so uuremote-server keeps the release features.
|
# Experimental viewer; built after the host so uuremote-server keeps the release features.
|
||||||
- run: cargo build --release --locked --features native-viewer,viewer-sdl --bin uuremote-viewer
|
- run: cargo build --release --locked --features native-viewer,viewer-sdl --bin uuremote-viewer
|
||||||
- name: Package
|
- name: Package
|
||||||
run: |
|
run: |
|
||||||
name=uu-remote-linux-${GITHUB_REF_NAME}-x86_64-linux
|
name=uu-remote-linux-${GITHUB_REF_NAME}-${{ matrix.arch }}-linux
|
||||||
mkdir -p "$name"
|
mkdir -p "$name"
|
||||||
cp target/release/uuremote-server target/release/uuremote-viewer target/release/libuu-wayland.so target/release/libuu-portal.so \
|
cp target/release/uuremote-server target/release/uuremote-viewer target/release/libuu-wayland.so target/release/libuu-portal.so \
|
||||||
LICENSE README.md README.en.md config.example.json "$name/"
|
LICENSE README.md README.en.md config.example.json "$name/"
|
||||||
cp -r contrib "$name/"
|
cp -r contrib "$name/"
|
||||||
tar czf "$name.tar.gz" "$name"
|
tar czf "$name.tar.gz" "$name"
|
||||||
sha256sum "$name.tar.gz" > "$name.tar.gz.sha256"
|
sha256sum "$name.tar.gz" > "$name.tar.gz.sha256"
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: package-${{ matrix.arch }}
|
||||||
|
path: uu-remote-linux-*.tar.gz*
|
||||||
|
|
||||||
|
# One publisher, so the matrix legs never race to create the release.
|
||||||
|
release:
|
||||||
|
needs: build
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
pattern: package-*
|
||||||
|
merge-multiple: true
|
||||||
- uses: softprops/action-gh-release@v2
|
- uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
body_path: docs/release-notes/${{ github.ref_name }}.md
|
body_path: docs/release-notes/${{ github.ref_name }}.md
|
||||||
|
|||||||
Generated
+1
-1
@@ -2741,7 +2741,7 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "uu-remote-linux"
|
name = "uu-remote-linux"
|
||||||
version = "0.2.14"
|
version = "0.2.16"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "uu-remote-linux"
|
name = "uu-remote-linux"
|
||||||
version = "0.2.14"
|
version = "0.2.16"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
default-run = "uuremote-server"
|
default-run = "uuremote-server"
|
||||||
authors = ["uu-remote-linux contributors"]
|
authors = ["uu-remote-linux contributors"]
|
||||||
|
|||||||
+7
-4
@@ -128,9 +128,9 @@ Switching reuses one video track and pauses input until the new source sends a f
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
### 0. Prebuilt release package (recommended, x86_64)
|
### 0. Prebuilt release package (recommended, x86_64 / aarch64)
|
||||||
|
|
||||||
Download `uu-remote-linux-<version>-x86_64-linux.tar.gz` from [Releases](../../releases/latest), extract it, then:
|
Download `uu-remote-linux-<version>-x86_64-linux.tar.gz` (ARM64: `aarch64-linux`) from [Releases](../../releases/latest), extract it, then:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
install -Dm755 uuremote-server ~/.local/bin/uuremote-server
|
install -Dm755 uuremote-server ~/.local/bin/uuremote-server
|
||||||
@@ -148,7 +148,7 @@ running session at startup, and the matching `libuu-*.so` is loaded only on Wayl
|
|||||||
|
|
||||||
Plugins are found next to `uuremote-server`, in `../lib/uu-remote-linux/`, `~/.local/lib/uu-remote-linux/` or
|
Plugins are found next to `uuremote-server`, in `../lib/uu-remote-linux/`, `~/.local/lib/uu-remote-linux/` or
|
||||||
`/usr/lib/uu-remote-linux/` (`UU_ENGINE_DIR` overrides); a missing library or too old glibc is reported in the log.
|
`/usr/lib/uu-remote-linux/` (`UU_ENGINE_DIR` overrides); a missing library or too old glibc is reported in the log.
|
||||||
Continue with step 3 (login). Other architectures (ARM): build from source below.
|
Continue with step 3 (login). Other architectures: build from source below.
|
||||||
|
|
||||||
### 1. Dependencies (Ubuntu / Debian)
|
### 1. Dependencies (Ubuntu / Debian)
|
||||||
|
|
||||||
@@ -383,7 +383,7 @@ Released under the [GPL-3.0](LICENSE): you may use, modify and redistribute it,
|
|||||||
|
|
||||||
### H.265 / HEVC
|
### H.265 / HEVC
|
||||||
|
|
||||||
When both sides support H.265 the host uses it (as the official host does: the host picks the codec from both
|
When both sides support H.265 and the host has a hardware encoder (NVENC / explicit VAAPI), the host uses it (as the official host does: the host picks the codec from both
|
||||||
capability lists; the official Mac viewer lists H265 first in its SDP). The first desktop connection probes a
|
capability lists; the official Mac viewer lists H265 first in its SDP). The first desktop connection probes a
|
||||||
synthetic frame and announces encoder support with CodecNegotiation. `hevc_nvenc`, `libx265` and explicit
|
synthetic frame and announces encoder support with CodecNegotiation. `hevc_nvenc`, `libx265` and explicit
|
||||||
`UU_VIDEO_ENCODER=vaapi` (`hevc_vaapi`); hardware failure falls back to software HEVC, then to H.264.
|
`UU_VIDEO_ENCODER=vaapi` (`hevc_vaapi`); hardware failure falls back to software HEVC, then to H.264.
|
||||||
@@ -391,6 +391,9 @@ synthetic frame and announces encoder support with CodecNegotiation. `hevc_nvenc
|
|||||||
Verified with the official Mac viewer on an RTX 3090 (hevc_nvenc, including 4:4:4) and with the official Android
|
Verified with the official Mac viewer on an RTX 3090 (hevc_nvenc, including 4:4:4) and with the official Android
|
||||||
viewer on Intel Alder Lake-P (iHD): 2560x1440 fully hardware-encoded, 58 fps decoded at about 10 ms. libx265 is
|
viewer on Intel Alder Lake-P (iHD): 2560x1440 fully hardware-encoded, 58 fps decoded at about 10 ms. libx265 is
|
||||||
still not verified against a real viewer.
|
still not verified against a real viewer.
|
||||||
|
With CPU-only encoding the default is H.264: libx265 is about ten times slower than libx264 (measured ~15 vs ~155 fps
|
||||||
|
at 1080p on a 4-core ARM host, #59); `UU_VIDEO_CODEC=h265` forces H.265. The applied frame rate comes from the viewer's
|
||||||
|
quality/fps menu; `UU_DISPLAY_FPS` only changes the reported display refresh rate.
|
||||||
|
|
||||||
HEVC access units are split on RFC 7798 picture boundaries instead of AUDs: `hevc_vaapi` with `-aud 1` writes an
|
HEVC access units are split on RFC 7798 picture boundaries instead of AUDs: `hevc_vaapi` with `-aud 1` writes an
|
||||||
AUD only at IRAPs and drops every other picture from the bitstream, so an AUD-based reader turns a whole GOP into
|
AUD only at IRAPs and drops every other picture from the bitstream, so an AUD-based reader turns a whole GOP into
|
||||||
|
|||||||
@@ -115,9 +115,9 @@ GNOME Portal 的控制通道不再等待授权窗口或第一帧画面:先通
|
|||||||
|
|
||||||
## 安装
|
## 安装
|
||||||
|
|
||||||
### 0. 直接用 Release 预编译包(推荐,x86_64)
|
### 0. 直接用 Release 预编译包(推荐,x86_64 / aarch64)
|
||||||
|
|
||||||
从 [Releases](../../releases/latest) 下载 `uu-remote-linux-<版本>-x86_64-linux.tar.gz`,解压后:
|
从 [Releases](../../releases/latest) 下载 `uu-remote-linux-<版本>-x86_64-linux.tar.gz`(ARM64 选 `aarch64-linux`),解压后:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
install -Dm755 uuremote-server ~/.local/bin/uuremote-server
|
install -Dm755 uuremote-server ~/.local/bin/uuremote-server
|
||||||
@@ -134,7 +134,7 @@ install -Dm644 libuu-wayland.so libuu-portal.so -t ~/.local/lib/uu-remote-linux/
|
|||||||
| GNOME / KDE Wayland | glibc ≥ 2.39(Ubuntu 24.04、Fedora 40、Debian 13 及更新),以及 libei ≥ 1.1、PipeWire |
|
| GNOME / KDE Wayland | glibc ≥ 2.39(Ubuntu 24.04、Fedora 40、Debian 13 及更新),以及 libei ≥ 1.1、PipeWire |
|
||||||
|
|
||||||
插件放在 `uuremote-server` 同目录、`../lib/uu-remote-linux/`、`~/.local/lib/uu-remote-linux/` 或 `/usr/lib/uu-remote-linux/` 都能找到
|
插件放在 `uuremote-server` 同目录、`../lib/uu-remote-linux/`、`~/.local/lib/uu-remote-linux/` 或 `/usr/lib/uu-remote-linux/` 都能找到
|
||||||
(`UU_ENGINE_DIR` 可指定)。缺库或版本太旧时日志会写明原因。之后从第 3 步「登录」继续;ARM 等其他架构请按下面源码编译。
|
(`UU_ENGINE_DIR` 可指定)。缺库或版本太旧时日志会写明原因。之后从第 3 步「登录」继续;其他架构请按下面源码编译。
|
||||||
|
|
||||||
### 1. 依赖(Ubuntu / Debian)
|
### 1. 依赖(Ubuntu / Debian)
|
||||||
|
|
||||||
@@ -346,8 +346,9 @@ flowchart LR
|
|||||||
|
|
||||||
### H.265 / HEVC
|
### H.265 / HEVC
|
||||||
|
|
||||||
控制端和主机都支持 H.265 时,主机自动使用 H.265(与官方主机一致,由主机按双方能力选择;官方 Mac 客户端在 SDP
|
控制端和主机都支持 H.265、且主机使用硬件编码器(NVENC / 显式 VAAPI)时,主机自动使用 H.265(与官方主机一致,由主机按双方能力选择;官方 Mac 客户端在 SDP
|
||||||
中优先列出 H.265)。首次桌面连接会用合成帧探测实际编码能力,并通过 CodecNegotiation 告知客户端。支持 `hevc_nvenc`、
|
中优先列出 H.265)。**只有 CPU 编码时默认用 H.264**:libx265 比 libx264 慢约 10 倍(4 核 ARM 上 1080p 实测约 15 帧对 155 帧,#59),
|
||||||
|
可用 `UU_VIDEO_CODEC=h265` 强制 H.265。实际帧率由控制端的「画质/帧率」菜单决定;`UU_DISPLAY_FPS` 只改上报的显示器刷新率。首次桌面连接会用合成帧探测实际编码能力,并通过 CodecNegotiation 告知客户端。支持 `hevc_nvenc`、
|
||||||
`libx265`、显式 `UU_VIDEO_ENCODER=vaapi` 的 `hevc_vaapi`;硬件失败先回落软件 HEVC,再回落 H.264。
|
`libx265`、显式 `UU_VIDEO_ENCODER=vaapi` 的 `hevc_vaapi`;硬件失败先回落软件 HEVC,再回落 H.264。
|
||||||
`UU_VIDEO_CODEC=h264` 强制使用 H.264。8-bit;真彩 4:4:4 使用 hevc_nvenc `rext` / libx265 `main444-8`。
|
`UU_VIDEO_CODEC=h264` 强制使用 H.264。8-bit;真彩 4:4:4 使用 hevc_nvenc `rext` / libx265 `main444-8`。
|
||||||
已用官方 Mac 客户端在 RTX 3090(hevc_nvenc,含 4:4:4)实机验收;`hevc_vaapi` 配官方 Android 客户端也已实机验收
|
已用官方 Mac 客户端在 RTX 3090(hevc_nvenc,含 4:4:4)实机验收;`hevc_vaapi` 配官方 Android 客户端也已实机验收
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
#define SESSION_DEST "org.gnome.SessionManager"
|
#define SESSION_DEST "org.gnome.SessionManager"
|
||||||
#define SESSION_PATH "/org/gnome/SessionManager"
|
#define SESSION_PATH "/org/gnome/SessionManager"
|
||||||
#define SESSION_IFACE "org.gnome.SessionManager"
|
#define SESSION_IFACE "org.gnome.SessionManager"
|
||||||
|
#define SCREENSAVER_DEST "org.freedesktop.ScreenSaver"
|
||||||
|
#define SCREENSAVER_PATH "/org/freedesktop/ScreenSaver"
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
UU_POWER_OK = 0,
|
UU_POWER_OK = 0,
|
||||||
@@ -17,6 +19,7 @@ enum {
|
|||||||
struct uu_idle_inhibitor {
|
struct uu_idle_inhibitor {
|
||||||
GDBusConnection *connection;
|
GDBusConnection *connection;
|
||||||
guint32 cookie;
|
guint32 cookie;
|
||||||
|
int freedesktop; /* org.freedesktop.ScreenSaver (KDE) instead of org.gnome.SessionManager */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct setup_timeout {
|
struct setup_timeout {
|
||||||
@@ -138,13 +141,45 @@ struct uu_idle_inhibitor *uu_desktop_idle_inhibitor_acquire(int *error_code) {
|
|||||||
return inhibitor;
|
return inhibitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* KDE (and other desktops implementing the freedesktop idle-inhibition spec): the inhibition is
|
||||||
|
also dropped by the screensaver when this private connection closes. */
|
||||||
|
struct uu_idle_inhibitor *uu_desktop_screensaver_inhibitor_acquire(int *error_code) {
|
||||||
|
if (!error_code) return NULL;
|
||||||
|
*error_code = UU_POWER_OK;
|
||||||
|
GDBusConnection *connection = private_session_bus(error_code);
|
||||||
|
if (!connection) return NULL;
|
||||||
|
GError *error = NULL;
|
||||||
|
GVariant *reply = g_dbus_connection_call_sync(
|
||||||
|
connection, SCREENSAVER_DEST, SCREENSAVER_PATH, SCREENSAVER_DEST, "Inhibit",
|
||||||
|
g_variant_new("(ss)", "uu-remote-linux", "Remote desktop session is active"),
|
||||||
|
G_VARIANT_TYPE("(u)"), G_DBUS_CALL_FLAGS_NONE, CALL_TIMEOUT_MS, NULL, &error);
|
||||||
|
g_clear_error(&error);
|
||||||
|
struct uu_idle_inhibitor *inhibitor = reply ? calloc(1, sizeof(*inhibitor)) : NULL;
|
||||||
|
if (!inhibitor) {
|
||||||
|
*error_code = UU_POWER_CALL_FAILED;
|
||||||
|
if (reply) g_variant_unref(reply);
|
||||||
|
close_private_bus(connection);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
g_variant_get(reply, "(u)", &inhibitor->cookie);
|
||||||
|
g_variant_unref(reply);
|
||||||
|
inhibitor->connection = connection;
|
||||||
|
inhibitor->freedesktop = 1;
|
||||||
|
return inhibitor;
|
||||||
|
}
|
||||||
|
|
||||||
void uu_desktop_idle_inhibitor_release(struct uu_idle_inhibitor *inhibitor) {
|
void uu_desktop_idle_inhibitor_release(struct uu_idle_inhibitor *inhibitor) {
|
||||||
if (!inhibitor) return;
|
if (!inhibitor) return;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GVariant *reply = g_dbus_connection_call_sync(
|
GVariant *reply = inhibitor->freedesktop
|
||||||
inhibitor->connection, SESSION_DEST, SESSION_PATH, SESSION_IFACE, "Uninhibit",
|
? g_dbus_connection_call_sync(
|
||||||
g_variant_new("(u)", inhibitor->cookie), G_VARIANT_TYPE("()"),
|
inhibitor->connection, SCREENSAVER_DEST, SCREENSAVER_PATH, SCREENSAVER_DEST, "UnInhibit",
|
||||||
G_DBUS_CALL_FLAGS_NONE, CALL_TIMEOUT_MS, NULL, &error);
|
g_variant_new("(u)", inhibitor->cookie), G_VARIANT_TYPE("()"),
|
||||||
|
G_DBUS_CALL_FLAGS_NONE, CALL_TIMEOUT_MS, NULL, &error)
|
||||||
|
: g_dbus_connection_call_sync(
|
||||||
|
inhibitor->connection, SESSION_DEST, SESSION_PATH, SESSION_IFACE, "Uninhibit",
|
||||||
|
g_variant_new("(u)", inhibitor->cookie), G_VARIANT_TYPE("()"),
|
||||||
|
G_DBUS_CALL_FLAGS_NONE, CALL_TIMEOUT_MS, NULL, &error);
|
||||||
if (reply) g_variant_unref(reply);
|
if (reply) g_variant_unref(reply);
|
||||||
g_clear_error(&error);
|
g_clear_error(&error);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
# Unofficial UU Remote Linux host in a container, for NAS boxes (Synology DSM, etc.) without a desktop.
|
# Unofficial UU Remote Linux host in a container, for NAS boxes (Synology DSM, etc.) without a desktop.
|
||||||
# Headless mode: file transfer, terminal and port mapping; no remote desktop. Uses the published release binary.
|
# Headless mode: file transfer, terminal and port mapping; no remote desktop. Uses the published release binary.
|
||||||
FROM ubuntu:24.04
|
FROM ubuntu:24.04
|
||||||
ARG VERSION=v0.2.14
|
ARG VERSION=v0.2.16
|
||||||
LABEL org.opencontainers.image.source="https://github.com/VallierDev/uu-remote-linux" \
|
LABEL org.opencontainers.image.source="https://github.com/VallierDev/uu-remote-linux" \
|
||||||
org.opencontainers.image.description="Unofficial UU Remote Linux host, headless (file transfer, terminal, port mapping)" \
|
org.opencontainers.image.description="Unofficial UU Remote Linux host, headless (file transfer, terminal, port mapping)" \
|
||||||
org.opencontainers.image.licenses="GPL-3.0"
|
org.opencontainers.image.licenses="GPL-3.0"
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
ARM64 预编译包;无硬件编码器时默认 H.264。/ aarch64 release package; CPU-only hosts default to H.264.
|
||||||
|
|
||||||
|
### 新增 / Added
|
||||||
|
- **aarch64 预编译包**(#59,感谢 @DeliciousBuding):新增 `uu-remote-linux-v0.2.15-aarch64-linux.tar.gz`,与 x86_64 包相同,
|
||||||
|
含 `uuremote-server`、`uuremote-viewer` 和两个桌面引擎插件;ARM64 主机不再需要源码编译。CI 新增 ARM64 原生构建与测试(#58)。
|
||||||
|
aarch64 包由 GitHub ARM runner 构建,尚未在真实 ARM 主机上运行验收。
|
||||||
|
- New aarch64 release package (same contents as x86_64), built on GitHub ARM runners; not yet run on real ARM hardware.
|
||||||
|
|
||||||
|
### 变更 / Changed
|
||||||
|
- **只有 CPU 编码时默认使用 H.264**(#59):libx265 比 libx264 慢约 10 倍(4 核 Ampere A1 上 1080p 约 15 帧对 155 帧),
|
||||||
|
原先 CPU 主机默认 H.265 会掉到十几帧。现在只有使用硬件编码器(NVENC / 显式 VAAPI)时才自动选 H.265;
|
||||||
|
`UU_VIDEO_CODEC=h265` 仍可强制 H.265。NVENC / VAAPI 主机行为不变。
|
||||||
|
- Without NVENC/VAAPI the host now picks H.264 even when both sides offer H.265; `UU_VIDEO_CODEC=h265` forces H.265.
|
||||||
|
|
||||||
|
### 下载 / Download
|
||||||
|
`uu-remote-linux-v0.2.15-x86_64-linux.tar.gz` / `uu-remote-linux-v0.2.15-aarch64-linux.tar.gz`,或 `docker pull ghcr.io/vallierdev/uu-remote-linux:v0.2.15`(x86_64)。
|
||||||
|
|
||||||
|
**非官方项目,与网易无关。** / **Unofficial, not affiliated with NetEase.**
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
KDE 远程期间不再自动锁屏;锁屏和黑屏原因写进日志。/ No idle lock on KDE during remote sessions; lock and black-screen hints.
|
||||||
|
|
||||||
|
### 修复 / Fixed
|
||||||
|
- **KDE Wayland 远程操作中途自动锁屏**(#61,感谢 @coolxll):桌面连接期间通过 `org.freedesktop.ScreenSaver.Inhibit` 阻止空闲锁屏,
|
||||||
|
断开后释放(GNOME 沿用 SessionManager 的空闲抑制)。尚未在 KDE 真机上验证。
|
||||||
|
- **`inproc-av` 奇数尺寸桌面**(#60,感谢 @ferstar):进程内编码路径同样补齐为偶数尺寸(#53 只修了默认 FFmpeg 管线)。
|
||||||
|
`inproc-av` 不在预编译包里;未在奇数尺寸真机上验证。
|
||||||
|
|
||||||
|
### 改进 / Improved
|
||||||
|
- 桌面锁屏时日志提示「控制端在解锁前只会看到黑屏」,并给出解锁方式(控制端「自动解锁被控端」或本机 `loginctl unlock-session`)。
|
||||||
|
- 检测到 Wayland 会话却选中了 X11 后端时给出警告(此时采集 XWayland 只会得到全黑画面且没有报错)。
|
||||||
|
- KDE sessions hold a freedesktop ScreenSaver inhibitor while connected (not yet tested on real KDE); the log now explains lock-screen
|
||||||
|
black frames and warns when X11 capture is used inside a Wayland session; `inproc-av` pads odd sizes too.
|
||||||
|
|
||||||
|
### 下载 / Download
|
||||||
|
`uu-remote-linux-v0.2.16-x86_64-linux.tar.gz` / `uu-remote-linux-v0.2.16-aarch64-linux.tar.gz`,或 `docker pull ghcr.io/vallierdev/uu-remote-linux:v0.2.16`(x86_64)。
|
||||||
|
|
||||||
|
**非官方项目,与网易无关。** / **Unofficial, not affiliated with NetEase.**
|
||||||
+19
-3
@@ -117,10 +117,16 @@ pub fn handle_rpc(rpc: &[WireField], settings: &watch::Sender<VideoSettings>, na
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Initial codec once the m-line is negotiated: H.265 when both sides support it (the Mac viewer
|
/// Initial codec once the m-line is negotiated: H.265 when both sides support it (the Mac viewer
|
||||||
/// lists H265 first in its offer), unless UU_VIDEO_CODEC=h264.
|
/// lists H265 first in its offer) and a hardware encoder is selected. Software libx265 is about ten
|
||||||
|
/// times slower than libx264 (measured 15 vs 155 fps at 1080p on a 4-core ARM host, #59), so CPU
|
||||||
|
/// hosts default to H.264. UU_VIDEO_CODEC=h264 / h265 overrides.
|
||||||
pub fn preferred_codec(h264: bool, h265: bool) -> VideoCodec {
|
pub fn preferred_codec(h264: bool, h265: bool) -> VideoCodec {
|
||||||
let forced_h264 = std::env::var("UU_VIDEO_CODEC").is_ok_and(|v| v.eq_ignore_ascii_case("h264"));
|
let forced = std::env::var("UU_VIDEO_CODEC").ok().map(|v| v.to_ascii_lowercase());
|
||||||
if h265 && !(forced_h264 && h264) { VideoCodec::H265 } else { VideoCodec::H264 }
|
pick_codec(h264, h265, forced.as_deref(), crate::video::Encoder::requested() != crate::video::Encoder::Cpu)
|
||||||
|
}
|
||||||
|
fn pick_codec(h264: bool, h265: bool, forced: Option<&str>, hardware: bool) -> VideoCodec {
|
||||||
|
let wants_h265 = match forced { Some("h264") => false, Some("h265" | "hevc") => true, _ => hardware };
|
||||||
|
if h265 && (wants_h265 || !h264) { VideoCodec::H265 } else { VideoCodec::H264 }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn handle_rpc_with_codecs(rpc: &[WireField], settings: &watch::Sender<VideoSettings>, native: (u32, u32), h264: bool, h265: bool) -> Option<Vec<u8>> {
|
pub fn handle_rpc_with_codecs(rpc: &[WireField], settings: &watch::Sender<VideoSettings>, native: (u32, u32), h264: bool, h265: bool) -> Option<Vec<u8>> {
|
||||||
@@ -499,6 +505,16 @@ mod codec_tests {
|
|||||||
assert_eq!(rx.borrow().codec, VideoCodec::H265);
|
assert_eq!(rx.borrow().codec, VideoCodec::H265);
|
||||||
assert_eq!(preferred_codec(true, false), VideoCodec::H264);
|
assert_eq!(preferred_codec(true, false), VideoCodec::H264);
|
||||||
}
|
}
|
||||||
|
#[test]
|
||||||
|
fn software_hosts_default_to_h264_unless_forced() {
|
||||||
|
assert_eq!(pick_codec(true, true, None, true), VideoCodec::H265);
|
||||||
|
assert_eq!(pick_codec(true, true, None, false), VideoCodec::H264);
|
||||||
|
assert_eq!(pick_codec(true, true, Some("h265"), false), VideoCodec::H265);
|
||||||
|
assert_eq!(pick_codec(true, true, Some("h264"), true), VideoCodec::H264);
|
||||||
|
// Only one codec bound in the SDP: use it whatever the preference.
|
||||||
|
assert_eq!(pick_codec(false, true, None, false), VideoCodec::H265);
|
||||||
|
assert_eq!(pick_codec(true, false, Some("h265"), true), VideoCodec::H264);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|||||||
@@ -6,6 +6,16 @@ pub enum DesktopBackend { X11, Wayland, Portal, Kms }
|
|||||||
/// port mapping stay available (servers without a monitor or logged-in session).
|
/// port mapping stay available (servers without a monitor or logged-in session).
|
||||||
pub fn headless() -> bool { std::env::var("UU_DESKTOP_BACKEND").is_ok_and(|v| v == "none") }
|
pub fn headless() -> bool { std::env::var("UU_DESKTOP_BACKEND").is_ok_and(|v| v == "none") }
|
||||||
|
|
||||||
|
/// A Wayland compositor socket exists for this user or the environment says so, even when this
|
||||||
|
/// process (e.g. a systemd unit with only DISPLAY set) would select X11.
|
||||||
|
pub fn wayland_session_running() -> bool {
|
||||||
|
std::env::var("XDG_SESSION_TYPE").is_ok_and(|v| v == "wayland")
|
||||||
|
|| std::env::var("WAYLAND_DISPLAY").is_ok_and(|v| !v.is_empty())
|
||||||
|
|| std::env::var_os("XDG_RUNTIME_DIR").and_then(|dir| std::fs::read_dir(dir).ok())
|
||||||
|
.is_some_and(|entries| entries.flatten().any(|e| e.file_name().to_str()
|
||||||
|
.is_some_and(|n| n.starts_with("wayland-") && !n.ends_with(".lock"))))
|
||||||
|
}
|
||||||
|
|
||||||
pub fn detect() -> Result<DesktopBackend, String> {
|
pub fn detect() -> Result<DesktopBackend, String> {
|
||||||
let backend=select(std::env::var("UU_DESKTOP_BACKEND").ok().as_deref(),
|
let backend=select(std::env::var("UU_DESKTOP_BACKEND").ok().as_deref(),
|
||||||
std::env::var("XDG_SESSION_TYPE").ok().as_deref(),
|
std::env::var("XDG_SESSION_TYPE").ok().as_deref(),
|
||||||
|
|||||||
+15
-9
@@ -8,6 +8,7 @@ mod native {
|
|||||||
fn uu_desktop_power_wake() -> i32;
|
fn uu_desktop_power_wake() -> i32;
|
||||||
fn uu_desktop_idle_inhibitor_acquire(error: *mut i32) -> *mut c_void;
|
fn uu_desktop_idle_inhibitor_acquire(error: *mut i32) -> *mut c_void;
|
||||||
fn uu_desktop_idle_inhibitor_release(inhibitor: *mut c_void);
|
fn uu_desktop_idle_inhibitor_release(inhibitor: *mut c_void);
|
||||||
|
fn uu_desktop_screensaver_inhibitor_acquire(error: *mut i32) -> *mut c_void;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Handle(NonNull<c_void>);
|
pub struct Handle(NonNull<c_void>);
|
||||||
@@ -16,9 +17,9 @@ mod native {
|
|||||||
unsafe impl Send for Handle {}
|
unsafe impl Send for Handle {}
|
||||||
|
|
||||||
impl Handle {
|
impl Handle {
|
||||||
pub fn acquire() -> Result<Self, String> {
|
pub fn acquire(gnome: bool) -> Result<Self, String> {
|
||||||
let mut error = 0;
|
let mut error = 0;
|
||||||
let pointer = unsafe { uu_desktop_idle_inhibitor_acquire(&mut error) };
|
let pointer = unsafe { if gnome { uu_desktop_idle_inhibitor_acquire(&mut error) } else { uu_desktop_screensaver_inhibitor_acquire(&mut error) } };
|
||||||
NonNull::new(pointer).map(Self).ok_or_else(|| super::error("idle inhibition", error))
|
NonNull::new(pointer).map(Self).ok_or_else(|| super::error("idle inhibition", error))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +51,9 @@ pub fn wake() -> Result<(), String> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Holds a GNOME SessionManager idle-only inhibitor until dropped.
|
/// Holds an idle-only inhibitor until dropped: GNOME SessionManager on GNOME, the freedesktop
|
||||||
|
/// ScreenSaver interface on KDE (remote input through the portal does not count as activity
|
||||||
|
/// there, so the session locked mid-session, #61).
|
||||||
///
|
///
|
||||||
/// Acquire and drop perform blocking D-Bus work. Session-bus setup and each method call are
|
/// Acquire and drop perform blocking D-Bus work. Session-bus setup and each method call are
|
||||||
/// bounded to three seconds. Callers on an async runtime should move both operations to a
|
/// bounded to three seconds. Callers on an async runtime should move both operations to a
|
||||||
@@ -62,7 +65,8 @@ pub struct IdleInhibitor {
|
|||||||
|
|
||||||
impl IdleInhibitor {
|
impl IdleInhibitor {
|
||||||
pub fn acquire() -> Result<Self, String> {
|
pub fn acquire() -> Result<Self, String> {
|
||||||
if !gnome_portal_active() {
|
let kde = portal_desktop_is("kde");
|
||||||
|
if !gnome_portal_active() && !kde {
|
||||||
return Ok(Self {
|
return Ok(Self {
|
||||||
#[cfg(all(target_os = "linux", feature = "portal"))]
|
#[cfg(all(target_os = "linux", feature = "portal"))]
|
||||||
_handle: None,
|
_handle: None,
|
||||||
@@ -70,7 +74,7 @@ impl IdleInhibitor {
|
|||||||
}
|
}
|
||||||
#[cfg(all(target_os = "linux", feature = "portal"))]
|
#[cfg(all(target_os = "linux", feature = "portal"))]
|
||||||
{
|
{
|
||||||
native::Handle::acquire().map(|handle| Self { _handle: Some(handle) })
|
native::Handle::acquire(!kde).map(|handle| Self { _handle: Some(handle) })
|
||||||
}
|
}
|
||||||
#[cfg(not(all(target_os = "linux", feature = "portal")))]
|
#[cfg(not(all(target_os = "linux", feature = "portal")))]
|
||||||
{
|
{
|
||||||
@@ -79,10 +83,12 @@ impl IdleInhibitor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn gnome_portal_active() -> bool {
|
fn gnome_portal_active() -> bool { portal_desktop_is("gnome") }
|
||||||
let gnome = std::env::var("XDG_CURRENT_DESKTOP").unwrap_or_default().split(':')
|
|
||||||
.any(|desktop| desktop.eq_ignore_ascii_case("gnome"));
|
fn portal_desktop_is(name: &str) -> bool {
|
||||||
gnome && crate::desktop_backend::detect().is_ok_and(|backend| backend == crate::desktop_backend::DesktopBackend::Portal)
|
let matches = std::env::var("XDG_CURRENT_DESKTOP").unwrap_or_default().split(':')
|
||||||
|
.any(|desktop| desktop.eq_ignore_ascii_case(name));
|
||||||
|
matches && crate::desktop_backend::detect().is_ok_and(|backend| backend == crate::desktop_backend::DesktopBackend::Portal)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(target_os = "linux", feature = "portal"))]
|
#[cfg(all(target_os = "linux", feature = "portal"))]
|
||||||
|
|||||||
@@ -101,7 +101,9 @@ fn drain(encoder: &mut encoder::Video, packet: &mut Packet, units: &mpsc::Sender
|
|||||||
|
|
||||||
/// Opens the selected video encoder for `config`. Returns the encoder, its input pixel format and output size.
|
/// Opens the selected video encoder for `config`. Returns the encoder, its input pixel format and output size.
|
||||||
fn open_encoder(config: &Config) -> Result<(encoder::Video, Pixel, u32, u32), String> {
|
fn open_encoder(config: &Config) -> Result<(encoder::Video, Pixel, u32, u32), String> {
|
||||||
|
// H.264/HEVC 4:2:0 and NVENC need even dimensions; an odd native capture is padded (see run_damage).
|
||||||
let (width, height) = config.output.unwrap_or(config.input);
|
let (width, height) = config.output.unwrap_or(config.input);
|
||||||
|
let (width, height) = (width + width % 2, height + height % 2);
|
||||||
let codec = encoder::find_by_name(config.encoder.name_for(config.codec))
|
let codec = encoder::find_by_name(config.encoder.name_for(config.codec))
|
||||||
.ok_or_else(|| format!("{} is not available in this FFmpeg build", config.encoder.name_for(config.codec)))?;
|
.ok_or_else(|| format!("{} is not available in this FFmpeg build", config.encoder.name_for(config.codec)))?;
|
||||||
// Allocate for this codec so FFmpeg fills its defaults; libx264 rejects a context allocated without one.
|
// Allocate for this codec so FFmpeg fills its defaults; libx264 rejects a context allocated without one.
|
||||||
@@ -278,7 +280,11 @@ pub fn run(config: Config, units: mpsc::Sender<EncodedUnit>, stop: Arc<AtomicBoo
|
|||||||
fn run_damage(config: Config, mut capture: DamageCapture, units: mpsc::Sender<EncodedUnit>, stop: Arc<AtomicBool>, idr: Arc<AtomicBool>, budget: Arc<Semaphore>) -> Result<(), String> {
|
fn run_damage(config: Config, mut capture: DamageCapture, units: mpsc::Sender<EncodedUnit>, stop: Arc<AtomicBool>, idr: Arc<AtomicBool>, budget: Arc<Semaphore>) -> Result<(), String> {
|
||||||
let (mut encoder, pixel, width, height) = open_encoder(&config)?;
|
let (mut encoder, pixel, width, height) = open_encoder(&config)?;
|
||||||
let (cap_width, cap_height) = capture.size();
|
let (cap_width, cap_height) = capture.size();
|
||||||
let mut captured = frame::Video::new(Pixel::BGRZ, cap_width, cap_height);
|
// Native size uses the even encoder size. The extra row/column is never overwritten, so it stays black.
|
||||||
|
let native = config.output.is_none();
|
||||||
|
let (frame_width, frame_height) = if native { (width, height) } else { (cap_width, cap_height) };
|
||||||
|
let mut captured = frame::Video::new(Pixel::BGRZ, frame_width, frame_height);
|
||||||
|
if native { captured.data_mut(0).fill(0); }
|
||||||
let mut converted = frame::Video::empty();
|
let mut converted = frame::Video::empty();
|
||||||
let mut scaler = None;
|
let mut scaler = None;
|
||||||
let mut packet = Packet::empty();
|
let mut packet = Packet::empty();
|
||||||
@@ -324,11 +330,11 @@ fn run_damage(config: Config, mut capture: DamageCapture, units: mpsc::Sender<En
|
|||||||
let slot = slot.max(last_slot + 1);
|
let slot = slot.max(last_slot + 1);
|
||||||
last_slot = slot;
|
last_slot = slot;
|
||||||
|
|
||||||
let frame = if pixel == Pixel::BGRZ && width == cap_width && height == cap_height {
|
let frame = if pixel == Pixel::BGRZ && width == captured.width() && height == captured.height() {
|
||||||
&mut captured
|
&mut captured
|
||||||
} else {
|
} else {
|
||||||
if scaler.is_none() {
|
if scaler.is_none() {
|
||||||
scaler = Some(scaling::Context::get(Pixel::BGRZ, cap_width, cap_height, pixel, width, height, scaling::Flags::BILINEAR).map_err(text)?);
|
scaler = Some(scaling::Context::get(Pixel::BGRZ, captured.width(), captured.height(), pixel, width, height, scaling::Flags::BILINEAR).map_err(text)?);
|
||||||
}
|
}
|
||||||
if dirty {
|
if dirty {
|
||||||
if let Some(context) = scaler.as_mut() { context.run(&captured, &mut converted).map_err(text)?; }
|
if let Some(context) = scaler.as_mut() { context.run(&captured, &mut converted).map_err(text)?; }
|
||||||
|
|||||||
@@ -410,6 +410,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
let _audio_cleanup=virtual_audio::Cleanup;
|
let _audio_cleanup=virtual_audio::Cleanup;
|
||||||
log::info!("Starting uu-remote-linux host v{}...", env!("CARGO_PKG_VERSION"));
|
log::info!("Starting uu-remote-linux host v{}...", env!("CARGO_PKG_VERSION"));
|
||||||
|
|
||||||
|
if !desktop_backend::headless() && desktop_backend::detect()? == desktop_backend::DesktopBackend::X11 && desktop_backend::wayland_session_running() {
|
||||||
|
// X11 capture inside a Wayland session reads XWayland's root window: all black, no error (#61).
|
||||||
|
log::warn!("A Wayland session is running but the X11 backend is selected: the picture will be black. Run inside the Wayland session (WAYLAND_DISPLAY set, UU_DESKTOP_BACKEND=auto) or log in to the Xorg session");
|
||||||
|
}
|
||||||
let capture = Arc::new((if desktop_backend::headless() {
|
let capture = Arc::new((if desktop_backend::headless() {
|
||||||
Err("headless mode (UU_DESKTOP_BACKEND=none)".to_owned())
|
Err("headless mode (UU_DESKTOP_BACKEND=none)".to_owned())
|
||||||
} else if desktop_backend::detect()?==desktop_backend::DesktopBackend::Portal {
|
} else if desktop_backend::detect()?==desktop_backend::DesktopBackend::Portal {
|
||||||
|
|||||||
@@ -92,6 +92,8 @@ pub fn watch_locked() -> watch::Receiver<Option<bool>> {
|
|||||||
if locked.is_none() { session = None; } // session ended or changed: look it up again
|
if locked.is_none() { session = None; } // session ended or changed: look it up again
|
||||||
sender.send_if_modified(|current| if *current != locked {
|
sender.send_if_modified(|current| if *current != locked {
|
||||||
log::info!("Desktop lock state: {}", match locked { Some(true) => "locked", Some(false) => "unlocked", None => "unknown" });
|
log::info!("Desktop lock state: {}", match locked { Some(true) => "locked", Some(false) => "unlocked", None => "unknown" });
|
||||||
|
// The viewer only sees black frames while locked and gives no hint (#61).
|
||||||
|
if locked == Some(true) { log::info!("Desktop is locked: viewers see a black screen until it is unlocked (viewer 自动解锁被控端, or `loginctl unlock-session` on the host)"); }
|
||||||
*current = locked; true
|
*current = locked; true
|
||||||
} else { false });
|
} else { false });
|
||||||
std::thread::sleep(Duration::from_secs(1));
|
std::thread::sleep(Duration::from_secs(1));
|
||||||
|
|||||||
Reference in new issue
Block a user