russelltg / wl-screenrec

High performance wlroots screen recording, featuring hardware encoding
Apache License 2.0
299 stars 9 forks source link

Crash when suspending #83

Open LilleAila opened 1 month ago

LilleAila commented 1 month ago

If i run wl-screenrec --output HDMI-A-1 --history 10, then run systemctl suspend, the program crashes with this error:

thread 'main' panicked at src/main.rs:1052:9:
assertion failed: !self.enc.is_complete()
note: run with `RUST_BACKTRACE=1` environment variable to display a backtraces

It only happens when suspending for some time, not if i wake it immediately

Running RUST_BACKTRACE=1 wl-screenrec --output HDMI-A-1 --history 10 2> test.log gave this error:

Using output HDMI-A-1
Opening libva device from DRM device /dev/dri/renderD128
[h264_vaapi @ 0x55c74c341140] No usable encoding entrypoint found for profile VAProfileH264High (7).
failed to open encoder in low_power mode (Function not implemented), trying non low_power mode. if you have an intel iGPU, set enable_guc=2 in the i915 module to use the fixed function encoder. pass --low-power=off to suppress this warning
[h264_vaapi @ 0x55c74c341140] Driver does not support some wanted packed headers (wanted 0xd, found 0x1).
thread 'main' panicked at src/main.rs:1052:9:
assertion failed: !self.enc.is_complete()
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic
   3: wl_screenrec::State::start_if_output_probe_complete
   4: <wl_screenrec::State as wayland_client::event_queue::Dispatch<wayland_protocols_wlr::output_management::v1::generated::client::zwlr_output_manager_v1::ZwlrOutputManagerV1,()>>::event
   5: wayland_client::event_queue::queue_callback
   6: wayland_client::event_queue::EventQueue<State>::dispatching_impl
   7: wayland_client::event_queue::EventQueue<State>::blocking_dispatch
   8: wl_screenrec::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

I'm using wl-screenrec 0.1.3

LilleAila commented 1 month ago

The same also happened on wl-screenrec 0.1.4, the latest version in nixpkgs

russelltg commented 3 weeks ago

What compositor are you using?

I can repro a crash in the same spot by enabling a display while capturing, so I'll fix that, maybe that's the same bug...

russelltg commented 3 weeks ago

Ok, fixed a very similar bug, curious if it fixes the one you're running into. Try abb0f262aa41027df00f5f3be74ce78eb95b66df

LilleAila commented 3 weeks ago

What compositor are you using?

I can repro a crash in the same spot by enabling a display while capturing, so I'll fix that, maybe that's the same bug...

I’m using sway. It looks like from the behavior of swaylock (wallpaper resets on one monitor), that one of them get unplugged. I’ll try that commit

LilleAila commented 5 days ago

Ok, fixed a very similar bug, curious if it fixes the one you're running into. Try abb0f26

That seems to have partially fixed it. The original error i had stopped happening, but for my specific setup, my hdmi-connected monitor disconnects on suspend, now leading to this error instead:

Failed to screencopy!

, although this might be intended behavior and an issue on my side

russelltg commented 5 days ago

Ok thanks. I bet disconnecting the monitor that I'm recording on then reconnecting it will repro your issue, will give it a try