shootgun debugging

This commit is contained in:
tonton th 2020-12-27 02:50:41 +01:00
parent 71205d4ab0
commit e7ad5188ca
2 changed files with 10 additions and 5 deletions

View File

@ -35,6 +35,8 @@
#define SAVE_AS_CUMUL 1 #define SAVE_AS_CUMUL 1
#define SAVE_AS_FIMG 0 #define SAVE_AS_FIMG 0
#define NBR_BUFFERS 4
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
#define CLEAR(x) memset(&(x), 0, sizeof(x)) #define CLEAR(x) memset(&(x), 0, sizeof(x))
@ -192,7 +194,7 @@ if ((fmt.fmt.pix.width != width) || (fmt.fmt.pix.height != height)) {
fprintf(stderr,"--- Ok 1\n"); fprintf(stderr,"--- Ok 1\n");
CLEAR(req); CLEAR(req);
req.count = 2; req.count = NBR_BUFFERS;
req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
req.memory = V4L2_MEMORY_MMAP; req.memory = V4L2_MEMORY_MMAP;
xioctl(fd, VIDIOC_REQBUFS, &req); xioctl(fd, VIDIOC_REQBUFS, &req);
@ -220,7 +222,7 @@ for (n_buffers = 0; n_buffers < req.count; ++n_buffers) {
(void)fimg_timer_set(0); (void)fimg_timer_set(0);
for (i = 0; i < n_buffers; ++i) { for (i = 0; i < NBR_BUFFERS; ++i) {
CLEAR(buf); CLEAR(buf);
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
buf.memory = V4L2_MEMORY_MMAP; buf.memory = V4L2_MEMORY_MMAP;
@ -286,7 +288,10 @@ for (i = 0; i < nbre_capt; i++) {
buf.memory = V4L2_MEMORY_MMAP; buf.memory = V4L2_MEMORY_MMAP;
xioctl(fd, VIDIOC_DQBUF, &buf); xioctl(fd, VIDIOC_DQBUF, &buf);
fprintf(stderr, "xioctl VIDIOC_DQBUF done\n"); fflush(stderr); if(verbosity > 2) {
fprintf(stderr, "xioctl VIDIOC_DQBUF done\n");
fflush(stderr);
}
#if SAVE_AS_CUMUL #if SAVE_AS_CUMUL
if (upscaling) { if (upscaling) {
@ -403,7 +408,7 @@ fimg_destroy(&cumul);
type = V4L2_BUF_TYPE_VIDEO_CAPTURE; type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
xioctl(fd, VIDIOC_STREAMOFF, &type); xioctl(fd, VIDIOC_STREAMOFF, &type);
for (i = 0; i < n_buffers; ++i) { for (i = 0; i < NBR_BUFFERS; ++i) {
v4l2_munmap(buffers[i].start, buffers[i].length); v4l2_munmap(buffers[i].start, buffers[i].length);
} }

View File

@ -15,7 +15,7 @@ de capture des images, précisément dans cet appel système :
buf.memory = V4L2_MEMORY_MMAP; buf.memory = V4L2_MEMORY_MMAP;
xioctl(fd, VIDIOC_DQBUF, &buf); xioctl(fd, VIDIOC_DQBUF, &buf);
Quand le programme semble figé, un strace -p <pi> sort le même Quand le programme semble figé, un strace -p <pid> sort le même
message en rafale _très_ féroce : message en rafale _très_ féroce :
ioctl(3, VIDIOC_DQBUF, {type=V4L2_BUF_TYPE_VIDEO_CAPTURE}) = -1 EAGAIN (Resource temporarily unavailable) ioctl(3, VIDIOC_DQBUF, {type=V4L2_BUF_TYPE_VIDEO_CAPTURE}) = -1 EAGAIN (Resource temporarily unavailable)