fix is x11, on conn

Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
dignow
2023-10-21 13:10:51 +08:00
parent aa3c58917b
commit b3948910ff
7 changed files with 36 additions and 43 deletions

View File

@@ -18,8 +18,6 @@
// to-do:
// https://slhck.info/video/2017/03/01/rate-control.html
#[cfg(target_os = "linux")]
use super::display_service::IS_X11;
use super::{
display_service::{check_display_changed, get_display_info},
service::ServiceTmpl,
@@ -28,6 +26,8 @@ use super::{
};
#[cfg(target_os = "linux")]
use crate::common::SimpleCallOnReturn;
#[cfg(target_os = "linux")]
use crate::platform::linux::is_x11;
#[cfg(windows)]
use crate::{platform::windows::is_process_consent_running, privacy_win_mag};
use hbb_common::{
@@ -46,8 +46,6 @@ use scrap::{
vpxcodec::{VpxEncoderConfig, VpxVideoCodecId},
CodecName, Display, TraitCapturer,
};
#[cfg(target_os = "linux")]
use std::sync::atomic::Ordering;
#[cfg(windows)]
use std::sync::Once;
use std::{
@@ -329,7 +327,7 @@ fn get_capturer(
) -> ResultType<CapturerInfo> {
#[cfg(target_os = "linux")]
{
if !IS_X11.load(Ordering::SeqCst) {
if !is_x11() {
return super::wayland::get_capturer();
}
}
@@ -571,7 +569,7 @@ fn run(vs: VideoService) -> ResultType<()> {
#[cfg(target_os = "linux")]
{
would_block_count += 1;
if !IS_X11.load(Ordering::SeqCst) {
if !is_x11() {
if would_block_count >= 100 {
// to-do: Unknown reason for WouldBlock 100 times (seconds = 100 * 1 / fps)
// https://github.com/rustdesk/rustdesk/blob/63e6b2f8ab51743e77a151e2b7ff18816f5fa2fb/libs/scrap/src/common/wayland.rs#L81
@@ -751,7 +749,7 @@ fn handle_one_frame(
pub fn is_inited_msg() -> Option<Message> {
#[cfg(target_os = "linux")]
if !IS_X11.load(Ordering::SeqCst) {
if !is_x11() {
return super::wayland::is_inited();
}
None