mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
@@ -844,7 +844,7 @@ impl<T: InvokeUiSession> Remote<T> {
|
||||
use video_frame::Union::*;
|
||||
match &vf.union {
|
||||
Some(vf) => match vf {
|
||||
Vp8s(f) | Vp9s(f) | H264s(f) | H265s(f) => f.frames.iter().any(|e| e.key),
|
||||
Vp8s(f) | Vp9s(f) | Av1s(f) | H264s(f) | H265s(f) => f.frames.iter().any(|e| e.key),
|
||||
_ => false,
|
||||
},
|
||||
None => false,
|
||||
|
||||
@@ -1100,8 +1100,8 @@ pub fn session_send_note(id: String, note: String) {
|
||||
|
||||
pub fn session_alternative_codecs(id: String) -> String {
|
||||
if let Some(session) = SESSIONS.read().unwrap().get(&id) {
|
||||
let (vp8, h264, h265) = session.alternative_codecs();
|
||||
let msg = HashMap::from([("vp8", vp8), ("h264", h264), ("h265", h265)]);
|
||||
let (vp8, av1, h264, h265) = session.alternative_codecs();
|
||||
let msg = HashMap::from([("vp8", vp8), ("av1", av1), ("h264", h264), ("h265", h265)]);
|
||||
serde_json::ser::to_string(&msg).unwrap_or("".to_owned())
|
||||
} else {
|
||||
String::new()
|
||||
|
||||
@@ -35,6 +35,7 @@ use hbb_common::{
|
||||
#[cfg(not(windows))]
|
||||
use scrap::Capturer;
|
||||
use scrap::{
|
||||
aom::AomEncoderConfig,
|
||||
codec::{Encoder, EncoderCfg, HwEncoderConfig},
|
||||
record::{Recorder, RecorderContext},
|
||||
vpxcodec::{VpxEncoderConfig, VpxVideoCodecId},
|
||||
@@ -549,6 +550,11 @@ fn run(sp: GenericService) -> ResultType<()> {
|
||||
num_threads: (num_cpus::get() / 2) as _,
|
||||
})
|
||||
}
|
||||
scrap::CodecName::AV1 => EncoderCfg::AOM(AomEncoderConfig {
|
||||
width: c.width as _,
|
||||
height: c.height as _,
|
||||
bitrate: bitrate as _,
|
||||
}),
|
||||
};
|
||||
|
||||
let mut encoder;
|
||||
|
||||
@@ -162,7 +162,7 @@ class Header: Reactor.Component {
|
||||
|
||||
function renderDisplayPop() {
|
||||
var codecs = handler.alternative_codecs();
|
||||
var show_codec = codecs[0] || codecs[1] || codecs[2];
|
||||
var show_codec = codecs[0] || codecs[1] || codecs[2] || codecs[3];
|
||||
|
||||
var cursor_embedded = false;
|
||||
if ((pi.displays || []).length > 0) {
|
||||
@@ -188,8 +188,9 @@ class Header: Reactor.Component {
|
||||
<li #auto type="codec-preference"><span>{svg_checkmark}</span>Auto</li>
|
||||
{codecs[0] ? <li #vp8 type="codec-preference"><span>{svg_checkmark}</span>VP8</li> : ""}
|
||||
<li #vp9 type="codec-preference"><span>{svg_checkmark}</span>VP9</li>
|
||||
{codecs[1] ? <li #h264 type="codec-preference"><span>{svg_checkmark}</span>H264</li> : ""}
|
||||
{codecs[2] ? <li #h265 type="codec-preference"><span>{svg_checkmark}</span>H265</li> : ""}
|
||||
{codecs[1] ? <li #av1 type="codec-preference"><span>{svg_checkmark}</span>AV1</li> : ""}
|
||||
{codecs[2] ? <li #h264 type="codec-preference"><span>{svg_checkmark}</span>H264</li> : ""}
|
||||
{codecs[3] ? <li #h265 type="codec-preference"><span>{svg_checkmark}</span>H265</li> : ""}
|
||||
</div> : ""}
|
||||
<div .separator />
|
||||
{!cursor_embedded && <li #show-remote-cursor .toggle-option><span>{svg_checkmark}</span>{translate('Show remote cursor')}</li>}
|
||||
|
||||
@@ -520,9 +520,10 @@ impl SciterSession {
|
||||
}
|
||||
|
||||
fn alternative_codecs(&self) -> Value {
|
||||
let (vp8, h264, h265) = self.0.alternative_codecs();
|
||||
let (vp8, av1, h264, h265) = self.0.alternative_codecs();
|
||||
let mut v = Value::array(0);
|
||||
v.push(vp8);
|
||||
v.push(av1);
|
||||
v.push(h264);
|
||||
v.push(h265);
|
||||
v
|
||||
|
||||
@@ -225,16 +225,18 @@ impl<T: InvokeUiSession> Session<T> {
|
||||
true
|
||||
}
|
||||
|
||||
pub fn alternative_codecs(&self) -> (bool, bool, bool) {
|
||||
pub fn alternative_codecs(&self) -> (bool, bool, bool, bool) {
|
||||
let decoder = scrap::codec::Decoder::supported_decodings(None);
|
||||
let mut vp8 = decoder.ability_vp8 > 0;
|
||||
let mut av1 = decoder.ability_av1 > 0;
|
||||
let mut h264 = decoder.ability_h264 > 0;
|
||||
let mut h265 = decoder.ability_h265 > 0;
|
||||
let enc = &self.lc.read().unwrap().supported_encoding;
|
||||
vp8 = vp8 && enc.vp8;
|
||||
av1 = av1 && enc.av1;
|
||||
h264 = h264 && enc.h264;
|
||||
h265 = h265 && enc.h265;
|
||||
(vp8, h264, h265)
|
||||
(vp8, av1, h264, h265)
|
||||
}
|
||||
|
||||
pub fn change_prefer_codec(&self) {
|
||||
|
||||
Reference in New Issue
Block a user