mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
@@ -999,16 +999,19 @@ pub struct VideoHandler {
|
||||
pub rgb: ImageRgb,
|
||||
recorder: Arc<Mutex<Option<Recorder>>>,
|
||||
record: bool,
|
||||
_display: usize, // useful for debug
|
||||
}
|
||||
|
||||
impl VideoHandler {
|
||||
/// Create a new video handler.
|
||||
pub fn new() -> Self {
|
||||
pub fn new(_display: usize) -> Self {
|
||||
log::info!("new video handler for display #{_display}");
|
||||
VideoHandler {
|
||||
decoder: Decoder::new(),
|
||||
rgb: ImageRgb::new(ImageFormat::ARGB, crate::DST_STRIDE_RGBA),
|
||||
recorder: Default::default(),
|
||||
record: false,
|
||||
_display,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1900,7 +1903,7 @@ where
|
||||
if handler_controller_map.len() <= display {
|
||||
for _i in handler_controller_map.len()..=display {
|
||||
handler_controller_map.push(VideoHandlerController {
|
||||
handler: VideoHandler::new(),
|
||||
handler: VideoHandler::new(_i),
|
||||
count: 0,
|
||||
duration: std::time::Duration::ZERO,
|
||||
skip_beginning: 0,
|
||||
@@ -1960,6 +1963,7 @@ where
|
||||
}
|
||||
}
|
||||
MediaData::RecordScreen(start, display, w, h, id) => {
|
||||
log::info!("record screen command: start:{start}, display:{display}");
|
||||
if handler_controller_map.len() == 1 {
|
||||
// Compatible with the sciter version(single ui session).
|
||||
// For the sciter version, there're no multi-ui-sessions for one connection.
|
||||
|
||||
@@ -2104,7 +2104,7 @@ impl Connection {
|
||||
display,
|
||||
video_service::OPTION_REFRESH,
|
||||
super::service::SERVICE_OPTION_VALUE_TRUE,
|
||||
)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2145,6 +2145,7 @@ impl Connection {
|
||||
|
||||
// Send display changed message.
|
||||
// For compatibility with old versions ( < 1.2.4 ).
|
||||
// sciter need it in new version
|
||||
if let Some(msg_out) = video_service::make_display_changed_msg(self.display_idx, None) {
|
||||
self.send(msg_out).await;
|
||||
}
|
||||
|
||||
@@ -436,8 +436,7 @@ fn run(vs: VideoService) -> ResultType<()> {
|
||||
log::info!("init quality={:?}, abr enabled:{}", quality, abr);
|
||||
let codec_name = Encoder::negotiated_codec();
|
||||
let recorder = get_recorder(c.width, c.height, &codec_name);
|
||||
let last_recording =
|
||||
(recorder.lock().unwrap().is_some() || video_qos.record()) && codec_name != CodecName::AV1;
|
||||
let last_recording = recorder.lock().unwrap().is_some() || video_qos.record();
|
||||
drop(video_qos);
|
||||
let encoder_cfg = get_encoder_config(&c, quality, last_recording);
|
||||
|
||||
@@ -479,8 +478,7 @@ fn run(vs: VideoService) -> ResultType<()> {
|
||||
allow_err!(encoder.set_quality(quality));
|
||||
video_qos.store_bitrate(encoder.bitrate());
|
||||
}
|
||||
let recording = (recorder.lock().unwrap().is_some() || video_qos.record())
|
||||
&& codec_name != CodecName::AV1;
|
||||
let recording = recorder.lock().unwrap().is_some() || video_qos.record();
|
||||
if recording != last_recording {
|
||||
bail!("SWITCH");
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ class Header: Reactor.Component {
|
||||
<span #action>{svg_action}</span>
|
||||
<span #display>{svg_display}</span>
|
||||
<span #keyboard>{svg_keyboard}</span>
|
||||
{recording_enabled && qualityMonitorData[4] != "AV1" ? <span #recording>{recording ? svg_recording_on : svg_recording_off}</span> : ""}
|
||||
{recording_enabled ? <span #recording>{recording ? svg_recording_on : svg_recording_off}</span> : ""}
|
||||
{this.renderKeyboardPop()}
|
||||
{this.renderDisplayPop()}
|
||||
{this.renderActionPop()}
|
||||
@@ -299,14 +299,22 @@ class Header: Reactor.Component {
|
||||
header.update();
|
||||
handler.record_status(recording);
|
||||
// 0 is just a dummy value. It will be ignored by the handler.
|
||||
if (recording)
|
||||
if (recording) {
|
||||
handler.refresh_video(0);
|
||||
else
|
||||
handler.record_screen(false, 0, display_width, display_height);
|
||||
if (handler.version_cmp(pi.version, '1.2.4') >= 0) handler.record_screen(recording, pi.current_display, display_width, display_height);
|
||||
}
|
||||
else {
|
||||
handler.record_screen(recording, pi.current_display, display_width, display_height);
|
||||
}
|
||||
}
|
||||
|
||||
event click $(#screen) (_, me) {
|
||||
if (pi.current_display == me.index) return;
|
||||
if (recording) {
|
||||
recording = false;
|
||||
handler.record_screen(false, pi.current_display, display_width, display_height);
|
||||
handler.record_status(false);
|
||||
}
|
||||
handler.switch_display(me.index);
|
||||
}
|
||||
|
||||
|
||||
@@ -243,6 +243,7 @@ impl InvokeUiSession for SciterHandler {
|
||||
pi_sciter.set_item("sas_enabled", pi.sas_enabled);
|
||||
pi_sciter.set_item("displays", Self::make_displays_array(&pi.displays));
|
||||
pi_sciter.set_item("current_display", pi.current_display);
|
||||
pi_sciter.set_item("version", pi.version.clone());
|
||||
self.call("updatePi", &make_args!(pi_sciter));
|
||||
}
|
||||
|
||||
@@ -469,6 +470,7 @@ impl sciter::EventHandler for SciterSession {
|
||||
fn restart_remote_device();
|
||||
fn request_voice_call();
|
||||
fn close_voice_call();
|
||||
fn version_cmp(String, String);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -757,6 +759,10 @@ impl SciterSession {
|
||||
log::error!("Failed to spawn IP tunneling: {}", err);
|
||||
}
|
||||
}
|
||||
|
||||
fn version_cmp(&self, v1: String, v2: String) -> i32 {
|
||||
(hbb_common::get_version_number(&v1) - hbb_common::get_version_number(&v2)) as i32
|
||||
}
|
||||
}
|
||||
|
||||
pub fn make_fd(id: i32, entries: &Vec<FileEntry>, only_count: bool) -> Value {
|
||||
|
||||
@@ -522,7 +522,6 @@ handler.updateQualityStatus = function(speed, fps, delay, bitrate, codec_format)
|
||||
bitrate ? qualityMonitorData[3] = bitrate:null;
|
||||
codec_format ? qualityMonitorData[4] = codec_format:null;
|
||||
qualityMonitor.update();
|
||||
if (codec_format) header.update();
|
||||
}
|
||||
|
||||
handler.setPermission = function(name, enabled) {
|
||||
|
||||
Reference in New Issue
Block a user