Skip to content

Commit

Permalink
allow repeat reqbuf when buffers not mapped
Browse files Browse the repository at this point in the history
  • Loading branch information
stephematician committed Oct 22, 2024
1 parent e34bc18 commit ff8ba96
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions v4l2loopback.c
Original file line number Diff line number Diff line change
Expand Up @@ -1581,8 +1581,13 @@ static int vidioc_reqbufs(struct file *file, void *fh,
return 0;
}

if (V4L2_TYPE_IS_OUTPUT(b->type) && (!dev->ready_for_output)) {
return -EBUSY;
if (V4L2_TYPE_IS_OUTPUT(b->type)) {
if (!dev->ready_for_output)
return -EBUSY;
int i;
for (i = 0; i < dev->buffers_number; ++i)
if (dev->buffers[i].buffer.flags & V4L2_BUF_FLAG_MAPPED)
return -EBUSY;
}

init_buffers(dev);
Expand Down Expand Up @@ -1959,6 +1964,7 @@ static int vidioc_streamoff(struct file *file, void *fh,
case V4L2_BUF_TYPE_VIDEO_OUTPUT:
if (dev->ready_for_capture > 0)
dev->ready_for_capture--;
dev->ready_for_output = 1;
return 0;
case V4L2_BUF_TYPE_VIDEO_CAPTURE:
if (opener->type == READER) {
Expand Down

0 comments on commit ff8ba96

Please sign in to comment.