fix(state): add WebRTC support to wlr-screencopy backend
Fixes #1 -- --port mode with wlr-screencopy backend caused panic at negotiate_format() because self.args.output is None and .expect() was called unconditionally. Changes: - Introduce StreamingEncoder enum wrapping EncState (MP4) and SwEncState (WebRTC) with unified frames_rgb/encode_frame/flush API - Add WebRTC fields to State<S> (webrtc, webrtc_tx, webrtc_rx, webrtc_frames_sent) matching Portal backend pattern - State::new() returns Result<Self> for clean WebRtcState init failure - negotiate_format() branches on webrtc_tx: WebRTC path uses SwEncState::new_webrtc(), MP4 path unchanged (hardware VAAPI) - Add poll_webrtc() method to drive signaling + channel drain - Event loop calls poll_webrtc() each iteration - Fix pre-existing test/bench Args construction (Option<String> output, missing no_persist field)
This commit is contained in:
+4
-2
@@ -424,7 +424,7 @@ mod tests {
|
||||
#[test]
|
||||
fn resolve_drm_device_explicit() {
|
||||
let args = Args {
|
||||
output: "test.mp4".to_string(),
|
||||
output: Some("test.mp4".to_string()),
|
||||
output_name: None,
|
||||
fps: 30,
|
||||
codec: "h264".to_string(),
|
||||
@@ -435,6 +435,7 @@ mod tests {
|
||||
verbose: false,
|
||||
backend: None,
|
||||
port: 0,
|
||||
no_persist: false,
|
||||
};
|
||||
let result = resolve_drm_device(&args).unwrap();
|
||||
assert_eq!(
|
||||
@@ -446,7 +447,7 @@ mod tests {
|
||||
#[test]
|
||||
fn resolve_drm_device_none_when_not_specified() {
|
||||
let args = Args {
|
||||
output: "test.mp4".to_string(),
|
||||
output: Some("test.mp4".to_string()),
|
||||
output_name: None,
|
||||
fps: 30,
|
||||
codec: "h264".to_string(),
|
||||
@@ -457,6 +458,7 @@ mod tests {
|
||||
verbose: false,
|
||||
backend: None,
|
||||
port: 0,
|
||||
no_persist: false,
|
||||
};
|
||||
let result = resolve_drm_device(&args).unwrap();
|
||||
assert_eq!(result, None);
|
||||
|
||||
Reference in New Issue
Block a user