v4l2: v4l2_camera_proxy: Acquire only one buffer semaphore on VIDIOC_DQBUF
We use a semaphore to atomically keep track of how many buffers are available for dequeueing. The check for how to acquire the semaphore was incorrect, leading to a double acquire upon a successful nonblocking acquire. Fix this. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
parent
d072fd6e07
commit
4ed996990d
1 changed files with 3 additions and 3 deletions
|
@ -426,10 +426,10 @@ int V4L2CameraProxy::vidioc_dqbuf(struct v4l2_buffer *arg)
|
||||||
!validateMemoryType(arg->memory))
|
!validateMemoryType(arg->memory))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (nonBlocking_ && !vcam_->bufferSema_.tryAcquire())
|
if (!nonBlocking_)
|
||||||
return -EAGAIN;
|
|
||||||
else
|
|
||||||
vcam_->bufferSema_.acquire();
|
vcam_->bufferSema_.acquire();
|
||||||
|
else if (!vcam_->bufferSema_.tryAcquire())
|
||||||
|
return -EAGAIN;
|
||||||
|
|
||||||
updateBuffers();
|
updateBuffers();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue