Option allow-d3d-render and fix ios ci (#11107)

* option `allow-d3d-render`, default false

Add this option because it fails on some machines

Signed-off-by: 21pages <sunboeasy@gmail.com>

* only add nokhwa to windows and linux dependencies

Signed-off-by: 21pages <sunboeasy@gmail.com>

---------

Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages 2025-03-13 09:34:13 +08:00 committed by GitHub
parent 1403c939db
commit d1c8b331c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
60 changed files with 204 additions and 43 deletions

View file

@ -78,6 +78,7 @@ const String kOptionScrollStyle = "scroll_style";
const String kOptionImageQuality = "image_quality"; const String kOptionImageQuality = "image_quality";
const String kOptionOpenNewConnInTabs = "enable-open-new-connections-in-tabs"; const String kOptionOpenNewConnInTabs = "enable-open-new-connections-in-tabs";
const String kOptionTextureRender = "use-texture-render"; const String kOptionTextureRender = "use-texture-render";
const String kOptionD3DRender = "allow-d3d-render";
const String kOptionOpenInTabs = "allow-open-in-tabs"; const String kOptionOpenInTabs = "allow-open-in-tabs";
const String kOptionOpenInWindows = "allow-open-in-windows"; const String kOptionOpenInWindows = "allow-open-in-windows";
const String kOptionForceAlwaysRelay = "force-always-relay"; const String kOptionForceAlwaysRelay = "force-always-relay";

View file

@ -496,6 +496,16 @@ class _GeneralState extends State<_General> {
await bind.mainSetLocalOption(key: k, value: v ? 'Y' : 'N'), await bind.mainSetLocalOption(key: k, value: v ? 'Y' : 'N'),
), ),
), ),
if (isWindows)
Tooltip(
message: translate('d3d_render_tip'),
child: _OptionCheckBox(
context,
"Use D3D rendering",
kOptionD3DRender,
isServer: false,
),
),
if (!isWeb && !bind.isCustomClient()) if (!isWeb && !bind.isCustomClient())
_OptionCheckBox( _OptionCheckBox(
context, context,

@ -1 +1 @@
Subproject commit 7cf11f7b771e27ecbd14fd1dd0ced55a64f40eb5 Subproject commit 1819875476d487612a654099881b8a16f4337599

View file

@ -23,7 +23,6 @@ lazy_static = "1.4"
hbb_common = { path = "../hbb_common" } hbb_common = { path = "../hbb_common" }
webm = { git = "https://github.com/rustdesk-org/rust-webm" } webm = { git = "https://github.com/rustdesk-org/rust-webm" }
serde = {version="1.0", features=["derive"]} serde = {version="1.0", features=["derive"]}
nokhwa = { git = "https://github.com/rustdesk-org/nokhwa.git", branch = "fix_from_raw_parts", features = ["input-native"] }
[dependencies.winapi] [dependencies.winapi]
version = "0.3" version = "0.3"
@ -63,3 +62,6 @@ gstreamer-video = { version = "0.16", optional = true }
git = "https://github.com/rustdesk-org/hwcodec" git = "https://github.com/rustdesk-org/hwcodec"
optional = true optional = true
[target.'cfg(any(target_os = "windows", target_os = "linux"))'.dependencies]
nokhwa = { git = "https://github.com/rustdesk-org/nokhwa.git", branch = "fix_from_raw_parts", features = ["input-native"] }

View file

@ -3,6 +3,7 @@ use std::{
sync::{Arc, Mutex}, sync::{Arc, Mutex},
}; };
#[cfg(any(target_os = "windows", target_os = "linux"))]
use nokhwa::{ use nokhwa::{
pixel_format::RgbAFormat, pixel_format::RgbAFormat,
query, query,
@ -23,6 +24,9 @@ lazy_static::lazy_static! {
static ref SYNC_CAMERA_DISPLAYS: Arc<Mutex<Vec<DisplayInfo>>> = Arc::new(Mutex::new(Vec::new())); static ref SYNC_CAMERA_DISPLAYS: Arc<Mutex<Vec<DisplayInfo>>> = Arc::new(Mutex::new(Vec::new()));
} }
#[cfg(not(any(target_os = "windows", target_os = "linux")))]
const CAMERA_NOT_SUPPORTED: &str = "This platform doesn't support camera yet";
pub struct Cameras; pub struct Cameras;
// pre-condition // pre-condition
@ -30,12 +34,9 @@ pub fn primary_camera_exists() -> bool {
Cameras::exists(PRIMARY_CAMERA_IDX) Cameras::exists(PRIMARY_CAMERA_IDX)
} }
#[cfg(any(target_os = "windows", target_os = "linux"))]
impl Cameras { impl Cameras {
pub fn all_info() -> ResultType<Vec<DisplayInfo>> { pub fn all_info() -> ResultType<Vec<DisplayInfo>> {
// TODO: support more platforms.
#[cfg(not(any(target_os = "linux", target_os = "windows")))]
return Ok(Vec::new());
match query(ApiBackend::Auto) { match query(ApiBackend::Auto) {
Ok(cameras) => { Ok(cameras) => {
let mut camera_displays = SYNC_CAMERA_DISPLAYS.lock().unwrap(); let mut camera_displays = SYNC_CAMERA_DISPLAYS.lock().unwrap();
@ -102,10 +103,6 @@ impl Cameras {
} }
pub fn exists(index: usize) -> bool { pub fn exists(index: usize) -> bool {
// TODO: support more platforms.
#[cfg(not(any(target_os = "linux", target_os = "windows")))]
return false;
match query(ApiBackend::Auto) { match query(ApiBackend::Auto) {
Ok(cameras) => index < cameras.len(), Ok(cameras) => index < cameras.len(),
_ => return false, _ => return false,
@ -113,10 +110,6 @@ impl Cameras {
} }
fn create_camera(index: &CameraIndex) -> ResultType<Camera> { fn create_camera(index: &CameraIndex) -> ResultType<Camera> {
// TODO: support more platforms.
#[cfg(not(any(target_os = "linux", target_os = "windows")))]
bail!("This platform doesn't support camera yet");
let result = Camera::new( let result = Camera::new(
index.clone(), index.clone(),
RequestedFormat::new::<RgbAFormat>(RequestedFormatType::AbsoluteHighestResolution), RequestedFormat::new::<RgbAFormat>(RequestedFormatType::AbsoluteHighestResolution),
@ -147,13 +140,41 @@ impl Cameras {
} }
} }
#[cfg(not(any(target_os = "windows", target_os = "linux")))]
impl Cameras {
pub fn all_info() -> ResultType<Vec<DisplayInfo>> {
return Ok(Vec::new());
}
pub fn exists(index: usize) -> bool {
false
}
pub fn get_camera_resolution(index: usize) -> ResultType<Resolution> {
bail!(CAMERA_NOT_SUPPORTED);
}
pub fn get_sync_cameras() -> Vec<DisplayInfo> {
vec![]
}
pub fn get_capturer(current: usize) -> ResultType<Box<dyn TraitCapturer>> {
bail!(CAMERA_NOT_SUPPORTED);
}
}
#[cfg(any(target_os = "windows", target_os = "linux"))]
pub struct CameraCapturer { pub struct CameraCapturer {
camera: Camera, camera: Camera,
data: Vec<u8>, data: Vec<u8>,
last_data: Vec<u8>, // for faster compare and copy last_data: Vec<u8>, // for faster compare and copy
} }
#[cfg(not(any(target_os = "windows", target_os = "linux")))]
pub struct CameraCapturer;
impl CameraCapturer { impl CameraCapturer {
#[cfg(any(target_os = "windows", target_os = "linux"))]
fn new(current: usize) -> ResultType<Self> { fn new(current: usize) -> ResultType<Self> {
let index = CameraIndex::Index(current as u32); let index = CameraIndex::Index(current as u32);
let camera = Cameras::create_camera(&index)?; let camera = Cameras::create_camera(&index)?;
@ -163,9 +184,15 @@ impl CameraCapturer {
last_data: Vec::new(), last_data: Vec::new(),
}) })
} }
#[cfg(not(any(target_os = "windows", target_os = "linux")))]
fn new(_current: usize) -> ResultType<Self> {
bail!(CAMERA_NOT_SUPPORTED);
}
} }
impl TraitCapturer for CameraCapturer { impl TraitCapturer for CameraCapturer {
#[cfg(any(target_os = "windows", target_os = "linux"))]
fn frame<'a>(&'a mut self, _timeout: std::time::Duration) -> std::io::Result<Frame<'a>> { fn frame<'a>(&'a mut self, _timeout: std::time::Duration) -> std::io::Result<Frame<'a>> {
// TODO: move this check outside `frame`. // TODO: move this check outside `frame`.
if !self.camera.is_stream_open() { if !self.camera.is_stream_open() {
@ -212,6 +239,14 @@ impl TraitCapturer for CameraCapturer {
} }
} }
#[cfg(not(any(target_os = "windows", target_os = "linux")))]
fn frame<'a>(&'a mut self, _timeout: std::time::Duration) -> std::io::Result<Frame<'a>> {
Err(io::Error::new(
io::ErrorKind::Other,
CAMERA_NOT_SUPPORTED.to_string(),
))
}
#[cfg(windows)] #[cfg(windows)]
fn is_gdi(&self) -> bool { fn is_gdi(&self) -> bool {
false false

View file

@ -864,7 +864,7 @@ pub fn enable_vram_option(encode: bool) -> bool {
if encode { if encode {
enable && enable_directx_capture() enable && enable_directx_capture()
} else { } else {
enable enable && allow_d3d_render()
} }
} else { } else {
false false
@ -874,10 +874,13 @@ pub fn enable_vram_option(encode: bool) -> bool {
#[cfg(windows)] #[cfg(windows)]
pub fn enable_directx_capture() -> bool { pub fn enable_directx_capture() -> bool {
use hbb_common::config::keys::OPTION_ENABLE_DIRECTX_CAPTURE as OPTION; use hbb_common::config::keys::OPTION_ENABLE_DIRECTX_CAPTURE as OPTION;
option2bool( option2bool(OPTION, &Config::get_option(OPTION))
OPTION, }
&Config::get_option(hbb_common::config::keys::OPTION_ENABLE_DIRECTX_CAPTURE),
) #[cfg(windows)]
pub fn allow_d3d_render() -> bool {
use hbb_common::config::keys::OPTION_ALLOW_D3D_RENDER as OPTION;
option2bool(OPTION, &hbb_common::config::LocalConfig::get_option(OPTION))
} }
pub const BR_BEST: f32 = 1.5; pub const BR_BEST: f32 = 1.5;

View file

@ -48,8 +48,9 @@ pub use self::convert::*;
pub const STRIDE_ALIGN: usize = 64; // commonly used in libvpx vpx_img_alloc caller pub const STRIDE_ALIGN: usize = 64; // commonly used in libvpx vpx_img_alloc caller
pub const HW_STRIDE_ALIGN: usize = 0; // recommended by av_frame_get_buffer pub const HW_STRIDE_ALIGN: usize = 0; // recommended by av_frame_get_buffer
pub mod camera;
pub mod aom; pub mod aom;
#[cfg(not(any(target_os = "ios")))]
pub mod camera;
pub mod record; pub mod record;
mod vpx; mod vpx;

View file

@ -25,7 +25,8 @@ pub struct RecorderContext {
pub server: bool, pub server: bool,
pub id: String, pub id: String,
pub dir: String, pub dir: String,
pub video_service_name: String, pub display_idx: usize,
pub camera: bool,
pub tx: Option<Sender<RecordState>>, pub tx: Option<Sender<RecordState>>,
} }
@ -46,7 +47,11 @@ impl RecorderContext2 {
+ "_" + "_"
+ &ctx.id.clone() + &ctx.id.clone()
+ &chrono::Local::now().format("_%Y%m%d%H%M%S%3f_").to_string() + &chrono::Local::now().format("_%Y%m%d%H%M%S%3f_").to_string()
+ &format!("{}_", ctx.video_service_name) + &format!(
"{}{}_",
if ctx.camera { "camera" } else { "display" },
ctx.display_idx
)
+ &self.format.to_string().to_lowercase() + &self.format.to_string().to_lowercase()
+ if self.format == CodecFormat::VP9 + if self.format == CodecFormat::VP9
|| self.format == CodecFormat::VP8 || self.format == CodecFormat::VP8

View file

@ -1389,14 +1389,15 @@ impl VideoHandler {
} }
/// Start or stop screen record. /// Start or stop screen record.
pub fn record_screen(&mut self, start: bool, id: String, video_service_name: String) { pub fn record_screen(&mut self, start: bool, id: String, display_idx: usize, camera: bool) {
self.record = false; self.record = false;
if start { if start {
self.recorder = Recorder::new(RecorderContext { self.recorder = Recorder::new(RecorderContext {
server: false, server: false,
id, id,
dir: crate::ui_interface::video_save_directory(false), dir: crate::ui_interface::video_save_directory(false),
video_service_name, display_idx,
camera,
tx: None, tx: None,
}) })
.map_or(Default::default(), |r| Arc::new(Mutex::new(Some(r)))); .map_or(Default::default(), |r| Arc::new(Mutex::new(Some(r))));
@ -2437,14 +2438,7 @@ pub fn start_video_thread<F, T>(
{ {
let mut video_callback = video_callback; let mut video_callback = video_callback;
let mut last_chroma = None; let mut last_chroma = None;
let video_service_name = crate::video_service::get_service_name( let is_view_camera = session.is_view_camera();
if session.is_view_camera() {
crate::video_service::VideoSource::Camera
} else {
crate::video_service::VideoSource::Monitor
},
display,
);
std::thread::spawn(move || { std::thread::spawn(move || {
#[cfg(windows)] #[cfg(windows)]
@ -2487,7 +2481,7 @@ pub fn start_video_thread<F, T>(
let record_permission = session.lc.read().unwrap().record_permission; let record_permission = session.lc.read().unwrap().record_permission;
let id = session.lc.read().unwrap().id.clone(); let id = session.lc.read().unwrap().id.clone();
if record_state && record_permission { if record_state && record_permission {
handler.record_screen(true, id, video_service_name.clone()); handler.record_screen(true, id, display, is_view_camera);
} }
video_handler = Some(handler); video_handler = Some(handler);
} }
@ -2568,7 +2562,7 @@ pub fn start_video_thread<F, T>(
MediaData::RecordScreen(start) => { MediaData::RecordScreen(start) => {
let id = session.lc.read().unwrap().id.clone(); let id = session.lc.read().unwrap().id.clone();
if let Some(handler) = video_handler.as_mut() { if let Some(handler) = video_handler.as_mut() {
handler.record_screen(start, id, video_service_name.clone()); handler.record_screen(start, id, display, is_view_camera);
} }
} }
_ => {} _ => {}

View file

@ -993,6 +993,7 @@ pub fn main_get_env(key: String) -> SyncReturn<String> {
pub fn main_set_local_option(key: String, value: String) { pub fn main_set_local_option(key: String, value: String) {
let is_texture_render_key = key.eq(config::keys::OPTION_TEXTURE_RENDER); let is_texture_render_key = key.eq(config::keys::OPTION_TEXTURE_RENDER);
let is_d3d_render_key = key.eq(config::keys::OPTION_ALLOW_D3D_RENDER);
set_local_option(key, value.clone()); set_local_option(key, value.clone());
if is_texture_render_key { if is_texture_render_key {
let session_event = [("v", &value)]; let session_event = [("v", &value)];
@ -1002,6 +1003,11 @@ pub fn main_set_local_option(key: String, value: String) {
session.ui_handler.update_use_texture_render(); session.ui_handler.update_use_texture_render();
} }
} }
if is_d3d_render_key {
for session in sessions::get_sessions() {
session.update_supported_decodings();
}
}
} }
// We do use use `main_get_local_option` and `main_set_local_option`. // We do use use `main_get_local_option` and `main_set_local_option`.
@ -1650,7 +1656,7 @@ pub fn session_alternative_codecs(session_id: SessionID) -> String {
pub fn session_change_prefer_codec(session_id: SessionID) { pub fn session_change_prefer_codec(session_id: SessionID) {
if let Some(session) = sessions::get_session_by_session_id(&session_id) { if let Some(session) = sessions::get_session_by_session_id(&session_id) {
session.change_prefer_codec(); session.update_supported_decodings();
} }
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", "您的远程端不支持查看摄像头。"), ("view_camera_unsupported_tip", "您的远程端不支持查看摄像头。"),
("Enable camera", "允许查看摄像头"), ("Enable camera", "允许查看摄像头"),
("No cameras", "没有摄像头"), ("No cameras", "没有摄像头"),
("d3d_render_tip", "当启用 D3D 渲染时,某些机器可能无法显示远程画面。"),
("Use D3D rendering", "使用 D3D 渲染"),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -240,5 +240,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("View camera", "View camera"), ("View camera", "View camera"),
("upgrade_remote_rustdesk_client_to_{}_tip", "Please upgrade the RustDesk client to version {} or newer on the remote side!"), ("upgrade_remote_rustdesk_client_to_{}_tip", "Please upgrade the RustDesk client to version {} or newer on the remote side!"),
("view_camera_unsupported_tip", "The remote device does not support viewing the camera."), ("view_camera_unsupported_tip", "The remote device does not support viewing the camera."),
("d3d_render_tip", "When D3D rendering is enabled, the remote control screen may be black on some machines."),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", "Il dispositivo remoto non supporta la visualizzazione della camera."), ("view_camera_unsupported_tip", "Il dispositivo remoto non supporta la visualizzazione della camera."),
("Enable camera", "Abilita camera"), ("Enable camera", "Abilita camera"),
("No cameras", "Nessuna camera"), ("No cameras", "Nessuna camera"),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -657,5 +657,12 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Untagged", ""), ("Untagged", ""),
("new-version-of-{}-tip", ""), ("new-version-of-{}-tip", ""),
("Accessible devices", ""), ("Accessible devices", ""),
("View camera", ""),
("upgrade_remote_rustdesk_client_to_{}_tip", ""),
("view_camera_unsupported_tip", ""),
("Enable camera", ""),
("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", "您的遠端設備不支援查看鏡頭"), ("view_camera_unsupported_tip", "您的遠端設備不支援查看鏡頭"),
("Enable camera", "允許查看鏡頭"), ("Enable camera", "允許查看鏡頭"),
("No cameras", "沒有鏡頭"), ("No cameras", "沒有鏡頭"),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -662,5 +662,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("view_camera_unsupported_tip", ""), ("view_camera_unsupported_tip", ""),
("Enable camera", ""), ("Enable camera", ""),
("No cameras", ""), ("No cameras", ""),
("d3d_render_tip", ""),
("Use D3D rendering", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View file

@ -503,6 +503,7 @@ fn run(vs: VideoService) -> ResultType<()> {
record_incoming, record_incoming,
last_portable_service_running, last_portable_service_running,
vs.source, vs.source,
display_idx,
) { ) {
Ok(result) => result, Ok(result) => result,
Err(err) => { Err(err) => {
@ -522,6 +523,7 @@ fn run(vs: VideoService) -> ResultType<()> {
record_incoming, record_incoming,
last_portable_service_running, last_portable_service_running,
vs.source, vs.source,
display_idx,
)? )?
} }
}; };
@ -791,6 +793,7 @@ fn setup_encoder(
record_incoming: bool, record_incoming: bool,
last_portable_service_running: bool, last_portable_service_running: bool,
source: VideoSource, source: VideoSource,
display_idx: usize,
) -> ResultType<( ) -> ResultType<(
Encoder, Encoder,
EncoderCfg, EncoderCfg,
@ -808,7 +811,7 @@ fn setup_encoder(
); );
Encoder::set_fallback(&encoder_cfg); Encoder::set_fallback(&encoder_cfg);
let codec_format = Encoder::negotiated_codec(); let codec_format = Encoder::negotiated_codec();
let recorder = get_recorder(record_incoming, name); let recorder = get_recorder(record_incoming, display_idx, source == VideoSource::Camera);
let use_i444 = Encoder::use_i444(&encoder_cfg); let use_i444 = Encoder::use_i444(&encoder_cfg);
let encoder = Encoder::new(encoder_cfg.clone(), use_i444)?; let encoder = Encoder::new(encoder_cfg.clone(), use_i444)?;
Ok((encoder, encoder_cfg, codec_format, use_i444, recorder)) Ok((encoder, encoder_cfg, codec_format, use_i444, recorder))
@ -891,7 +894,11 @@ fn get_encoder_config(
} }
} }
fn get_recorder(record_incoming: bool, video_service_name: String) -> Arc<Mutex<Option<Recorder>>> { fn get_recorder(
record_incoming: bool,
display_idx: usize,
camera: bool,
) -> Arc<Mutex<Option<Recorder>>> {
#[cfg(windows)] #[cfg(windows)]
let root = crate::platform::is_root(); let root = crate::platform::is_root();
#[cfg(not(windows))] #[cfg(not(windows))]
@ -910,7 +917,8 @@ fn get_recorder(record_incoming: bool, video_service_name: String) -> Arc<Mutex<
server: true, server: true,
id: Config::get_id(), id: Config::get_id(),
dir: crate::ui_interface::video_save_directory(root), dir: crate::ui_interface::video_save_directory(root),
video_service_name, display_idx,
camera,
tx, tx,
}) })
.map_or(Default::default(), |r| Arc::new(Mutex::new(Some(r)))) .map_or(Default::default(), |r| Arc::new(Mutex::new(Some(r))))

View file

@ -415,7 +415,7 @@ class Header: Reactor.Component {
adaptDisplay(); adaptDisplay();
} else if (type == "codec-preference") { } else if (type == "codec-preference") {
handler.set_option("codec-preference", me.id); handler.set_option("codec-preference", me.id);
handler.change_prefer_codec(); handler.update_supported_decodings();
} }
toggleMenuState(); toggleMenuState();
} }
@ -587,7 +587,7 @@ function toggleQualityMonitor(name) {
function toggleI444(name) { function toggleI444(name) {
handler.toggle_option(name); handler.toggle_option(name);
handler.change_prefer_codec(); handler.update_supported_decodings();
toggleMenuState(); toggleMenuState();
} }

View file

@ -533,7 +533,7 @@ impl sciter::EventHandler for SciterSession {
fn is_keyboard_mode_supported(String); fn is_keyboard_mode_supported(String);
fn save_keyboard_mode(String); fn save_keyboard_mode(String);
fn alternative_codecs(); fn alternative_codecs();
fn change_prefer_codec(); fn update_supported_decodings();
fn restart_remote_device(); fn restart_remote_device();
fn request_voice_call(); fn request_voice_call();
fn close_voice_call(); fn close_voice_call();

View file

@ -488,14 +488,14 @@ impl<T: InvokeUiSession> Session<T> {
(vp8, av1, h264, h265) (vp8, av1, h264, h265)
} }
pub fn change_prefer_codec(&self) { pub fn update_supported_decodings(&self) {
let msg = self.lc.write().unwrap().update_supported_decodings(); let msg = self.lc.write().unwrap().update_supported_decodings();
self.send(Data::Message(msg)); self.send(Data::Message(msg));
} }
pub fn use_texture_render_changed(&self) { pub fn use_texture_render_changed(&self) {
self.send(Data::ResetDecoder(None)); self.send(Data::ResetDecoder(None));
self.change_prefer_codec(); self.update_supported_decodings();
self.send(Data::Message(LoginConfigHandler::refresh())); self.send(Data::Message(LoginConfigHandler::refresh()));
} }