From fe3dc2644112c70c0e4011779d4a04bc5adef93e Mon Sep 17 00:00:00 2001 From: Andri Yngvason Date: Sun, 17 Mar 2024 10:14:53 +0000 Subject: [PATCH] h264-v4l2m2m: Add timestamp to source buffers --- src/h264-encoder-v4l2m2m-impl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/h264-encoder-v4l2m2m-impl.c b/src/h264-encoder-v4l2m2m-impl.c index a05c74e..cfc6059 100644 --- a/src/h264-encoder-v4l2m2m-impl.c +++ b/src/h264-encoder-v4l2m2m-impl.c @@ -482,6 +482,9 @@ static void encode_buffer(struct h264_encoder_v4l2m2m* self, srcbuf->buffer.m.planes[i].data_offset = offset; } + srcbuf->buffer.timestamp.tv_sec = fb->pts / UINT64_C(1000000); + srcbuf->buffer.timestamp.tv_usec = fb->pts % UINT64_C(1000000); + int rc = v4l2_qbuf(self->fd, &srcbuf->buffer); if (rc < 0) { nvnc_log(NVNC_LOG_PANIC, "Failed to enqueue buffer: %m");