hwcodec: codec preference

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2022-07-09 20:17:10 +08:00
parent 1b1f28b872
commit 7aa431d349
8 changed files with 217 additions and 47 deletions

View File

@@ -635,6 +635,16 @@ impl Connection {
pi.hostname = MOBILE_INFO2.lock().unwrap().clone();
pi.platform = "Android".into();
}
#[cfg(feature = "hwcodec")]
{
let (h264, h265) = scrap::codec::Encoder::supported_encoding();
pi.encoding = Some(SupportedEncoding {
h264,
h265,
..Default::default()
})
.into();
}
if self.port_forward_socket.is_some() {
let mut msg_out = Message::new();
@@ -1351,6 +1361,12 @@ impl Connection {
}
}
}
if let Some(q) = o.video_codec_state.clone().take() {
scrap::codec::Encoder::update_video_encoder(
self.inner.id(),
scrap::codec::EncoderUpdate::State(q),
);
}
}
async fn on_close(&mut self, reason: &str, lock: bool) {