mirror of
https://github.com/infiniteCable2/openpilot.git
synced 2026-08-05 16:26:10 +08:00
encoderd: fix bytesused (#24553)
fix bytesused Co-authored-by: Comma Device <device@comma.ai> old-commit-hash: 3718f9a6e0fdae601b1f90e1f88328609edea885
This commit is contained in:
@@ -37,10 +37,11 @@ static void dequeue_buffer(int fd, v4l2_buf_type buf_type, unsigned int *index=N
|
||||
assert(v4l_buf.m.planes[0].data_offset == 0);
|
||||
}
|
||||
|
||||
static void queue_buffer(int fd, v4l2_buf_type buf_type, unsigned int index, VisionBuf *buf, struct timeval timestamp={0}) {
|
||||
static void queue_buffer(int fd, v4l2_buf_type buf_type, unsigned int index, VisionBuf *buf, struct timeval timestamp={0}, unsigned int bytesused=0) {
|
||||
v4l2_plane plane = {
|
||||
.length = (unsigned int)buf->len,
|
||||
.m = { .userptr = (unsigned long)buf->addr, },
|
||||
.bytesused = bytesused,
|
||||
.reserved = {(unsigned int)buf->fd}
|
||||
};
|
||||
|
||||
@@ -275,6 +276,7 @@ int V4LEncoder::encode_frame(const uint8_t *y_ptr, const uint8_t *u_ptr, const u
|
||||
int in_uv_stride = VENUS_UV_STRIDE(COLOR_FMT_NV12, in_width);
|
||||
uint8_t *in_uv_ptr = in_y_ptr + (in_y_stride * VENUS_Y_SCANLINES(COLOR_FMT_NV12, in_height));
|
||||
|
||||
|
||||
// GRRR COPY
|
||||
int err = libyuv::I420ToNV12(y_ptr, in_width,
|
||||
u_ptr, in_width/2,
|
||||
@@ -292,7 +294,9 @@ int V4LEncoder::encode_frame(const uint8_t *y_ptr, const uint8_t *u_ptr, const u
|
||||
// push buffer
|
||||
extras.push(*extra);
|
||||
buf_in[buffer_in].sync(VISIONBUF_SYNC_TO_DEVICE);
|
||||
queue_buffer(fd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, buffer_in, &buf_in[buffer_in], timestamp);
|
||||
int bytesused = VENUS_Y_STRIDE(COLOR_FMT_NV12, in_width) * VENUS_Y_SCANLINES(COLOR_FMT_NV12, in_height) +
|
||||
VENUS_UV_STRIDE(COLOR_FMT_NV12, in_width) * VENUS_UV_SCANLINES(COLOR_FMT_NV12, in_height);
|
||||
queue_buffer(fd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, buffer_in, &buf_in[buffer_in], timestamp, bytesused);
|
||||
|
||||
return this->counter++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user