From cb424d37204e14c4dd0f1244922d14c1efb7a2eb Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne <nicolas.dufresne@collabora.com> Date: Tue, 2 Jun 2020 12:03:09 -0400 Subject: [PATCH] Reset flushing state if DQBUF return EPIPE This is to handle the case there was no more buffer to dequeue, otherwise flushing state will stick and we will not be able to to queue buffer afterward. Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> --- libv4l-rockchip_v2/libv4l-encplugin-rockchip.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libv4l-rockchip_v2/libv4l-encplugin-rockchip.c b/libv4l-rockchip_v2/libv4l-encplugin-rockchip.c index ddfd49c..2e06535 100644 --- a/libv4l-rockchip_v2/libv4l-encplugin-rockchip.c +++ b/libv4l-rockchip_v2/libv4l-encplugin-rockchip.c @@ -432,8 +432,15 @@ static int ioctl_dqbuf_locked(struct encoder_context *ctx, int fd, } ret = SYS_IOCTL(fd, VIDIOC_DQBUF, buffer); - if (ret) + if (ret) { + /* In some cases we may not have a buffer with the V4L2_BUF_FLAG_LAST set, + * make sure to reset our flushing state */ + if (errno == EPIPE) { + ctx->flushing = false; + ctx->can_qbuf = true; + } return ret; + } ret = SYS_IOCTL(fd, VIDIOC_QUERYBUF, buffer); if (ret) -- GitLab