shithub: rtmp

Download patch

ref: adf3227845db11bde5f89abc0ca54864c4f8747d
parent: 8aaeeb16fab9270b49c9f5c2329e135cad5f9a34
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Fri Aug 13 08:08:31 EDT 2021

better "disabled sync" fix

--- a/ivf.c
+++ b/ivf.c
@@ -4,8 +4,6 @@
 #include "ivf.h"
 #include "util.h"
 
-#define Zns₀ (~0ULL)
-
 static int
 Bu16le(Biobuf *b, u16int *o)
 {
--- a/main.c
+++ b/main.c
@@ -31,12 +31,13 @@
 
 	a = aux;
 	memset(&af, 0, sizeof(af));
+	af.ns₀ = Zns₀;
 	for(;;){
 		if(adtsread(a, &af) != 0)
 			goto err;
 		if(af.sz == 0) /* eof */
 			break;
-		ms = ((af.ns₀ ? af.ns₀-ns₀ : 0) + af.ns)/1000000ULL;
+		ms = ((af.ns₀ != Zns₀ ? af.ns₀-ns₀ : 0) + af.ns)/1000000ULL;
 
 		if(rtmpdata(r, sid, ms, Taudio, af.buf, af.sz) != 0){
 err:
@@ -102,7 +103,7 @@
 			sysfatal("%r");
 		if(vf.sz == 0)
 			break;
-		ms = ((ivf.ns₀ ? ivf.ns₀-ns₀ : 0) + vf.ns)/1000000ULL;
+		ms = ((ivf.ns₀ != Zns₀ ? ivf.ns₀-ns₀ : 0) + vf.ns)/1000000ULL;
 		if(rtmpdata(r, sid, ms, Tvideo, vf.buf, vf.sz) != 0){
 			fprint(2, "%r\n");
 			break;
--- a/util.h
+++ b/util.h
@@ -1,3 +1,5 @@
+#define Zns₀ (~0ULL)
+
 void *emalloc(usize sz);
 void *ecalloc(ulong nel, usize elsz);
 void *erealloc(void *p, usize sz);