shithub: hj264

Download patch

ref: 54828ea624dfe47847b4efe66687daa8bb215e03
parent: b88eb37f01e419092a2765fb135f486b2dc693db
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Mon Jul 19 09:24:20 EDT 2021

assign timestamp to each frame

--- a/hj264.c
+++ b/hj264.c
@@ -53,6 +53,7 @@
 };
 
 struct Img {
+	uvlong ns;
 	int w;
 	int h;
 	u8int bgrx[];
@@ -224,6 +225,7 @@
 encthread(void *p)
 {
 	u8int *data;
+	uvlong ns;
 	Img *img;
 	Hj264 *h;
 	int sz;
@@ -233,6 +235,8 @@
 		if((img = recvp(h->frame)) == nil)
 			break;
 		xrgb2yuv420(img->bgrx, img->w, img->h, &h->yuv);
+		ns = img->ns;
+		USED(ns);
 		free(img);
 
 		if(hj264_encode(h, &data, &sz) != 0)
@@ -265,6 +269,7 @@
 			return nil;
 		}
 	}
+	i->ns = npe_nanosec();
 
 	return i;
 }