shithub: rtmp

Download patch

ref: 96dae8c3993f40aef4aec95ad035b0d34d756950
parent: 1471e462a43ff169164215653f13bdf75ccf8ea4
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Fri Aug 13 07:45:42 EDT 2021

if initial timestamps aren't set, disable sync

--- a/main.c
+++ b/main.c
@@ -36,7 +36,7 @@
 			goto err;
 		if(af.sz == 0) /* eof */
 			break;
-		ms = (af.ns₀ - ns₀ + af.ns)/1000000ULL;
+		ms = ((af.ns₀ ? af.ns₀-ns₀ : 0) + af.ns)/1000000ULL;
 
 		if(rtmpdata(r, sid, ms, Taudio, af.buf, af.sz) != 0){
 err:
@@ -102,7 +102,7 @@
 			sysfatal("%r");
 		if(vf.sz == 0)
 			break;
-		ms = (ivf.ns₀ - ns₀ + vf.ns)/1000000ULL;
+		ms = ((ivf.ns₀ ? ivf.ns₀-ns₀ : 0) + vf.ns)/1000000ULL;
 		if(rtmpdata(r, sid, ms, Tvideo, vf.buf, vf.sz) != 0){
 			fprint(2, "%r\n");
 			break;