video_framebuff: Hold mutex in video_framebuff_realloc_container

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2024-03-17 15:23:33 +08:00 committed by Xiang Xiao
parent efee5f86e8
commit 0db82210fd

View File

@ -103,8 +103,10 @@ int video_framebuff_realloc_container(video_framebuff_t *fbuf, int sz)
{
vbuf_container_t *vbuf;
nxmutex_lock(&fbuf->lock_empty);
if (fbuf->container_size == sz)
{
nxmutex_unlock(&fbuf->lock_empty);
return OK;
}
@ -119,6 +121,7 @@ int video_framebuff_realloc_container(video_framebuff_t *fbuf, int sz)
}
else
{
nxmutex_unlock(&fbuf->lock_empty);
return -ENOMEM;
}
}
@ -130,6 +133,8 @@ int video_framebuff_realloc_container(video_framebuff_t *fbuf, int sz)
}
init_buf_chain(fbuf);
nxmutex_unlock(&fbuf->lock_empty);
return OK;
}