I have an app based on sample 12_camera_v4l2_cuda which takes frames from a v4l2 device and writes them to a V4L2_MEMORY_DMABUF for use with nvbuf_utils. I recently updated to kernel 4.9 (specifically l4t r32.2.1) and I noticed that the v4l2 timestamps are no longer being populated by VIDIOC_DQBUF.
I know quite a lot has changed with the update to 4.9, is there something I am missing to get the v4l2 timestamps to work?
Previously all I had to do was:
struct v4l2_buffer v4l2_buf; memset(&v4l2_buf, 0, sizeof(struct v4l2_buffer)); v4l2_buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; v4l2_buf.memory = V4L2_MEMORY_DMABUF; ioctl(cam_fd, VIDIOC_DQBUF, &v4l2_buf); size_t timestamp = (v4l2_buf.timestamp.tv_sec * 1e6) + v4l2_buf.timestamp.tv_usec;
Now tv_sec and tv_usec are both 0.
For a test just add a printf to line ~615 of 12_camera_v4l2_cuda.cpp that prints out the timestamp fields of v4l2_buf.
$ /usr/src/tegra_multimedia_api/samples/12_camera_v4l2_cuda$ diff camera_v4l2_cuda.cpp camera_v4l2_cuda.cpp.old 616,618d615 < printf("tv_sec=%ld, tv_usec=%ld\n", < v4l2_buf.timestamp.tv_sec, v4l2_buf.timestamp.tv_usec); <