perf(portal): achieve 58-60fps PipeWire screen capture
- Force PipeWire quantum=512 via NODE_FORCE_QUANTUM (48000/512=93Hz scheduling) - Switch to libx264 ultrafast/zerolatency with 6 threads - Use two-phase poll_and_encode: blocking recv_timeout for first frame, non-blocking try_recv drain for subsequent frames - Remove fps_limit from portal path (PW already rate-limits via quantum/KWin; fps_limit's min_interval was silently dropping ~10% of valid frames) - Remove diagnostic instrumentation (TIMING/PIPEWIRE logs, timing fields, pw_stats counters) - Add lightweight production stats: per-10s fps log + shutdown summary - Prefer libx264 over libopenh264 (better quality at same speed)
This commit is contained in:
+7
-4
@@ -996,10 +996,10 @@ fn create_software_h264_muxer(
|
||||
ff::format::context::Output,
|
||||
)> {
|
||||
let output_cstr = CString::new(output_path.to_str().unwrap())?;
|
||||
let codec = ff::encoder::find_by_name("libopenh264")
|
||||
.or_else(|| ff::encoder::find_by_name("libx264"))
|
||||
let codec = ff::encoder::find_by_name("libx264")
|
||||
.or_else(|| ff::encoder::find_by_name("libopenh264"))
|
||||
.ok_or_else(|| {
|
||||
anyhow::anyhow!("No H.264 software encoder found (tried libopenh264, libx264)")
|
||||
anyhow::anyhow!("No H.264 software encoder found (tried libx264, libopenh264)")
|
||||
})?;
|
||||
let codec_name = codec.name().to_string();
|
||||
|
||||
@@ -1024,11 +1024,14 @@ fn create_software_h264_muxer(
|
||||
// SAFETY: priv_data belongs to the unopened encoder; strings live for each call.
|
||||
unsafe {
|
||||
let key = CString::new("preset").unwrap();
|
||||
let val = CString::new("veryfast").unwrap();
|
||||
let val = CString::new("ultrafast").unwrap();
|
||||
ffi::av_opt_set((*enc.as_mut_ptr()).priv_data, key.as_ptr(), val.as_ptr(), 0);
|
||||
let key = CString::new("tune").unwrap();
|
||||
let val = CString::new("zerolatency").unwrap();
|
||||
ffi::av_opt_set((*enc.as_mut_ptr()).priv_data, key.as_ptr(), val.as_ptr(), 0);
|
||||
let key = CString::new("threads").unwrap();
|
||||
let val = CString::new("6").unwrap();
|
||||
ffi::av_opt_set((*enc.as_mut_ptr()).priv_data, key.as_ptr(), val.as_ptr(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user