fix: handle VIDIOC_QBUF error while reading video
This commit is contained in:
+6
-2
@@ -306,12 +306,16 @@ static unsigned int read_video(VideoCapture *video_capture) {
|
|||||||
|
|
||||||
if (ioctl(video_capture->fd, VIDIOC_DQBUF,
|
if (ioctl(video_capture->fd, VIDIOC_DQBUF,
|
||||||
&video_capture->buf[video_capture->buf_index]) != -1) {
|
&video_capture->buf[video_capture->buf_index]) != -1) {
|
||||||
ioctl(video_capture->fd, VIDIOC_QBUF,
|
if (ioctl(video_capture->fd, VIDIOC_QBUF,
|
||||||
&video_capture->buf[video_capture->buf_index]);
|
&video_capture->buf[video_capture->buf_index]) == -1) {
|
||||||
|
video_capture->error = true;
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
video_capture->buf_index =
|
video_capture->buf_index =
|
||||||
(video_capture->buf_index + 1) % video_capture->buf_count;
|
(video_capture->buf_index + 1) % video_capture->buf_count;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ioctl(video_capture->fd, VIDIOC_QUERYCAP, &cap) == -1) {
|
if (ioctl(video_capture->fd, VIDIOC_QUERYCAP, &cap) == -1) {
|
||||||
video_capture->error = true;
|
video_capture->error = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user