diff options
author | Mikhail Burakov <mburakov@mailbox.org> | 2023-10-14 15:31:14 +0200 |
---|---|---|
committer | Mikhail Burakov <mburakov@mailbox.org> | 2023-10-14 15:31:14 +0200 |
commit | 0e3c61abed24e2fec2148b22fe204e28074f1e90 (patch) | |
tree | 8c750d88499d21257fd93ffde557640482439417 /encode.c | |
parent | 96840adcdc592d82a55f62c947786f0117fbcd67 (diff) |
Track video frame encoding latencyv4
Diffstat (limited to 'encode.c')
-rw-r--r-- | encode.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -33,6 +33,7 @@ #include "gpu.h" #include "hevc.h" #include "proto.h" +#include "toolbox/perf.h" #include "toolbox/utils.h" struct EncodeContext { @@ -778,7 +779,8 @@ static bool DrainBuffers(int fd, struct iovec* iovec, int count) { } } -bool EncodeContextEncodeFrame(struct EncodeContext* encode_context, int fd) { +bool EncodeContextEncodeFrame(struct EncodeContext* encode_context, int fd, + unsigned long long timestamp) { bool result = false; VABufferID buffers[8]; VABufferID* buffer_ptr = buffers; @@ -927,7 +929,7 @@ bool EncodeContextEncodeFrame(struct EncodeContext* encode_context, int fd) { .size = segment->size, .type = PROTO_TYPE_VIDEO, .flags = idr ? PROTO_FLAG_KEYFRAME : 0, - .latency = 0, + .latency = (uint16_t)(MicrosNow() - timestamp), }; struct iovec iovec[] = { {.iov_base = &proto, .iov_len = sizeof(proto)}, |