diff --git a/drivers/video/v4l2_cap.c b/drivers/video/v4l2_cap.c index f4e07754342..345b4164da6 100644 --- a/drivers/video/v4l2_cap.c +++ b/drivers/video/v4l2_cap.c @@ -1951,7 +1951,7 @@ static int complete_capture(uint8_t err_code, if (err_code == 0) { - type_inf->bufinf.vbuf_curr->buf.flags = 0; + type_inf->bufinf.vbuf_next->buf.flags = 0; if (type_inf->remaining_capnum > 0) { type_inf->remaining_capnum--; @@ -1959,13 +1959,13 @@ static int complete_capture(uint8_t err_code, } else { - type_inf->bufinf.vbuf_curr->buf.flags = V4L2_BUF_FLAG_ERROR; + type_inf->bufinf.vbuf_next->buf.flags = V4L2_BUF_FLAG_ERROR; } - type_inf->bufinf.vbuf_curr->buf.bytesused = datasize; + type_inf->bufinf.vbuf_next->buf.bytesused = datasize; if (ts != NULL) { - type_inf->bufinf.vbuf_curr->buf.timestamp = *ts; + type_inf->bufinf.vbuf_next->buf.timestamp = *ts; } video_framebuff_capture_done(&type_inf->bufinf); diff --git a/drivers/video/video_framebuff.c b/drivers/video/video_framebuff.c index 515603be767..608932008e5 100644 --- a/drivers/video/video_framebuff.c +++ b/drivers/video/video_framebuff.c @@ -42,7 +42,6 @@ static void init_buf_chain(video_framebuff_t *fbuf) fbuf->vbuf_empty = fbuf->vbuf_alloced; fbuf->vbuf_next = NULL; - fbuf->vbuf_curr = NULL; fbuf->vbuf_top = NULL; fbuf->vbuf_tail = NULL; @@ -219,7 +218,7 @@ video_framebuff_get_vacant_container(video_framebuff_t *fbuf) irqstate_t flags; flags = enter_critical_section(); - ret = fbuf->vbuf_curr = fbuf->vbuf_next; + ret = fbuf->vbuf_next; leave_critical_section(flags); return ret; @@ -227,7 +226,9 @@ video_framebuff_get_vacant_container(video_framebuff_t *fbuf) void video_framebuff_capture_done(video_framebuff_t *fbuf) { - fbuf->vbuf_curr = NULL; + irqstate_t flags; + + flags = enter_critical_section(); if (fbuf->vbuf_next != NULL) { fbuf->vbuf_next = fbuf->vbuf_next->next; diff --git a/drivers/video/video_framebuff.h b/drivers/video/video_framebuff.h index 568d45e27e8..97b89a3c26a 100644 --- a/drivers/video/video_framebuff.h +++ b/drivers/video/video_framebuff.h @@ -42,14 +42,13 @@ typedef struct vbuf_container_s vbuf_container_t; struct video_framebuff_s { - enum v4l2_buf_mode mode; + enum v4l2_buf_mode mode; mutex_t lock_empty; int container_size; vbuf_container_t *vbuf_alloced; vbuf_container_t *vbuf_empty; vbuf_container_t *vbuf_top; vbuf_container_t *vbuf_tail; - vbuf_container_t *vbuf_curr; vbuf_container_t *vbuf_next; };