Hello Martin, On Sat, 23 Nov 2024 13:03:07 +0100, Martin Pieuchot <m...@grenadille.net> wrote: > > Hello Kirill, > > On 22/11/24(Fri) 15:31, Kirill A. Korinsky wrote: > > >Synopsis: deattach broken webcam leads to crash > > What do you mean by broken? >
I mean that here no support of this webcam by some reason, so it is broken. Probably bad wording, use not fully supported is better. Anyway, I can read it by ffmpeg but not video: ~ $ video -q -f /dev/video1 video: /dev/video1 has no usable YUV encodings ~ $ ffmpeg -f v4l2 -list_formats all -i /dev/video1 ffmpeg version 4.4.5 Copyright (c) 2000-2024 the FFmpeg developers built with OpenBSD clang version 16.0.6 configuration: --enable-shared --arch=amd64 --cc=cc --enable-debug --disable-stripping --disable-indev=jack --disable-outdev=sdl2 --enable-fontconfig --enable-frei0r --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libdav1d --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmp3lame --enable-libopus --enable-libspeex --enable-libtheora --enable-libv4l2 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nonfree --enable-openssl --enable-libvidstab --extra-cflags='-I/usr/local/include -I/usr/X11R6/include' --extra-libs='-L/usr/local/lib -L/usr/X11R6/lib' --extra-ldsoflags= --mandir=/usr/local/man --objcc=/usr/bin/false --optflags='-O2 -pipe -g -Wno-redundant-decls' libavutil 56. 70.100 / 56. 70.100 libavcodec 58.134.100 / 58.134.100 libavformat 58. 76.100 / 58. 76.100 libavdevice 58. 13.100 / 58. 13.100 libavfilter 7.110.100 / 7.110.100 libswscale 5. 9.100 / 5. 9.100 libswresample 3. 9.100 / 3. 9.100 libpostproc 55. 9.100 / 55. 9.100 [video4linux2,v4l2 @ 0xc1be02d2800] Compressed: mjpeg : MJPEG : 640x360 960x540 1280x720 1920x1080 /dev/video1: Immediate exit requested ~ $ Thus, when I try to use ffplay, it doesn't create a X11 window, instead it complains like this: [video4linux2,v4l2 @ 0x7224f2ce000] ioctl(VIDIOC_DQBUF): Invalid argument [video4linux2,v4l2 @ 0x7224f2ce000] Could not find codec parameters for stream 0 (Video: mjpeg, none(bt470bg/unknown/unknown), 1920x1080): unspecified pixel format Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options Input #0, video4linux2,v4l2, from '/dev/video1': Duration: N/A, bitrate: N/A Stream #0:0: Video: mjpeg, none(bt470bg/unknown/unknown), 1920x1080, 30 fps, 30 tbr, 1000k tbn, 1000k tbc [video4linux2,v4l2 @ 0x7224f2ce000] ioctl(VIDIOC_DQBUF): Invalid argument [video4linux2,v4l2 @ 0x7224f2ce000] ioctl(VIDIOC_DQBUF): Invalid argument > > and it is frozen. I can't kill the process that leads to: > > Where is it frozen? On which sleep channel is ffplay sleeping? Can you > enter ddb and get a trace of the ffplay process? > When ffplay is complaining ioctl(VIDIOC_DQBUF): Invalid argument, it creates a few threads and everything works. When I press C-c on terminal or use pkill -KILL ffplay nothing happens, but ffplay changes its state via ps from ~ $ ps aux | grep fplay catap 20332 0.8 0.3 35204 53348 p2 S+ 2:05PM 0:00.51 ffplay -f v4l2 -i /dev/video1 catap 77165 0.0 0.0 796 1376 p4 S+p 2:05PM 0:00.01 grep fplay ~ $ into $ ps aux | grep ffplay catap 20332 0.0 0.3 29280 47628 p2 RE+/2 2:05PM 0:00.63 (ffplay) catap 97615 0.0 0.0 100 360 C0 R+/2 2:07PM 0:00.00 grep ffplay $ and there is no ffplay processes by ps in ddb anymore. I see only uvideo1 which has stacktrace: ddb{1}> tr /t 0t393427 sleep_finish(0,1) at sleep_finish+0x17f usbd_transfer(fffffdb461bb4c08) at usbd_transfer+0x275 uvideo_vs_start_bulk_thread(ffff800001b25000) at uvideo_vs_start_bulk_thread+0x7e end trace frame: 0x0, count: -3 ddb{1}> and when I deattach the webcam from the machine, it crashes with stacktrace: uvm_fault(0xfffffdb32e87f840, 0x3f, 0, 2) -> e kernel: page fault trap, code=2 Stopped at usbd_close_pipe+0x91: movq %rcx,0x40(%rax) TID PID UID PRFLAGS PFLAGS CPU COMMAND 420740 59811 1000 0x100002 0 0 xconsole 421818 10645 0 0x100000 0x80 3 hotplugd 205493 61124 0 0x14000 0x200 1 reaper usbd_close_pipe(ffff800001c99000) at usbd_close_pipe+0x91 uvideo_close(ffff8000019bf000) at uvideo_close+0x57 videoclose(2c81,3,2000,ffff80004d2c16c8) at videoclose+0x63 spec_close(ffff80004bf56488) at spec_close+0x107 VOP_CLOSE(fffffdd4518e6e78,3,fffffdd3e18fe480,ffff80004d2c16c8) at VOP_CLOSE+0x59 vn_closefile(fffffdd825a0edb58,ffff80004d2c16c8) at vn_closefile+0xaf fdrop(fffffdd825a0edb58,ffff80004d2c16c8) at fdrop+0xa5 closef(fffffdd825a0edb58,ffff80004d2c16c8) at closef+0xaf fdfree(ffff80004d2c16c8) at fdfree+0xa6 exit1(ffff80004d2c16c8,7b,0,1) at exit1+0x29b sys_exit(ffff80004d2c16c8,ffff80004bf56780,ffff80004bf56f80) at sys_exit+0x1a syscall(ffff80004bf56780) at syscall+0x5e7 Xsyscall() at Xsyscall+0x128 end of kernel end trace frame: 0x761dc4ff9130, count: 2 https://www.openbsd.org/ddb.html describes the minimum info required in bug reports. Insufficient info makes it difficult to find and fix bugs. ddb(2)> Here, I double-checked the traces and it shouldn't contain any typos/errors. Also, if I wait a few minutes after C-c or kill ffpplay, I can deattach the webcam without crashing, and the ffplay process just disappears. -- wbr, Kirill