Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit v4l2_loopback_write calls to (streaming) writers #477

Merged
merged 1 commit into from
Jun 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions v4l2loopback.c
Original file line number Diff line number Diff line change
Expand Up @@ -2087,15 +2087,17 @@ static ssize_t v4l2_loopback_read(struct file *file, char __user *buf,
static ssize_t v4l2_loopback_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
struct v4l2_loopback_opener *opener;
struct v4l2_loopback_device *dev;
int write_index;
struct v4l2_buffer *b;
MARK();

dev = v4l2loopback_getdevice(file);
opener = fh_to_opener(file->private_data);

/* there's at least one writer, so don't stop announcing output capabilities */
dev->ready_for_output = 0;
if (WRITER != opener->type)
return -EINVAL;

if (!dev->ready_for_capture) {
int ret = allocate_buffers(dev);
Expand Down