mirror of
https://github.com/VallierDev/uu-remote-linux.git
synced 2026-11-16 16:50:41 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ddbc75bbf6 | ||
|
|
9fbe7d63c5 | ||
|
|
3a78491f25 | ||
|
|
fc8c10cde9 | ||
|
|
125baa8c8b | ||
|
|
c5aa238f73 | ||
|
|
3673d37c1e | ||
|
|
59a45e092b | ||
|
|
a870f7d041 | ||
|
|
367be30a0f |
No files matched your search
Generated
+56
-1
@@ -111,6 +111,12 @@ dependencies = [
|
||||
"rustversion",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "as-raw-xcb-connection"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b"
|
||||
|
||||
[[package]]
|
||||
name = "asn1-rs"
|
||||
version = "0.5.2"
|
||||
@@ -801,6 +807,16 @@ dependencies = [
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gethostname"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8"
|
||||
dependencies = [
|
||||
"rustix",
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.17"
|
||||
@@ -1210,6 +1226,12 @@ dependencies = [
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
|
||||
|
||||
[[package]]
|
||||
name = "litemap"
|
||||
version = "0.8.3"
|
||||
@@ -1885,6 +1907,19 @@ dependencies = [
|
||||
"nom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "1.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "891efababe418670775f199f0d233d84843c227a0949a883ce15b37c78d6629d"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls"
|
||||
version = "0.21.12"
|
||||
@@ -2614,7 +2649,7 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
||||
|
||||
[[package]]
|
||||
name = "uu-remote-linux"
|
||||
version = "0.1.4"
|
||||
version = "0.1.5"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"bytes",
|
||||
@@ -2636,6 +2671,7 @@ dependencies = [
|
||||
"tokio",
|
||||
"tokio-tungstenite",
|
||||
"webrtc",
|
||||
"x11rb",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3094,6 +3130,25 @@ version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc"
|
||||
|
||||
[[package]]
|
||||
name = "x11rb"
|
||||
version = "0.13.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414"
|
||||
dependencies = [
|
||||
"as-raw-xcb-connection",
|
||||
"gethostname",
|
||||
"libc",
|
||||
"rustix",
|
||||
"x11rb-protocol",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "x11rb-protocol"
|
||||
version = "0.13.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd"
|
||||
|
||||
[[package]]
|
||||
name = "x25519-dalek"
|
||||
version = "2.0.1"
|
||||
|
||||
+3
-2
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "uu-remote-linux"
|
||||
version = "0.1.4"
|
||||
version = "0.1.5"
|
||||
edition = "2021"
|
||||
authors = ["uu-remote-linux contributors"]
|
||||
description = "Unofficial Linux host for NetEase UU Remote: control a Linux desktop from the official clients"
|
||||
@@ -19,7 +19,7 @@ wayland = []
|
||||
portal = []
|
||||
# In-process capture and encoding through FFmpeg 6 libraries (libavcodec/libavdevice dev packages).
|
||||
# Off by default so release binaries do not link the build machine's libav.
|
||||
inproc-av = ["dep:ffmpeg-next"]
|
||||
inproc-av = ["dep:ffmpeg-next", "dep:x11rb"]
|
||||
|
||||
[dependencies]
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
@@ -41,6 +41,7 @@ log = "0.4"
|
||||
qrcode = { version = "0.14", default-features = false }
|
||||
env_logger = "0.11"
|
||||
ffmpeg-next = { version = "6.1", optional = true, default-features = false, features = ["codec", "format", "device", "software-scaling", "software-resampling"] }
|
||||
x11rb = { version = "0.13", features = ["damage", "shm", "allow-unsafe-code"], optional = true }
|
||||
|
||||
[build-dependencies]
|
||||
cc = "1.0"
|
||||
|
||||
+2
-2
@@ -62,8 +62,8 @@ Apart from GNOME on X11, these desktops have been tested in virtual machines so
|
||||
real hardware, please [open an issue](../../issues) with your distribution, desktop, GPU and the relevant lines from
|
||||
`journalctl --user -u uuremote-native.service`.
|
||||
|
||||
Wayland limits: single screen, fixed resolution. The portal backend does not support clipboard, screen wake or
|
||||
dynamic resolution yet. On the first connection the desktop asks for "Remote Desktop / Screen Sharing"
|
||||
Wayland limits: single screen, fixed resolution. The portal backend does not support screen wake or
|
||||
dynamic resolution yet; the clipboard syncs while the viewer's remote window has focus. On the first connection the desktop asks for "Remote Desktop / Screen Sharing"
|
||||
permission; the permission is remembered once granted.
|
||||
|
||||
## Not implemented / not supported
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
除 GNOME(X11)外,其余桌面目前都是在虚拟机里测试的。如果你在真机上遇到问题,欢迎[提交 issue](../../issues),
|
||||
请附上发行版、桌面环境、显卡型号和 `journalctl --user -u uuremote-native.service` 里的相关日志。
|
||||
|
||||
Wayland 下的限制:只支持单屏、固定分辨率;portal 后端暂不支持剪贴板、唤醒屏幕和动态分辨率。
|
||||
Wayland 下的限制:只支持单屏、固定分辨率;portal 后端暂不支持唤醒屏幕和动态分辨率;剪贴板只在控制端的远控窗口处于前台时同步。
|
||||
首次连接时,桌面会弹窗请求「远程桌面 / 屏幕共享」授权,同意后会记住授权。
|
||||
|
||||
## 尚未实现 / 不支持
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
修复长时间远控约 20 分钟后被断开的问题。/ Fixes sessions being dropped after ~20 minutes.
|
||||
|
||||
### 修复 / Fixed
|
||||
- **远控约 20 分钟后被云端断开**:官方客户端会定期(约每 5 分钟)通过信令刷新房间的重连凭证(`refresh_reconnect_key`),
|
||||
之前没有实现,云端大约 20 分钟后就会回收房间并断开连接。现在被控端会按官方节奏刷新;凭证只保存在内存中,不写日志。
|
||||
在测试虚拟机里长连接稳定运行 44 分钟以上(已越过原来的断开点),在 X11 实机上确认刷新被云端接受。
|
||||
Sessions were released by the cloud after ~20 minutes because the room's reconnect key was never refreshed. The host now
|
||||
refreshes it like the official clients (~every 5 minutes); the key stays in memory and is never logged.
|
||||
- 旧的信令连接在重连后会被正确关闭。/ Stale signaling connections are closed after a reconnect.
|
||||
|
||||
### 其他 / Other
|
||||
- 可选的进程内编码路径支持 XDamage:桌面静止时几乎不占 CPU 和带宽(`--features inproc-av`,默认关闭)(#7,感谢 @ferstar)。
|
||||
XDamage capture on the opt-in in-process path (#7, thanks @ferstar).
|
||||
- Wayland(portal)下双向剪贴板已在虚拟机中验收通过。注意:官方 Mac 客户端只在远控窗口处于前台(获得焦点)时接收被控端的剪贴板。
|
||||
Two-way clipboard on the portal backend passes in the VM; the official Mac viewer only accepts the host clipboard while the
|
||||
remote window has focus.
|
||||
- 更多信令诊断日志(不含任何凭证)。/ More signaling diagnostics (no credentials).
|
||||
|
||||
### 下载 / Download
|
||||
`uu-remote-linux-v0.1.5-x86_64-linux.tar.gz`:X11 版可执行文件(x86_64,glibc ≥ 2.35)。
|
||||
|
||||
**非官方项目,与网易无关。** / **Unofficial, not affiliated with NetEase.**
|
||||
@@ -0,0 +1,124 @@
|
||||
//! Damage-driven X11 capture for the in-process encoder: XDamage reports when the root window changed,
|
||||
//! XShm copies it out as 32-bit BGRX. Pure Rust over x11rb; only the SysV shared-memory calls use libc.
|
||||
use std::os::unix::io::AsRawFd;
|
||||
use std::time::{Duration, Instant};
|
||||
use x11rb::connection::{Connection, RequestConnection};
|
||||
use x11rb::protocol::damage::{self, ConnectionExt as _, ReportLevel};
|
||||
use x11rb::protocol::shm::{self, ConnectionExt as _};
|
||||
use x11rb::protocol::xproto::Window;
|
||||
use x11rb::rust_connection::RustConnection;
|
||||
use x11rb::NONE;
|
||||
|
||||
/// X11 ZPixmap image format.
|
||||
const Z_PIXMAP: u8 = 2;
|
||||
|
||||
pub struct DamageCapture {
|
||||
conn: RustConnection,
|
||||
root: Window,
|
||||
damage: damage::Damage,
|
||||
damage_event: u8,
|
||||
width: u16,
|
||||
height: u16,
|
||||
seg: shm::Seg,
|
||||
shm_ptr: *mut u8,
|
||||
len: usize,
|
||||
}
|
||||
|
||||
fn text(error: impl std::fmt::Display) -> String { error.to_string() }
|
||||
|
||||
impl DamageCapture {
|
||||
/// Connects to `display` and sets up XDamage and XShm. Errors name the missing extension or failed step.
|
||||
pub fn open(display: &str) -> Result<Self, String> {
|
||||
let (conn, screen_num) = RustConnection::connect(Some(display)).map_err(text)?;
|
||||
let damage_info = conn.extension_information(damage::X11_EXTENSION_NAME).map_err(text)?
|
||||
.ok_or("XDamage extension is missing")?;
|
||||
if conn.extension_information(shm::X11_EXTENSION_NAME).map_err(text)?.is_none() {
|
||||
return Err("XShm extension is missing".into());
|
||||
}
|
||||
conn.damage_query_version(1, 1).map_err(text)?.reply().map_err(text)?;
|
||||
|
||||
let setup = conn.setup();
|
||||
let screen = setup.roots.get(screen_num).ok_or("X screen not found")?;
|
||||
let (root, width, height, depth) = (screen.root, screen.width_in_pixels, screen.height_in_pixels, screen.root_depth);
|
||||
// The frame layout assumes packed 32-bit pixels; anything else would shear the picture.
|
||||
let format = setup.pixmap_formats.iter().find(|f| f.depth == depth).ok_or("no pixmap format for the root depth")?;
|
||||
if format.bits_per_pixel != 32 { return Err(format!("root depth {depth} is not 32 bits per pixel")); }
|
||||
let len = width as usize * height as usize * 4;
|
||||
|
||||
// NonEmpty: one event each time the root goes from clean to damaged; re-armed in `wait`.
|
||||
let damage = conn.generate_id().map_err(text)?;
|
||||
conn.damage_create(damage, root, ReportLevel::NON_EMPTY).map_err(text)?.check().map_err(text)?;
|
||||
|
||||
// Nothing below can fail without also releasing the local mapping, so every error path is covered here.
|
||||
let seg = conn.generate_id().map_err(text)?;
|
||||
let shmid = unsafe { libc::shmget(libc::IPC_PRIVATE, len, libc::IPC_CREAT | 0o600) };
|
||||
if shmid < 0 { return Err("shmget failed".into()); }
|
||||
let shm_ptr = unsafe { libc::shmat(shmid, std::ptr::null(), 0) } as *mut u8;
|
||||
if shm_ptr as isize == -1 {
|
||||
unsafe { libc::shmctl(shmid, libc::IPC_RMID, std::ptr::null_mut()) };
|
||||
return Err("shmat failed".into());
|
||||
}
|
||||
let attach = conn.shm_attach(seg, shmid as u32, false).map_err(text).and_then(|c| c.check().map_err(text));
|
||||
// Marked for removal either way; the kernel frees it after the last detach.
|
||||
unsafe { libc::shmctl(shmid, libc::IPC_RMID, std::ptr::null_mut()) };
|
||||
if let Err(error) = attach {
|
||||
unsafe { libc::shmdt(shm_ptr as *const libc::c_void) };
|
||||
return Err(error);
|
||||
}
|
||||
Ok(Self { conn, root, damage, damage_event: damage_info.first_event, width, height, seg, shm_ptr, len })
|
||||
}
|
||||
|
||||
pub fn size(&self) -> (u32, u32) { (self.width as u32, self.height as u32) }
|
||||
|
||||
/// Waits up to `timeout` for the screen to change. Returns `true` on change, `false` on timeout.
|
||||
pub fn wait(&mut self, timeout: Duration) -> Result<bool, String> {
|
||||
let deadline = Instant::now() + timeout;
|
||||
loop {
|
||||
let mut changed = false;
|
||||
while let Some(event) = self.conn.poll_for_raw_event().map_err(text)? {
|
||||
// XDamageNotify is the extension's first event; the wire code keeps the high bit for synthetic events.
|
||||
if event[0] & 0x7f == self.damage_event { changed = true; }
|
||||
}
|
||||
if changed {
|
||||
self.conn.damage_subtract(self.damage, NONE, NONE).map_err(text)?;
|
||||
self.conn.flush().map_err(text)?;
|
||||
return Ok(true);
|
||||
}
|
||||
let remaining = deadline.saturating_duration_since(Instant::now());
|
||||
if remaining.is_zero() { return Ok(false); }
|
||||
let mut pfd = libc::pollfd { fd: self.conn.stream().as_raw_fd(), events: libc::POLLIN, revents: 0 };
|
||||
match unsafe { libc::poll(&mut pfd, 1, remaining.as_millis().max(1) as i32) } {
|
||||
ready if ready < 0 => return Err("poll on the X connection failed".into()),
|
||||
// Readable but not yet a whole event: poll_for_raw_event would return None and poll would
|
||||
// fire again at once, spinning a core. Block for the event instead.
|
||||
ready if ready > 0 => {
|
||||
let event = self.conn.wait_for_raw_event().map_err(text)?;
|
||||
if event[0] & 0x7f == self.damage_event { changed = true; }
|
||||
if changed {
|
||||
self.conn.damage_subtract(self.damage, NONE, NONE).map_err(text)?;
|
||||
self.conn.flush().map_err(text)?;
|
||||
return Ok(true);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Copies the root into the shared segment and returns it as rows of `width * 4` bytes.
|
||||
/// The slice is valid until the next call.
|
||||
pub fn capture(&mut self) -> Result<&[u8], String> {
|
||||
self.conn.shm_get_image(self.root, 0, 0, self.width, self.height, !0, Z_PIXMAP, self.seg, 0)
|
||||
.map_err(text)?.reply().map_err(text)?;
|
||||
Ok(unsafe { std::slice::from_raw_parts(self.shm_ptr, self.len) })
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for DamageCapture {
|
||||
fn drop(&mut self) {
|
||||
let _ = self.conn.damage_destroy(self.damage);
|
||||
let _ = self.conn.shm_detach(self.seg);
|
||||
let _ = self.conn.flush();
|
||||
unsafe { libc::shmdt(self.shm_ptr as *const libc::c_void) };
|
||||
}
|
||||
}
|
||||
+116
-19
@@ -12,6 +12,8 @@ use ff::util::picture;
|
||||
use ff::{codec, encoder, frame, software::scaling, Dictionary, Packet, Rational};
|
||||
use tokio::sync::mpsc;
|
||||
|
||||
use crate::damage_capture::DamageCapture;
|
||||
|
||||
pub struct Config {
|
||||
pub display: String,
|
||||
pub input: (u32, u32),
|
||||
@@ -23,6 +25,8 @@ pub struct Config {
|
||||
pub max_bps: i64,
|
||||
pub buffer_bits: i64,
|
||||
pub gpu: bool,
|
||||
/// Capture on XDamage changes (XShm) instead of x11grab; `UU_CAPTURE=grab` turns it off.
|
||||
pub damage: bool,
|
||||
}
|
||||
|
||||
/// `UU_VIDEO_PIPELINE=process` keeps the original ffmpeg child-process path.
|
||||
@@ -30,6 +34,11 @@ pub fn disabled() -> bool {
|
||||
std::env::var("UU_VIDEO_PIPELINE").is_ok_and(|v| v == "process")
|
||||
}
|
||||
|
||||
/// Damage-driven capture is on unless `UU_CAPTURE=grab` asks for x11grab.
|
||||
pub fn damage_enabled() -> bool {
|
||||
std::env::var("UU_CAPTURE").map_or(true, |v| v != "grab")
|
||||
}
|
||||
|
||||
/// In-process capture is used unless the process path is requested, or a bundled FFmpeg prefix
|
||||
/// (`UU_FFMPEG_ROOT` / config `ffmpeg_root`) is set: that build was chosen on purpose, so keep using it.
|
||||
pub fn selected() -> bool {
|
||||
@@ -62,24 +71,8 @@ fn drain(encoder: &mut encoder::Video, packet: &mut Packet, units: &mpsc::Sender
|
||||
}
|
||||
}
|
||||
|
||||
/// Runs until `stop` is set or the receiver is dropped. A set `idr` flag forces the next frame to be an IDR.
|
||||
pub fn run(config: Config, units: mpsc::Sender<Vec<u8>>, stop: Arc<AtomicBool>, idr: Arc<AtomicBool>) -> Result<(), String> {
|
||||
ensure_init()?;
|
||||
let name = CString::new("x11grab").map_err(|e| e.to_string())?;
|
||||
let raw = unsafe { ff::sys::av_find_input_format(name.as_ptr()) };
|
||||
if raw.is_null() { return Err("x11grab input is not available in this FFmpeg build".into()); }
|
||||
let input_format = Format::Input(unsafe { ff::format::format::Input::wrap(raw as *mut _) });
|
||||
let mut capture_options = Dictionary::new();
|
||||
capture_options.set("framerate", &config.fps.to_string());
|
||||
capture_options.set("video_size", &format!("{}x{}", config.input.0, config.input.1));
|
||||
// The viewer draws its own pointer; do not bake a second one into the video.
|
||||
capture_options.set("draw_mouse", "0");
|
||||
let mut input = ff::format::open_with(&config.display, &input_format, capture_options).map_err(text)?.input();
|
||||
|
||||
let stream = input.streams().best(ff::media::Type::Video).ok_or("X11 capture has no video stream")?;
|
||||
let index = stream.index();
|
||||
let mut decoder = codec::context::Context::from_parameters(stream.parameters()).map_err(text)?.decoder().video().map_err(text)?;
|
||||
|
||||
/// Opens the H.264 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> {
|
||||
let (width, height) = config.output.unwrap_or(config.input);
|
||||
let codec = encoder::find_by_name(if config.gpu { "h264_nvenc" } else { "libx264" })
|
||||
.ok_or("H.264 encoder is not available in this FFmpeg build")?;
|
||||
@@ -119,7 +112,35 @@ pub fn run(config: Config, units: mpsc::Sender<Vec<u8>>, stop: Arc<AtomicBool>,
|
||||
options.set("crf", &cq);
|
||||
options.set("x264-params", &x264);
|
||||
}
|
||||
let mut encoder = context.open_as_with(codec, options).map_err(text)?;
|
||||
let encoder = context.open_as_with(codec, options).map_err(text)?;
|
||||
Ok((encoder, pixel, width, height))
|
||||
}
|
||||
|
||||
/// Runs until `stop` is set or the receiver is dropped. A set `idr` flag forces the next frame to be an IDR.
|
||||
pub fn run(config: Config, units: mpsc::Sender<Vec<u8>>, stop: Arc<AtomicBool>, idr: Arc<AtomicBool>) -> Result<(), String> {
|
||||
ensure_init()?;
|
||||
if config.damage {
|
||||
match DamageCapture::open(&config.display) {
|
||||
Ok(capture) => return run_damage(config, capture, units, stop, idr),
|
||||
Err(error) => log::warn!("Damage-driven capture unavailable, using x11grab: {error}"),
|
||||
}
|
||||
}
|
||||
let name = CString::new("x11grab").map_err(|e| e.to_string())?;
|
||||
let raw = unsafe { ff::sys::av_find_input_format(name.as_ptr()) };
|
||||
if raw.is_null() { return Err("x11grab input is not available in this FFmpeg build".into()); }
|
||||
let input_format = Format::Input(unsafe { ff::format::format::Input::wrap(raw as *mut _) });
|
||||
let mut capture_options = Dictionary::new();
|
||||
capture_options.set("framerate", &config.fps.to_string());
|
||||
capture_options.set("video_size", &format!("{}x{}", config.input.0, config.input.1));
|
||||
// The viewer draws its own pointer; do not bake a second one into the video.
|
||||
capture_options.set("draw_mouse", "0");
|
||||
let mut input = ff::format::open_with(&config.display, &input_format, capture_options).map_err(text)?.input();
|
||||
|
||||
let stream = input.streams().best(ff::media::Type::Video).ok_or("X11 capture has no video stream")?;
|
||||
let index = stream.index();
|
||||
let mut decoder = codec::context::Context::from_parameters(stream.parameters()).map_err(text)?.decoder().video().map_err(text)?;
|
||||
|
||||
let (mut encoder, pixel, width, height) = open_encoder(&config)?;
|
||||
|
||||
let mut scaler: Option<(scaling::Context, (Pixel, u32, u32))> = None;
|
||||
let mut decoded = frame::Video::empty();
|
||||
@@ -169,6 +190,82 @@ pub fn run(config: Config, units: mpsc::Sender<Vec<u8>>, stop: Arc<AtomicBool>,
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Damage-driven loop. Damage only marks the picture dirty; a dirty picture is captured and encoded on
|
||||
/// the next fixed frame tick, so the stream keeps a steady cadence while the screen moves. The viewer's
|
||||
/// jitter buffer grows with irregular arrivals, and irregular sends were what raised its latency.
|
||||
/// An idle screen sends a keepalive about once a second so the viewer still sees traffic.
|
||||
fn run_damage(config: Config, mut capture: DamageCapture, units: mpsc::Sender<Vec<u8>>, stop: Arc<AtomicBool>, idr: Arc<AtomicBool>) -> Result<(), String> {
|
||||
let (mut encoder, pixel, width, height) = open_encoder(&config)?;
|
||||
let (cap_width, cap_height) = capture.size();
|
||||
let mut captured = frame::Video::new(Pixel::BGRZ, cap_width, cap_height);
|
||||
let mut converted = frame::Video::new(pixel, width, height);
|
||||
let mut scaler = None;
|
||||
let mut packet = Packet::empty();
|
||||
let started = Instant::now();
|
||||
let frame_interval = Duration::from_nanos(1_000_000_000 / u64::from(config.fps));
|
||||
// Keepalive gaps are random between 15 and 25 fps: a steady 1 fps reads as a stall to the viewer.
|
||||
let mut seed = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map_or(1, |d| d.subsec_nanos()) | 1;
|
||||
let mut keepalive = random_keepalive(&mut seed);
|
||||
let mut dirty = true;
|
||||
let mut next_tick = Instant::now();
|
||||
let mut last_send = Instant::now();
|
||||
let mut last_slot: i64 = -1;
|
||||
loop {
|
||||
if stop.load(Ordering::Relaxed) { return Ok(()); }
|
||||
let deadline = if dirty { next_tick } else { last_send + keepalive };
|
||||
let wait = deadline.saturating_duration_since(Instant::now());
|
||||
// A change marks the picture dirty and falls through, so a client that damages the root constantly
|
||||
// cannot keep an overdue tick waiting.
|
||||
if capture.wait(wait.max(Duration::from_millis(1)))? { dirty = true; }
|
||||
let now = Instant::now();
|
||||
if dirty && now < next_tick { continue; }
|
||||
if !dirty && now < last_send + keepalive { continue; }
|
||||
|
||||
let source = capture.capture()?;
|
||||
let bytes_per_line = cap_width as usize * 4;
|
||||
let stride = captured.stride(0);
|
||||
let row = bytes_per_line.min(stride);
|
||||
for (y, src) in source.chunks_exact(bytes_per_line).enumerate() {
|
||||
captured.data_mut(0)[y * stride..y * stride + row].copy_from_slice(&src[..row]);
|
||||
}
|
||||
|
||||
let slot = ((started.elapsed().as_micros() * u128::from(config.fps) + 500_000) / 1_000_000) as i64;
|
||||
let slot = slot.max(last_slot + 1);
|
||||
last_slot = slot;
|
||||
|
||||
let frame = if pixel == Pixel::BGRZ && width == cap_width && height == cap_height {
|
||||
&mut captured
|
||||
} else {
|
||||
if scaler.is_none() {
|
||||
scaler = Some(scaling::Context::get(Pixel::BGRZ, cap_width, cap_height, pixel, width, height, scaling::Flags::BILINEAR).map_err(text)?);
|
||||
}
|
||||
if let Some(context) = scaler.as_mut() { context.run(&captured, &mut converted).map_err(text)?; }
|
||||
&mut converted
|
||||
};
|
||||
frame.set_pts(Some(slot));
|
||||
frame.set_kind(if idr.swap(false, Ordering::AcqRel) { picture::Type::I } else { picture::Type::None });
|
||||
encoder.send_frame(frame).map_err(text)?;
|
||||
if !drain(&mut encoder, &mut packet, &units)? { return Ok(()); }
|
||||
let now = Instant::now();
|
||||
if dirty {
|
||||
// Keep the tick phase; after a long idle, restart the phase from now instead of bursting to catch up.
|
||||
let next = next_tick + frame_interval;
|
||||
next_tick = if next > now { next } else { now + frame_interval };
|
||||
dirty = false;
|
||||
}
|
||||
last_send = now;
|
||||
keepalive = random_keepalive(&mut seed);
|
||||
}
|
||||
}
|
||||
|
||||
/// Picks the next keepalive gap in 40–67 ms (15–25 fps) with a small xorshift generator.
|
||||
fn random_keepalive(seed: &mut u32) -> Duration {
|
||||
*seed ^= *seed << 13;
|
||||
*seed ^= *seed >> 17;
|
||||
*seed ^= *seed << 5;
|
||||
Duration::from_micros(40_000 + u64::from(*seed % 26_700))
|
||||
}
|
||||
|
||||
/// Encodes a PulseAudio/PipeWire source to Opus in this process. Each Opus packet is sent as is.
|
||||
pub fn run_audio(source: &str, units: mpsc::Sender<bytes::Bytes>, stop: Arc<AtomicBool>) -> Result<(), String> {
|
||||
ensure_init()?;
|
||||
|
||||
@@ -22,6 +22,8 @@ mod terminal;
|
||||
mod webrtc;
|
||||
mod video;
|
||||
#[cfg(feature = "inproc-av")]
|
||||
mod damage_capture;
|
||||
#[cfg(feature = "inproc-av")]
|
||||
mod inproc_encoder;
|
||||
mod capture_setting;
|
||||
mod audio;
|
||||
|
||||
+122
-8
@@ -47,6 +47,51 @@ pub enum SignalingEvent {
|
||||
|
||||
pub struct SignalingClient {
|
||||
tx_outgoing: mpsc::Sender<String>,
|
||||
// Belongs to this room only; fresh-room reconnect must not reuse it.
|
||||
_reconnect_key: Arc<std::sync::Mutex<Option<String>>>,
|
||||
}
|
||||
|
||||
fn refreshed_key(ack:&Value)->Option<String> {
|
||||
let values=ack.as_array()?;
|
||||
if values.first()?.as_str()? != "success" { return None; }
|
||||
let key=values.get(1)?.get("reconnect_key")?.as_str()?;
|
||||
(!key.is_empty() && key.len()<=16384).then(||key.to_owned())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod refresh_tests {
|
||||
use super::refreshed_key;
|
||||
use serde_json::json;
|
||||
#[test]
|
||||
fn accepts_only_successful_complete_reconnect_key_ack() {
|
||||
assert_eq!(refreshed_key(&json!(["success",{"reconnect_key":"synthetic-key"}])),Some("synthetic-key".into()));
|
||||
for ack in [json!(["failure",{"reconnect_key":"synthetic-key"}]),json!(["success"]),json!(["success",{"reconnect_key":""}]),json!(["success",{"reconnect_key":123}]),json!({"reconnect_key":"synthetic-key"})] {
|
||||
assert!(refreshed_key(&ack).is_none());
|
||||
}
|
||||
}
|
||||
#[tokio::test]
|
||||
async fn closes_obsolete_socket_even_if_peer_retains_client() {
|
||||
use futures_util::{SinkExt,StreamExt};
|
||||
use tokio_tungstenite::tungstenite::Message;
|
||||
let listener=tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap();
|
||||
let address=listener.local_addr().unwrap();
|
||||
let server=tokio::spawn(async move {
|
||||
let (tcp,_)=listener.accept().await.unwrap();
|
||||
let mut socket=tokio_tungstenite::accept_async(tcp).await.unwrap();
|
||||
socket.send(Message::Text("0{}".into())).await.unwrap();
|
||||
assert_eq!(socket.next().await.unwrap().unwrap(),Message::Text("40".into()));
|
||||
socket.send(Message::Text("40{}".into())).await.unwrap();
|
||||
assert!(socket.next().await.unwrap().unwrap().into_text().unwrap().contains("room_info"));
|
||||
matches!(socket.next().await,None|Some(Err(_))|Some(Ok(Message::Close(_))))
|
||||
});
|
||||
let (sender,mut events)=tokio::sync::mpsc::channel(4);
|
||||
let retained=super::SignalingClient::connect(&format!("ws://{address}"),"synthetic-only",sender).await.unwrap();
|
||||
assert!(matches!(events.recv().await,Some(super::SignalingEvent::Connected)));
|
||||
drop(events);
|
||||
assert!(tokio::time::timeout(std::time::Duration::from_secs(2),server).await.unwrap().unwrap());
|
||||
// Retain it until after the server sees closure, just like PC callbacks.
|
||||
drop(retained);
|
||||
}
|
||||
}
|
||||
|
||||
impl SignalingClient {
|
||||
@@ -79,7 +124,7 @@ impl SignalingClient {
|
||||
let (tx_outgoing, mut rx_outgoing) = mpsc::channel::<String>(32);
|
||||
|
||||
// 发送协程
|
||||
tokio::spawn(async move {
|
||||
let writer=tokio::spawn(async move {
|
||||
while let Some(msg) = rx_outgoing.recv().await {
|
||||
if let Err(e) = write.send(Message::Text(msg)).await {
|
||||
log::warn!("WS send error: {}", e);
|
||||
@@ -89,23 +134,66 @@ impl SignalingClient {
|
||||
});
|
||||
|
||||
let tx_out_clone = tx_outgoing.clone();
|
||||
static GENERATION: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(1);
|
||||
let generation=GENERATION.fetch_add(1,std::sync::atomic::Ordering::Relaxed);
|
||||
let reconnect_key=Arc::new(std::sync::Mutex::new(None));
|
||||
let refreshed=reconnect_key.clone();
|
||||
|
||||
// 接收与状态机协程
|
||||
tokio::spawn(async move {
|
||||
let mut req_counter = 10;
|
||||
let started=std::time::Instant::now();
|
||||
let mut last_ping=started;
|
||||
let mut pings=0u64;
|
||||
let mut pong_queued=0u64;
|
||||
let mut connected=false;
|
||||
let mut next_refresh=tokio::time::Instant::now()+std::time::Duration::from_secs(30);
|
||||
let mut refresh_acks=std::collections::VecDeque::new();
|
||||
let mut accepted_refresh=0;
|
||||
// Socket.IO binary event awaiting attachments: (event name, header JSON).
|
||||
let mut pending_binary: Option<(String, Value)> = None;
|
||||
while let Some(msg_res) = read.next().await {
|
||||
loop {
|
||||
let msg_res=tokio::select! {
|
||||
_=event_sender.closed()=>break,
|
||||
// Official ControlledSession RefreshSignalTokenLoop: first
|
||||
// 30s, success every ~300s, failure retry after 30s. Native
|
||||
// libstreamer 0x885774 / 0x885e58; emit has NO payload args.
|
||||
_=tokio::time::sleep_until(next_refresh), if connected => {
|
||||
req_counter+=1;
|
||||
refresh_acks.push_back(req_counter);
|
||||
if refresh_acks.len()>16 { refresh_acks.pop_front(); }
|
||||
let packet=format!("42{}[\"refresh_reconnect_key\"]",req_counter);
|
||||
if tx_out_clone.send(packet).await.is_err() {
|
||||
let _=event_sender.send(SignalingEvent::Disconnected).await;break;
|
||||
}
|
||||
next_refresh=tokio::time::Instant::now()+std::time::Duration::from_secs(30);
|
||||
log::info!("Signaling reconnect-key refresh requested: generation={} age_s={}",generation,started.elapsed().as_secs());
|
||||
continue;
|
||||
},
|
||||
msg=read.next()=>match msg {
|
||||
Some(msg)=>msg,
|
||||
None=>{let _=event_sender.send(SignalingEvent::Disconnected).await;break;}
|
||||
},
|
||||
};
|
||||
match msg_res {
|
||||
Ok(Message::Text(txt)) => {
|
||||
// Engine.IO 报文处理
|
||||
if txt.starts_with('0') {
|
||||
if let Ok(open)=serde_json::from_str::<Value>(&txt[1..]) {
|
||||
log::info!("Signaling heartbeat config: generation={} ping_interval_ms={:?} ping_timeout_ms={:?}",generation,open.get("pingInterval").and_then(Value::as_u64),open.get("pingTimeout").and_then(Value::as_u64));
|
||||
}
|
||||
// Open packet -> 发送 Socket.IO connect
|
||||
let _ = tx_out_clone.send("40".into()).await;
|
||||
} else if txt == "2" {
|
||||
// Ping -> 回复 Pong
|
||||
let _ = tx_out_clone.send("3".into()).await;
|
||||
let gap=last_ping.elapsed().as_secs();last_ping=std::time::Instant::now();pings+=1;
|
||||
if tx_out_clone.send("3".into()).await.is_ok() { pong_queued+=1; }
|
||||
if pings==1 || pings%12==0 {
|
||||
log::info!("Signaling heartbeat progress: generation={} age_s={} pings={} pong_queued={} gap_s={}",generation,started.elapsed().as_secs(),pings,pong_queued,gap);
|
||||
}
|
||||
} else if txt.starts_with("40") {
|
||||
connected=true;
|
||||
next_refresh=tokio::time::Instant::now()+std::time::Duration::from_secs(30);
|
||||
// Socket.IO connected -> 发送 room_info 请求
|
||||
req_counter += 1;
|
||||
let room_req = format!("42{}[\"room_info\"]", req_counter);
|
||||
@@ -113,9 +201,23 @@ impl SignalingClient {
|
||||
let _ = event_sender.send(SignalingEvent::Connected).await;
|
||||
} else if txt.starts_with("43") {
|
||||
// Socket.IO ack 回调
|
||||
let payload = &txt[txt.find('[').unwrap_or(2)..];
|
||||
let begin=txt.find('[').unwrap_or(2);
|
||||
let ack_id=txt[2..begin].parse::<u64>().ok();
|
||||
let payload = &txt[begin..];
|
||||
if let Ok(v) = serde_json::from_str::<Value>(payload) {
|
||||
let _ = event_sender.send(SignalingEvent::RoomInfoAck(v)).await;
|
||||
if let Some(id)=ack_id.filter(|id|refresh_acks.contains(id)) {
|
||||
refresh_acks.retain(|pending|*pending!=id);
|
||||
let key=refreshed_key(&v);
|
||||
let success=key.is_some();
|
||||
// Accept a delayed retry response, but never replace
|
||||
// a newer key with an older successful response.
|
||||
if success && id>accepted_refresh {
|
||||
accepted_refresh=id;
|
||||
*refreshed.lock().unwrap()=key;
|
||||
next_refresh=tokio::time::Instant::now()+std::time::Duration::from_secs(300);
|
||||
}
|
||||
log::info!("Signaling reconnect-key refresh acknowledged: generation={} age_s={} success={}",generation,started.elapsed().as_secs(),success);
|
||||
} else { let _ = event_sender.send(SignalingEvent::RoomInfoAck(v)).await; }
|
||||
}
|
||||
} else if txt.starts_with("45") || txt.starts_with("46") {
|
||||
// Socket.IO binary event/ack: header text, attachments follow as binary frames.
|
||||
@@ -170,14 +272,16 @@ impl SignalingClient {
|
||||
}
|
||||
}
|
||||
"released" => {
|
||||
log::info!("Cloud peer event: generation={} event=released age_s={} pings={} last_ping_gap_s={} ice_id_present={}",generation,started.elapsed().as_secs(),pings,last_ping.elapsed().as_secs(),data.get("ice_id").is_some());
|
||||
let _ = event_sender
|
||||
.send(SignalingEvent::Released(data.clone()))
|
||||
.await;
|
||||
}
|
||||
"left" | "leave" => {
|
||||
log::info!("Cloud peer event: generation={} event={} age_s={} pings={} last_ping_gap_s={} ice_id_present={}",generation,event_name,started.elapsed().as_secs(),pings,last_ping.elapsed().as_secs(),data.get("ice_id").is_some());
|
||||
let ice_id = data.get("ice_id").and_then(|v| v.as_str()).unwrap_or("");
|
||||
if ice_id.is_empty() {
|
||||
log::warn!("Room expired from NetEase cloud (leave event). Triggering room renewal...");
|
||||
log::warn!("Cloud room leave without peer identifier; renewing signaling (expiry cause unknown)");
|
||||
let _ = event_sender.send(SignalingEvent::Disconnected).await;
|
||||
} else {
|
||||
let _ = event_sender
|
||||
@@ -212,16 +316,26 @@ impl SignalingClient {
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(Message::Close(_)) | Err(_) => {
|
||||
Ok(Message::Close(frame)) => {
|
||||
log::warn!("Signaling socket closed: generation={} age_s={} close_code={:?} pings={} last_ping_gap_s={}",generation,started.elapsed().as_secs(),frame.map(|f|u16::from(f.code)),pings,last_ping.elapsed().as_secs());
|
||||
let _ = event_sender.send(SignalingEvent::Disconnected).await;
|
||||
break;
|
||||
}
|
||||
Err(_) => {
|
||||
log::warn!("Signaling socket receive failed: generation={} age_s={} pings={} last_ping_gap_s={}",generation,started.elapsed().as_secs(),pings,last_ping.elapsed().as_secs());
|
||||
let _ = event_sender.send(SignalingEvent::Disconnected).await;
|
||||
break;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
log::info!("Signaling receiver stopped: generation={} age_s={}",generation,started.elapsed().as_secs());
|
||||
// Live peer callbacks can retain the old SignalingClient sender.
|
||||
// Explicitly drop its write half too when this room stops reading.
|
||||
writer.abort();
|
||||
});
|
||||
|
||||
Ok(Self { tx_outgoing })
|
||||
Ok(Self { tx_outgoing, _reconnect_key:reconnect_key })
|
||||
}
|
||||
|
||||
pub async fn emit_event(&self, event: &str, payload: serde_json::Value) -> Result<(), String> {
|
||||
|
||||
@@ -179,6 +179,7 @@ async fn read_encoder_with(
|
||||
gop: gop_frames(settings.fps, true) as u32, cq: settings.cq() as u32,
|
||||
target_bps: settings.max_kbps().map_or(16_000, |k| i64::from(k) * 3 / 4) * 1000,
|
||||
max_bps: max_kbps * 1000, buffer_bits: (max_kbps / 8).clamp(100, 500) * 1000, gpu,
|
||||
damage: crate::inproc_encoder::damage_enabled(),
|
||||
};
|
||||
log::info!("Desktop encoder: display={} source={}x{} output={:?} fps={} cq={} maxrate={}k encoder={} pipeline=in-process",
|
||||
display,size.0,size.1,settings.output,settings.fps,config.cq,max_kbps,if gpu{"h264_nvenc"}else{"libx264"});
|
||||
|
||||
+5
-1
@@ -198,7 +198,11 @@ impl WebRtcSession {
|
||||
feedback_counts.observe(packet.as_any());
|
||||
if packet.as_any().is::<webrtc::rtcp::payload_feedbacks::picture_loss_indication::PictureLossIndication>()
|
||||
|| packet.as_any().is::<webrtc::rtcp::payload_feedbacks::full_intra_request::FullIntraRequest>() {
|
||||
idr_on_feedback.store(true, std::sync::atomic::Ordering::Release);
|
||||
// Dedupe only while an IDR is pending; the encoder clears the flag when it emits one,
|
||||
// so a lost IDR does not block the next recovery request.
|
||||
if !idr_on_feedback.load(std::sync::atomic::Ordering::Acquire) {
|
||||
idr_on_feedback.store(true, std::sync::atomic::Ordering::Release);
|
||||
}
|
||||
}
|
||||
if let Some(report) = packet.as_any().downcast_ref::<webrtc::rtcp::receiver_report::ReceiverReport>() {
|
||||
reports += 1;
|
||||
|
||||
+15
-1
@@ -6,6 +6,17 @@ final class MarkerCheck: NSObject {
|
||||
let kde = NSTextField(labelWithString: "KDE → Mac: not checked")
|
||||
let copied = NSTextField(labelWithString: "Mac marker: not copied")
|
||||
let formats = NSTextField(labelWithString: "Known text formats: not checked")
|
||||
// The official viewer drops remote format offers before ACK unless its
|
||||
// remote window is key (viewer 0x100380f20 -> isKeyWindow). A delayed
|
||||
// marker-only comparison lets it stay key throughout negotiation.
|
||||
@objc func armGnome() {
|
||||
gnome.stringValue = "GNOME → Mac: armed; return to UU and copy VM marker"
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 15) { self.compareGnome() }
|
||||
}
|
||||
@objc func armKde() {
|
||||
kde.stringValue = "KDE → Mac: armed; return to UU and copy VM marker"
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 15) { self.compareKde() }
|
||||
}
|
||||
@objc func copyMarker() {
|
||||
NSPasteboard.general.clearContents()
|
||||
let ok = NSPasteboard.general.setString("UU-Mac-to-VM 中文🙂", forType: .string)
|
||||
@@ -32,14 +43,17 @@ final class MarkerCheck: NSObject {
|
||||
NSButton(title: title, target: self, action: action)
|
||||
}
|
||||
func show() {
|
||||
let window = NSWindow(contentRect: NSRect(x: 0,y: 0,width: 500,height: 360), styleMask: [.titled,.closable], backing: .buffered, defer: false)
|
||||
let window = NSWindow(contentRect: NSRect(x: 0,y: 0,width: 620,height: 500), styleMask: [.titled,.closable], backing: .buffered, defer: false)
|
||||
window.title = "UU synthetic clipboard acceptance"
|
||||
window.isReleasedWhenClosed = false
|
||||
let stack = NSStackView(views: [
|
||||
NSTextField(labelWithString: "Only fixed test-marker matches are displayed."),
|
||||
NSTextField(labelWithString: "Keep the UU remote window key until format ACK / text request."),
|
||||
button("Copy Mac test marker", #selector(copyMarker)), copied,
|
||||
button("Compare GNOME VM marker", #selector(compareGnome)), gnome,
|
||||
button("Compare KDE VM marker", #selector(compareKde)), kde, formats,
|
||||
button("Arm GNOME comparison in 15 seconds", #selector(armGnome)),
|
||||
button("Arm KDE comparison in 15 seconds", #selector(armKde)),
|
||||
button("Quit test fixture", #selector(quit))])
|
||||
stack.orientation = .vertical; stack.spacing = 14
|
||||
stack.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
||||
Vendored
+7
-3
@@ -1,5 +1,5 @@
|
||||
"""Hold an ephemeral idle inhibition only in the isolated QEMU acceptance VM."""
|
||||
import pathlib,subprocess,signal,threading,sys
|
||||
import pathlib,subprocess,signal,threading,sys,os
|
||||
assert pathlib.Path('/proc/sys/kernel/hostname').read_text().strip()=='uu-hyprland-test'
|
||||
assert subprocess.check_output(['systemd-detect-virt'],text=True).strip()=='qemu'
|
||||
import gi
|
||||
@@ -7,7 +7,11 @@ gi.require_version('Gio','2.0')
|
||||
from gi.repository import Gio,GLib
|
||||
seconds=min(4200,max(1,int(sys.argv[1]) if len(sys.argv)>1 else 3600))
|
||||
bus=Gio.bus_get_sync(Gio.BusType.SESSION,None)
|
||||
reply=bus.call_sync('org.freedesktop.ScreenSaver','/ScreenSaver','org.freedesktop.ScreenSaver','Inhibit',GLib.Variant('(ss)',('UU isolated acceptance','Timed live-connection acceptance')),GLib.VariantType.new('(u)'),Gio.DBusCallFlags.NONE,3000,None)
|
||||
gnome='GNOME' in os.environ.get('XDG_CURRENT_DESKTOP','').upper().split(':')
|
||||
destination='org.gnome.SessionManager' if gnome else 'org.freedesktop.ScreenSaver'
|
||||
object_path='/org/gnome/SessionManager' if gnome else '/ScreenSaver'
|
||||
parameters=GLib.Variant('(susu)',('UU isolated acceptance',0,'Timed live-connection acceptance',8)) if gnome else GLib.Variant('(ss)',('UU isolated acceptance','Timed live-connection acceptance'))
|
||||
reply=bus.call_sync(destination,object_path,destination,'Inhibit',parameters,GLib.VariantType.new('(u)'),Gio.DBusCallFlags.NONE,3000,None)
|
||||
cookie=reply.unpack()[0]
|
||||
stop=threading.Event()
|
||||
signal.signal(signal.SIGTERM,lambda *_:stop.set())
|
||||
@@ -16,6 +20,6 @@ print('VM timed idle inhibition acquired',flush=True)
|
||||
try:stop.wait(seconds)
|
||||
finally:
|
||||
try:
|
||||
bus.call_sync('org.freedesktop.ScreenSaver','/ScreenSaver','org.freedesktop.ScreenSaver','UnInhibit',GLib.Variant('(u)',(cookie,)),None,Gio.DBusCallFlags.NONE,3000,None)
|
||||
bus.call_sync(destination,object_path,destination,'Uninhibit' if gnome else 'UnInhibit',GLib.Variant('(u)',(cookie,)),None,Gio.DBusCallFlags.NONE,3000,None)
|
||||
print('VM timed idle inhibition released',flush=True)
|
||||
except GLib.Error:print('VM idle inhibition connection closed',flush=True)
|
||||
Reference in new issue
Block a user