MCPcopy Create free account
hub / github.com/Recordscript/recordscript / update

Method update

libs/scrap/src/common/codec.rs:170–318  ·  view source on GitHub ↗
(update: EncodingUpdate)

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 7

disable_av1Function · 0.85
enable_vram_optionFunction · 0.85
enable_hwcodec_optionFunction · 0.85
removeMethod · 0.80
iterMethod · 0.80
allMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected