fix client check supported_hwcodec bug

This commit is contained in:
csf 2022-09-29 14:09:40 +08:00
parent 7457551b21
commit cae2c2942e
2 changed files with 5 additions and 5 deletions

View File

@ -1319,7 +1319,7 @@ impl LoginConfigHandler {
self.conn_id = pi.conn_id;
// no matter if change, for update file time
self.save_config(config);
#[cfg(feature = "hwcodec")]
#[cfg(any(feature = "hwcodec", feature = "mediacodec"))]
{
self.supported_encoding = Some((pi.encoding.h264, pi.encoding.h265));
}

View File

@ -146,10 +146,9 @@ impl<T: InvokeUiSession> Session<T> {
let decoder = scrap::codec::Decoder::video_codec_state(&self.id);
let mut h264 = decoder.score_h264 > 0;
let mut h265 = decoder.score_h265 > 0;
if let Some((encoding_264, encoding_265)) = self.lc.read().unwrap().supported_encoding {
h264 = h264 && encoding_264;
h265 = h265 && encoding_265;
}
let (encoding_264, encoding_265) = self.lc.read().unwrap().supported_encoding.unwrap_or_default();
h264 = h264 && encoding_264;
h265 = h265 && encoding_265;
return (h264, h265);
}
(false, false)
@ -1119,6 +1118,7 @@ impl<T: InvokeUiSession> Interface for Session<T> {
}
fn handle_peer_info(&mut self, mut pi: PeerInfo) {
log::debug!("handle_peer_info :{:?}", pi);
pi.username = self.lc.read().unwrap().get_username(&pi);
if pi.current_display as usize >= pi.displays.len() {
pi.current_display = 0;