(update: EncodingUpdate)
| 168 | } |
| 169 | |
| 170 | pub fn update(update: EncodingUpdate) { |
| 171 | log::info!("update:{:?}", update); |
| 172 | let mut decodings = PEER_DECODINGS.lock().unwrap(); |
| 173 | match update { |
| 174 | EncodingUpdate::Update(id, decoding) => { |
| 175 | decodings.insert(id, decoding); |
| 176 | } |
| 177 | EncodingUpdate::Remove(id) => { |
| 178 | decodings.remove(&id); |
| 179 | } |
| 180 | EncodingUpdate::NewOnlyVP9(id) => { |
| 181 | decodings.insert( |
| 182 | id, |
| 183 | SupportedDecoding { |
| 184 | ability_vp9: 1, |
| 185 | ..Default::default() |
| 186 | }, |
| 187 | ); |
| 188 | } |
| 189 | EncodingUpdate::Check => {} |
| 190 | } |
| 191 | |
| 192 | let vp8_useable = decodings.len() > 0 && decodings.iter().all(|(_, s)| s.ability_vp8 > 0); |
| 193 | let av1_useable = decodings.len() > 0 |
| 194 | && decodings.iter().all(|(_, s)| s.ability_av1 > 0) |
| 195 | && !disable_av1(); |
| 196 | let _all_support_h264_decoding = |
| 197 | decodings.len() > 0 && decodings.iter().all(|(_, s)| s.ability_h264 > 0); |
| 198 | let _all_support_h265_decoding = |
| 199 | decodings.len() > 0 && decodings.iter().all(|(_, s)| s.ability_h265 > 0); |
| 200 | #[allow(unused_mut)] |
| 201 | let mut h264vram_encoding = false; |
| 202 | #[allow(unused_mut)] |
| 203 | let mut h265vram_encoding = false; |
| 204 | #[cfg(feature = "vram")] |
| 205 | if enable_vram_option() { |
| 206 | if _all_support_h264_decoding { |
| 207 | if VRamEncoder::available(CodecFormat::H264).len() > 0 { |
| 208 | h264vram_encoding = true; |
| 209 | } |
| 210 | } |
| 211 | if _all_support_h265_decoding { |
| 212 | if VRamEncoder::available(CodecFormat::H265).len() > 0 { |
| 213 | h265vram_encoding = true; |
| 214 | } |
| 215 | } |
| 216 | } |
| 217 | #[allow(unused_mut)] |
| 218 | let mut h264hw_encoding: Option<String> = None; |
| 219 | #[allow(unused_mut)] |
| 220 | let mut h265hw_encoding: Option<String> = None; |
| 221 | #[cfg(feature = "hwcodec")] |
| 222 | if enable_hwcodec_option() { |
| 223 | if _all_support_h264_decoding { |
| 224 | h264hw_encoding = |
| 225 | HwRamEncoder::try_get(CodecFormat::H264).map_or(None, |c| Some(c.name)); |
| 226 | } |
| 227 | if _all_support_h265_decoding { |
nothing calls this directly
no test coverage detected