video_framebuff: Remove the unnecessary vbuf_curr field

since vbuf_curr is always equal to vbuf_next

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2024-03-17 15:14:06 +08:00 committed by Xiang Xiao
parent 25e7d9e43e
commit efee5f86e8
3 changed files with 9 additions and 9 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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;
};