mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-05 17:16:50 +08:00
[camera_source]: fix camera reinit failed.
Issue: https://github.com/rockchip-linux/mpp/issues/408 Signed-off-by: xueman.ruan <xueman.ruan@rock-chips.com> Change-Id: Icc0b34ab28c618acdea38914300a3537c604a389
This commit is contained in:
@@ -214,9 +214,6 @@ CamSource *camera_source_init(const char *device, RK_U32 bufcnt, RK_U32 width, R
|
|||||||
goto FAIL;
|
goto FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->fbuf[i].start = mmap(NULL, buf.length,
|
|
||||||
PROT_READ | PROT_WRITE, MAP_SHARED,
|
|
||||||
ctx->fd, buf.m.offset);
|
|
||||||
if (V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE == buf.type) {
|
if (V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE == buf.type) {
|
||||||
// tmp_buffers[n_buffers].length = buf.m.planes[0].length;
|
// tmp_buffers[n_buffers].length = buf.m.planes[0].length;
|
||||||
buf_len = buf.m.planes[0].length;
|
buf_len = buf.m.planes[0].length;
|
||||||
@@ -239,6 +236,9 @@ CamSource *camera_source_init(const char *device, RK_U32 bufcnt, RK_U32 width, R
|
|||||||
mpp_err_f("ERROR: Failed to map device frame buffers\n");
|
mpp_err_f("ERROR: Failed to map device frame buffers\n");
|
||||||
goto FAIL;
|
goto FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx->fbuf[i].length = buf_len; // record buffer length for unmap
|
||||||
|
|
||||||
struct v4l2_exportbuffer expbuf = (struct v4l2_exportbuffer) {0} ;
|
struct v4l2_exportbuffer expbuf = (struct v4l2_exportbuffer) {0} ;
|
||||||
// xcam_mem_clear (expbuf);
|
// xcam_mem_clear (expbuf);
|
||||||
expbuf.type = type;
|
expbuf.type = type;
|
||||||
@@ -331,7 +331,7 @@ MPP_RET camera_source_deinit(CamSource *ctx)
|
|||||||
if (ctx->fbuf[buf.index].buffer) {
|
if (ctx->fbuf[buf.index].buffer) {
|
||||||
mpp_buffer_put(ctx->fbuf[buf.index].buffer);
|
mpp_buffer_put(ctx->fbuf[buf.index].buffer);
|
||||||
}
|
}
|
||||||
munmap(ctx->fbuf[buf.index].start, buf.length);
|
munmap(ctx->fbuf[buf.index].start, ctx->fbuf[buf.index].length);
|
||||||
close(ctx->fbuf[i].export_fd);
|
close(ctx->fbuf[i].export_fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user