Skip to content

Commit

Permalink
#83: reconnect when output goes away
Browse files Browse the repository at this point in the history
  • Loading branch information
russelltg committed Nov 13, 2024
1 parent 0f08241 commit 11f1e51
Show file tree
Hide file tree
Showing 3 changed files with 236 additions and 65 deletions.
8 changes: 5 additions & 3 deletions src/cap_ext_image_copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ impl Dispatch<ExtImageCopyCaptureSessionV1, ()> for State<CapExtImageCopy> {
.expect("Done without size/format!");
state.on_copy_src_ready(width, height, format, qhandle, &frame);
}
ext_image_copy_capture_session_v1::Event::Stopped => {}
ext_image_copy_capture_session_v1::Event::Stopped => {
state.on_copy_fail(qhandle); // untested if this actually works
}
_ => todo!(),
}
}
Expand All @@ -150,9 +152,9 @@ impl Dispatch<ExtImageCopyCaptureFrameV1, ()> for State<CapExtImageCopy> {
tv_sec_hi,
tv_sec_lo,
tv_nsec,
} => state.enc.unwrap().1.time = Some((tv_sec_hi, tv_sec_lo, tv_nsec)),
} => state.enc.unwrap().cap.time = Some((tv_sec_hi, tv_sec_lo, tv_nsec)),
Ready => {
let (hi, lo, n) = state.enc.unwrap().1.time.take().unwrap();
let (hi, lo, n) = state.enc.unwrap().cap.time.take().unwrap();
state.on_copy_complete(qhandle, hi, lo, n);
}
Failed { .. } => todo!(),
Expand Down
5 changes: 2 additions & 3 deletions src/cap_wlr_screencopy.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{path::PathBuf, sync::atomic::Ordering::SeqCst};
use std::path::PathBuf;

use anyhow::Context;
use drm::{buffer::DrmFourcc, node::DrmNode};
Expand Down Expand Up @@ -75,8 +75,7 @@ impl Dispatch<ZwlrScreencopyFrameV1, ()> for State<CapWlrScreencopy> {
zwlr_screencopy_frame_v1::Event::Buffer { .. } => {}
zwlr_screencopy_frame_v1::Event::Flags { .. } => {}
zwlr_screencopy_frame_v1::Event::Failed => {
eprintln!("Failed to screencopy!");
state.quit_flag.store(1, SeqCst)
state.on_copy_fail(qhandle);
}
_ => {}
}
Expand Down
Loading

0 comments on commit 11f1e51

Please sign in to comment.