russelltg / wl-screenrec

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

SIGTERM leaves output invalid state #38

Closed hholst80 closed 10 months ago

hholst80 commented 10 months ago

I tried running wl-screenrec as a background process and then terminating it with a signal. It does not seem to work. However, it works fine if I ctrl-c and have the application as a foreground process.

[I] root@trump ~ [2]
# wl-screenrec &
[I] root@trump ~ [2]
# Using output eDP-1
Opening libva device from DRM device /dev/dri/renderD128
[h264_vaapi @ 0x55f7925178c0] Driver does not support any RC mode compatible with selected options (supported modes: CQP).
failed to open encoder in low_power mode (Invalid argument), 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
5 fps
6 fps
6 fps

[I] root@trump ~ [2]
# 10 fps
k kill11 fps
 %1    %1
[I] root@trump ~
#
fish: Job 1, 'wl-screenrec &' terminated by signal SIGTERM (Polite quit request)
[I] root@trump ~
# file screenrecord.mp4
screenrecord.mp4: ISO Media, MP4 Base Media v1 [ISO 14496-12:2003]
[I] root@trump ~
# mpv screenrecord.mp4
[ffmpeg/demuxer] mov,mp4,m4a,3gp,3g2,mj2: moov atom not found
[lavf] avformat_open_input() failed
[ffmpeg/demuxer] mov,mp4,m4a,3gp,3g2,mj2: moov atom not found
[lavf] avformat_open_input() failed
Failed to recognize file format.

Exiting... (Errors when loading file)
[I] root@trump ~ [2]
#
russelltg commented 10 months ago

Yeah, we currently register a SIGINT handler (ctrl-C), but not a sigterm. Is it typical to use sigterm in this way? I'll need to read up on the suggested usage.

russelltg commented 10 months ago

In the meantime, kill -INT pid should work

russelltg commented 10 months ago

After some reading I agree with you, and I added this.